changeset 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 1d87dc550378
children 6127a0501e72
files dovecot-example.conf src/lib/network.c
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/dovecot-example.conf	Thu Feb 21 14:46:01 2008 +0200
+++ b/dovecot-example.conf	Thu Feb 21 15:18:31 2008 +0200
@@ -25,7 +25,7 @@
 # A space separated list of IP or host addresses where to listen in for
 # connections. "*" listens in all IPv4 interfaces. "[::]" listens in all IPv6
 # interfaces, but may also listen in all IPv4 interfaces depending on the
-# operating system.
+# operating system. Use "*, [::]" for listening both IPv4 and IPv6.
 #
 # If you want to specify ports for each service, you will need to configure
 # these settings inside the protocol imap/pop3 { ... } section, so you can
--- 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