changeset 93:7ff7b213a3fc

common: connsvc should set IPV6_V6ONLY socket option on AF_INET6 sockets Not setting it may result in address already in use errors. If AF_INET6 attempts to claim both the IPv4 and IPv6 port it may fail if the previous iteration through the getaddrinfo results has already returned AF_INET and we opened it. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Sat, 17 Oct 2015 10:39:06 -0400
parents 0f0c3f936d55
children 1235adf7e449
files src/common/connsvc.c
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/common/connsvc.c	Sat Oct 17 10:39:05 2015 -0400
+++ b/src/common/connsvc.c	Sat Oct 17 10:39:06 2015 -0400
@@ -113,6 +113,7 @@
 		return errno;
 
 	setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+	setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on));
 
 	if (bind(fd, addr, addrlen))
 		goto err;