mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 22:05:36 +00:00
util: Fix addr casting for IPv4/IPv6 in autobind
When saddr.ss_family is AF_INET6 we should cast &saddr to (struct sockaddr_in6 *). Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com> Signed-off-by: Andrei Vagin <avagin@gmail.com>
This commit is contained in:
committed by
Andrei Vagin
parent
be2ded15ee
commit
01cab14dfa
@@ -1131,9 +1131,9 @@ int setup_tcp_server(char *type, char *addr, unsigned short *port)
|
||||
}
|
||||
|
||||
if (saddr.ss_family == AF_INET6) {
|
||||
(*port) = ntohs(((struct sockaddr_in *)&saddr)->sin_port);
|
||||
} else if (saddr.ss_family == AF_INET) {
|
||||
(*port) = ntohs(((struct sockaddr_in6 *)&saddr)->sin6_port);
|
||||
} else if (saddr.ss_family == AF_INET) {
|
||||
(*port) = ntohs(((struct sockaddr_in *)&saddr)->sin_port);
|
||||
}
|
||||
|
||||
pr_info("Using %u port\n", (*port));
|
||||
|
Reference in New Issue
Block a user