[dovecot-cvs] dovecot/src/lib network.c,1.27,1.28

cras at dovecot.org cras at dovecot.org
Fri May 13 16:35:22 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv12282/src/lib

Modified Files:
	network.c 
Log Message:
if using IPv6, bind both on the IPv4 and IPv6 addresses if IPV6_V6ONLY is
defined. Patch by Marco d'Itri



Index: network.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/network.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- network.c	9 Jan 2005 16:52:30 -0000	1.27
+++ network.c	13 May 2005 13:35:19 -0000	1.28
@@ -271,6 +271,13 @@
 	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 */
+#ifdef IPV6_V6ONLY
+	if (so.sin.sin_family == AF_INET6) {
+		opt = 0;
+		setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &opt, sizeof(opt));
+	}
+#endif
 	/* specify the address/port we want to listen in */
 	ret = bind(fd, &so.sa, SIZEOF_SOCKADDR(so));
 	if (ret >= 0) {



More information about the dovecot-cvs mailing list