[xdm PATCH 2/3] xdmcp: disable IPV6_V6ONLY for ipv6 listening sockets

Julien Cristau jcristau at debian.org
Tue Mar 23 11:40:49 PDT 2010


This allows ipv4 connections mapped to ipv6, in case the system default
is backwards.

Signed-off-by: Julien Cristau <jcristau at debian.org>
---
 socket.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/socket.c b/socket.c
index 7e678ad..8cd9d69 100644
--- a/socket.c
+++ b/socket.c
@@ -175,6 +175,17 @@ CreateListeningSocket (struct sockaddr *sock_addr, int salen)
     }
     RegisterCloseOnFork (fd);
 
+#  if defined(IPv6) && defined(IPV6_V6ONLY)
+    if (sock_addr->sa_family == AF_INET6)
+	int zero = 0;
+	if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &zero, sizeof zero) < 0) {
+	    LogError ("Could not disable V6ONLY on XDMCP socket: %s\n",
+	              _SysErrorMsg (errno));
+	}
+    }
+#  endif
+
     if (bind (fd, sock_addr, salen) == -1)
     {
 	LogError ("error binding socket address %d: %s\n", request_port,
-- 
1.7.0



More information about the xorg-devel mailing list