Post by Joe OrtonPost by Lucian Adrian Grijincugetaddrinfo AF_UNSPEC/SOCK_STREAM/AI_ADDRCONFIG failed
so, yes: hints.ai_flags = AI_ADDRCONFIG; makes getaddrinfo fail.
Just so I can understand the precise nuances of this, can you post the
wget http://people.apache.org/~jorton/gai.c
make gai
./gai ::1
./gai ::1 null inet6
./gai -a ::1
./gai -a ::1 null inet6
Ubuntu 7.04 (no ipv6 addresses -- other then loopback -- configured):
***@karmic:~/gai$ make gai
cc gai.c -o gai
***@karmic:~/gai$ ./gai ::1
getaddrinfo("::1", NULL, {.family=AF_UNSPEC, .hints=0}) = 0:
family=10, proto= 6 inet6: addr=::1, port=0, flowinfo=0
***@karmic:~/gai$ ./gai ::1 null inet6
getaddrinfo("::1", NULL, {.family=AF_INET6, .hints=0}) = 0:
family=10, proto= 6 inet6: addr=::1, port=0, flowinfo=0
***@karmic:~/gai$ ./gai -a ::1
getaddrinfo("::1", NULL, {.family=AF_UNSPEC, .hints=0|AI_ADDRCONFIG}) = -1:
error: Address family for hostname not supported
***@karmic:~/gai$ ./gai -a ::1 null inet6
getaddrinfo("::1", NULL, {.family=AF_INET6, .hints=0|AI_ADDRCONFIG}) = -1:
error: Name or service not known
Post by Joe OrtonBut yes, testsockets.c will need some tweaking to cope with this
getaddrinfo implementation. I think it's caused by an Ubuntu patch, if
I read https://bugs.launchpad.net/ubuntu/+source/netcfg/+bug/24828
correctly. It might break some applications in fun ways too, but
there's not much APR can do about that.
Interesting bits of documentation:
win32:
"If the AI_ADDRCONFIG flag is specified, IPv4 addresses shall be
returned only if an IPv4 address is configured on the local system, and
IPv6 addresses shall be returned only if an IPv6 address is configured
on the local system. The IPv4 or IPv6 loopback address is not considered
a valid global address."
RFC 3943:
"If the AI_ADDRCONFIG flag is specified, IPv4 addresses shall be
returned only if an IPv4 address is configured on the local system,
and IPv6 addresses shall be returned only if an IPv6 address is
configured on the local system. The loopback address is not
considered for this case as valid as a configured address."
Solaris:
"If the AI_ADDRCONFIG flag is specified, IPv4 addresses are returned
only if an IPv4 address is configured on the local system, and IPv6
addresses are returned only if an IPv6 address is configured on the
local system. For this case, the loopback address is not considered to
be as valid as a configured address. "
--
Davi Aranut