diff src/lib/network.c @ 7274:da971cec0395 HEAD

[::] listens only for IPv6 addresses now. This gets rid of IPv4-mapped IPv6 addresses. Use "listen = *, [::]" for listening both.
author Timo Sirainen <tss@iki.fi>
date Thu, 21 Feb 2008 15:18:31 +0200
parents 7ed926ed7aa4
children e0007da64cdc
line wrap: on
line diff
--- a/src/lib/network.c	Thu Feb 21 14:46:01 2008 +0200
+++ b/src/lib/network.c	Thu Feb 21 15:18:31 2008 +0200
@@ -318,10 +318,11 @@
 	setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
 	setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &opt, sizeof(opt));
 
-	/* if using IPv6, bind both on the IPv4 and IPv6 addresses */
+	/* If using IPv6, bind only to IPv6 if possible. This avoids
+	   ambiguities with IPv4-mapped IPv6 addresses. */
 #ifdef IPV6_V6ONLY
 	if (so.sin.sin_family == AF_INET6) {
-		opt = 0;
+		opt = 1;
 		setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &opt, sizeof(opt));
 	}
 #endif