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" );
}
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.