Set IPV6_V6ONLY socket option when -6 switch is used.

Mauro Tortonesi <[email protected]>
Newsgroups gmane.comp.web.wget.patches
Organization University of Ferrara
Message-ID <[email protected]>
this patch addresses the problem we've been talking about in this thread:

http://www.mail-archive.com/wget%40sunsite.dk/msg07505.html


2005-04-20  Mauro Tortonesi  <[email protected]>

        * connect.s: Set IPV6_V6ONLY socket option when -6 switch is used.

Index: src/connect.c
===================================================================
RCS file: /pack/anoncvs/wget/src/connect.c,v
retrieving revision 1.68
diff -u -r1.68 connect.c
--- src/connect.c	2005/04/01 18:22:38	1.68
+++ src/connect.c	2005/04/21 01:20:47
@@ -283,6 +283,18 @@
   if (sock < 0)
     goto err;
 
+#if defined(ENABLE_IPV6) && defined(IPV6_V6ONLY)
+  if (opt.ipv6_only) {
+    int on = 1;
+    /* In case of error, we will go on anyway... */
+    int err = setsockopt (sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof (on));
+#ifdef ENABLE_DEBUG
+    if (err < 0) 
+      DEBUGP (("Failed setting IPV6_V6ONLY: %s", strerror (errno)));
+#endif
+  }
+#endif
+
   /* For very small rate limits, set the buffer size (and hence,
      hopefully, the kernel's TCP window size) to the per-second limit.
      That way we should never have to sleep for more than 1s between


-- 
Aequam memento rebus in arduis servare mentem...

Mauro Tortonesi

University of Ferrara - Dept. of Eng.    http://www.ing.unife.it
Institute of Human & Machine Cognition   http://www.ihmc.us
Deep Space 6 - IPv6 for Linux            http://www.deepspace6.net
Ferrara Linux User Group                 http://www.ferrara.linux.it
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.