summaryrefslogtreecommitdiffstats
path: root/patches/source/gnutls/gnutls-2.10.5_ipv6.diff
diff options
context:
space:
mode:
Diffstat (limited to 'patches/source/gnutls/gnutls-2.10.5_ipv6.diff')
-rw-r--r--patches/source/gnutls/gnutls-2.10.5_ipv6.diff51
1 files changed, 51 insertions, 0 deletions
diff --git a/patches/source/gnutls/gnutls-2.10.5_ipv6.diff b/patches/source/gnutls/gnutls-2.10.5_ipv6.diff
new file mode 100644
index 000000000..a96b1e629
--- /dev/null
+++ b/patches/source/gnutls/gnutls-2.10.5_ipv6.diff
@@ -0,0 +1,51 @@
+From 769faff8029083b43e8c4949ee9d7cd988f7ec01 Mon Sep 17 00:00:00 2001
+From: mancha <mancha1@hush.com>
+Date: Sun, 29 Sep 2013
+Subject: Fix binding of IPV6 address in gnutls-serv
+
+On Linux with /proc/sys/net/ipv6/bindv6only == 0 (which is now the
+default), gnutls-serv cannot listen on ipv6.
+
+Fix adapted for use with GnuTLS 2.10.5.
+
+Relevant upstream commits:
+--------------------------
+https://gitorious.org/gnutls/gnutls/commit/1c315602306afc
+https://gitorious.org/gnutls/gnutls/commit/9c1536d514dd83
+
+---
+ serv.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+--- a/src/serv.c 2013-09-29
++++ b/src/serv.c 2013-09-29
+@@ -701,6 +701,11 @@ listen_socket (const char *name, int lis
+
+ for (ptr = res; ptr != NULL; ptr = ptr->ai_next)
+ {
++#ifndef HAVE_IPV6
++ if (ptr->ai_family != AF_INET)
++ continue;
++#endif
++
+ /* Print what we are doing. */
+ {
+ char topbuf[512];
+@@ -717,6 +722,17 @@ listen_socket (const char *name, int lis
+ continue;
+ }
+
++#if defined(HAVE_IPV6) && !defined(_WIN32)
++ if (ptr->ai_family == AF_INET6)
++ {
++ yes = 1;
++ /* avoid listen on ipv6 addresses failing
++ * because already listening on ipv4 addresses: */
++ setsockopt (s, IPPROTO_IPV6, IPV6_V6ONLY,
++ (const void *) &yes, sizeof (yes));
++ }
++#endif
++
+ yes = 1;
+ if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR,
+ (const void *) &yes, sizeof (yes)) < 0)