> After running "ifconfig -a6 down", this call to getaddrinfo() continues to
> return an IPv6 address (in addition to IPv4):
>
> memset(&hints, 0, sizeof(hints));
> hints.ai_family = AF_UNSPEC;
> hints.ai_socktype = SOCK_STREAM;
> hints.ai_flags = AI_ADDRCONFIG;
> hints.ai_flags |= AI_PASSIVE;
>
> error = getaddrinfo(NULL, "80", &hints, &ai_list);
>
> but an attempt to connect() to the returned IPv6 address results in
> ENETUNREACH.
>
> With AI_ADDRCONFIG, getaddrinfo() should consider only non-loopback
> interfaces in determining whether to try to return an IPv6 address.
Yes, this is a bug in the implementation: the manpage is quite clear that
loopback addresses should not be considered valid, but the code that
implements AI_ADDRCONFIG just does:
/* XXX errno */
s = socket(af, SOCK_DGRAM, 0);
if (s < 0) {
if (errno != EMFILE)
return 0;
} else
close(s);
return 1;
I suspect this bug has become more apparent now that loopback is enabled
by default. Looks like this may also be tied to 6743041.
In any case, I'll get a bug logged on this. Thanks!
--
meem
_______________________________________________
networking-discuss mailing list
[email protected]