Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/hooks/sock_hc.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ void igloo_sock_bind(struct socket *sock, struct sockaddr_storage *address){
int hrv = 1;
int i;
mutex_lock(&bind_mutex);
char buffer[32];

if (address->ss_family == AF_INET) {
// IPv4: hypercall 200
Expand All @@ -51,8 +52,8 @@ void igloo_sock_bind(struct socket *sock, struct sockaddr_storage *address){
}
hrv = igloo_hypercall2(IGLOO_IPV4_SETUP, (unsigned long)current->comm, (unsigned long)addr_in->sin_addr.s_addr);
}

igloo_hypercall2(IGLOO_IPV4_BIND, (unsigned long)port, (unsigned long)is_stream);
snprintf(buffer, sizeof(buffer), "%hu:%ld", port, (long)current->pid);
igloo_hypercall2(IGLOO_IPV4_BIND, (unsigned long)&buffer, (unsigned long)is_stream);

} else if (address->ss_family == AF_INET6) {
// IPv6: hypercall 201
Expand All @@ -70,8 +71,8 @@ void igloo_sock_bind(struct socket *sock, struct sockaddr_storage *address){
}
hrv = igloo_hypercall2(IGLOO_IPV6_SETUP, (unsigned long)current->comm, (unsigned long)&addr_in6->sin6_addr);
}

igloo_hypercall2(IGLOO_IPV6_BIND, (unsigned long)port, (unsigned long)is_stream);
snprintf(buffer, sizeof(buffer), "%hu:%ld", port, (long)current->pid);
igloo_hypercall2(IGLOO_IPV6_BIND, (unsigned long)&buffer, (unsigned long)is_stream);
}
mutex_unlock(&bind_mutex);
}
Expand Down Expand Up @@ -136,4 +137,4 @@ int sock_hc_init(void){
printk(KERN_ERR "IGLOO: Failed to find igloo_sock_bind_module symbol via kallsyms\n");
}
return 0;
}
}