OpenBSD 4.4 gnutls-serv IPv6 Only Bug

Simon Josefsson simon at josefsson.org
Fri Apr 17 17:08:21 CEST 2009


Peter Hendrickson <pdh at wiredyne.com> writes:

> Using GnuTLS 2.6.5 under OpenBSD 4.4, there is a bug in gnutls-serv.
> It only listens for connection on an IPv6 port and ignores all IPv4
> requests.  This can be seen by running something as simple as
> "gnutls-serv --http".  The patch below illustrates the problem and
> supplies a quick fix.

Hi.  Thanks for the report.  I'm not sure the patch is the right thing,
supporting only IPv4 seems like a step backwards.  Isn't there a way to
listen on all address families?

> (BTW, I have just started looking at GnuTLS and I really like it!)

Great!

/Simon

>
> Peter
>
> --- serv.c.orig	Sat Apr 11 18:35:29 2009
> +++ serv.c	Fri Apr 17 06:00:11 2009
> @@ -652,6 +652,12 @@
>  
>    snprintf (portname, sizeof (portname), "%d", listen_port);
>    memset (&hints, 0, sizeof (hints));
> +  /* Under OpenBSD 4.4, getaddrinfo() returns an IPv6 addrinfo
> +     structure followed by an IPv4 addrinfo structure.  The code below
> +     uses the first successful structure it gets which means it
> +     listens for IPv6 connections.  Setting the family hint to AF_INET
> +     forces getaddrinfo() to return IPv4 addrinfo structures. */
> +  hints.ai_family = AF_INET;
>    hints.ai_socktype = SOCK_STREAM;
>    hints.ai_flags = AI_PASSIVE;





More information about the Gnutls-devel mailing list