changeset 627:7cc34a52feb8

Try bind IPV6_V6ONLY
author Matt Johnston <matt@ucc.asn.au>
date Thu, 20 Oct 2011 13:45:43 +0000
parents d204868e7943
children d40f3cc47aed
files dbutil.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dbutil.c	Tue Jul 05 12:52:06 2011 +0000
+++ b/dbutil.c	Thu Oct 20 13:45:43 2011 +0000
@@ -254,6 +254,16 @@
 		linger.l_linger = 5;
 		setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&linger, sizeof(linger));
 
+#ifdef IPV6_V6ONLY
+		if (res->ai_family == AF_INET6) {
+			int on = 1;
+			if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, 
+						&on, sizeof(on)) == -1) {
+				dropbear_log(LOG_WARNING, "Couldn't set IPV6_V6ONLY");
+			}
+		}
+#endif
+
 		set_sock_priority(sock);
 
 		if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) {