#455762 [libc6] gethostbyname fails on IPv6 addresses

Package:
libc6
Source:
glibc
Description:
GNU C Library: Shared libraries
Submitter:
Adam Majer
Date:
2010-03-23 08:31:05 UTC
Severity:
normal
#455762#5
Date:
2007-12-11 17:55:59 UTC
From:
To:
The following test case fails for simple ::1 ip address. According to
documentation, IPv6 and IPv4 addresses specified should be returned
without the need to resolve them. This appears to happen when
127.0.0.1 is used.

Furthermore, gethostbyname( "ip6-localhost" ) also seems to work.

No explicit IPv6 address seems to work.



#include <netdb.h>
#include <stdio.h>
int main()
{
   if( gethostbyname( "::1" ) == NULL )
      printf( "error: %d\n", (int)h_errno );
   else
      printf( "found\n" );
}

#455762#10
Date:
2008-03-23 14:22:47 UTC
From:
To:
Adam Majer wrote:

I reproduced this bug even with "options inet6" in /etc/resolv.conf

With the "options inet6", symbolic names that resolve to an AAAA entry
work, though. As do IPv6 entries in /etc/hosts (such as
"ip6-localhost").

On the other hand, the system seems to have some intelligence, because
(without "options inet6"), ip6-localhost returns 127.0.0.1, and that
ain't from DNS.