[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
OpenBSD 4.4 gnutls-serv IPv6 Only Bug
From: |
Peter Hendrickson |
Subject: |
OpenBSD 4.4 gnutls-serv IPv6 Only Bug |
Date: |
17 Apr 2009 06:14:02 -0000 |
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.
(BTW, I have just started looking at GnuTLS and I really like it!)
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;
- OpenBSD 4.4 gnutls-serv IPv6 Only Bug,
Peter Hendrickson <=
Re: OpenBSD 4.4 gnutls-serv IPv6 Only Bug, Peter Hendrickson, 2009/04/18