Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#! /bin/sh /usr/share/dpatch/dpatch-run
## ipv6_v6only.dpatch by Magnus Holmgren <holmgren@debian.org>
##
## DP: Set the IPV6_V6ONLY socket option on AF_INET6 sockets; since
## DP: lshd by default enumerates available address families and calls
## DP: bind() once for each, conflicts will occur otherwise.

@DPATCH@
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' trunk~/src/io.c trunk/src/io.c
--- trunk~/src/io.c     2006-01-23 18:49:58.000000000 +0100
+++ trunk/src/io.c      2010-07-27 02:17:04.000000000 +0200
@@ -1690,6 +1690,13 @@
   {
     int yes = 1;
     setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char*)&yes, sizeof yes);
+#if WITH_IPV6 && defined (IPV6_V6ONLY)
+    if (local->sa_family == AF_INET6)
+      {
+        if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &yes, sizeof(yes)) < 0)
+          werror("setsockopt IPV6_V6ONLY failed: %e.\n", errno);
+      }
+#endif
   }
 
   if (bind(s, local, length) < 0)