[CRIU] [PATCHv3 1/8] util: Fix reversed IPv4/IPv6 port assignment

Radostin Stoyanov rstoyanov1 at gmail.com
Wed Sep 5 00:26:50 MSK 2018


Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
 criu/util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/criu/util.c b/criu/util.c
index ab4d89aa..22d0be42 100644
--- a/criu/util.c
+++ b/criu/util.c
@@ -1322,9 +1322,9 @@ int setup_tcp_server(char *type)
 		}
 
 		if (saddr.ss_family == AF_INET6) {
-			opts.port = ntohs(((struct sockaddr_in *)&saddr)->sin_port);
-		} else if (saddr.ss_family == AF_INET) {
 			opts.port = ntohs(((struct sockaddr_in6 *)&saddr)->sin6_port);
+		} else if (saddr.ss_family == AF_INET) {
+			opts.port = ntohs(((struct sockaddr_in *)&saddr)->sin_port);
 		}
 
 		pr_info("Using %u port\n", opts.port);
-- 
2.17.1



More information about the CRIU mailing list