[gnutls-devel] gnutls-cli-debug failing with IPv6-only hosts?

Nikos Mavrogiannopoulos nmav at gnutls.org
Tue Jan 29 10:02:44 CET 2013


On 01/29/2013 09:17 AM, Daniel Kahn Gillmor wrote:

> i have a server listening only on the IPv6 loopback (not on IPv4). (This
> is with GnuTLS 3.1.6)
> 
> /etc/hosts has these two lines in it:
> 
> 127.0.0.1 localhost
> ::1       localhost
> if i run "strace gnutls-cli-debug -p 9932 localhost", then i can see
> that it's actually trying to connect on IPv4 as well as IPv6, even
> though it doesn't report that on stdout:
> 0 dkg at alice:~$ strace gnutls-cli-debug -p 9932 localhost
> execve("/usr/bin/gnutls-cli-debug", ["gnutls-cli-debug", "-p", "9932", "localhost"], [/* 40 vars */]) = 0
> brk(0)                                  = 0x2424000
> [...]
> write(1, "Connecting to '::1:9932'...\n", 28Connecting to '::1:9932'...
> ) = 28
> connect(4, {sa_family=AF_INET6, sin6_port=htons(9932), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0
> socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP) = 5
> connect(5, {sa_family=AF_INET6, sin6_port=htons(9932), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0
> socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 6
> connect(6, {sa_family=AF_INET, sin_port=htons(9932), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 ECONNREFUSED (Connection refused)


It seems a break is needed if connect succeeds and possibly always print
the correct host to connect to.

Would something like the attached patch work better?

regards,
Nikos
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
URL: </pipermail/attachments/20130129/0174d068/attachment.txt>


More information about the Gnutls-devel mailing list