Author: Bernhard R. Link Description: fix failure to listen on ipv6 addresses on Linux With /proc/sys/net/ipv6/bindv6only being 0 by default on Linux, gnutls-serv fails to listen on ipv6 as is first listens on ipv4. This patch sets the socket option to limit the ipv6 listening to ipv6 so it is no longer failing. --- gnutls28-3.0.20.orig/src/serv.c +++ gnutls28-3.0.20/src/serv.c @@ -730,6 +730,17 @@ listen_socket (const char *name, int lis continue; } +#ifdef HAVE_IPV6 + 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 + if (socktype == SOCK_STREAM) { yes = 1;