commit fee7d1688ad035e7ea246097e7cee9f0f8bef59b Author: Pavel Šimerda Date: Sat Sep 22 14:29:29 2012 +0200 EXPERIMENTAL: ignore AI_ADDRCONFIG in getaddrinfo() This should fix problems getaddrinfo() for non-global use cases. It should now work for the following 'node' names even on hosts without global IPv4 and/or IPv6. getaddrinfo("127.0.0.1", ...) getaddrinfo("::1", ...) getaddrinfo("localhost", ...) getaddrinfo("localhost4", ...) getaddrinfo("localhost6", ...) getaddrinfo("fe80::44ab:6fff:fe75:4c04%eth0", ...) The price for this is losing AI_ADDRCONFIG funcionality. But this funcionality should be only used for DNS. diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 05883bd..503f6a8 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -2403,36 +2403,6 @@ getaddrinfo (const char *name, const char *service, bool seen_ipv6 = false; bool check_pf_called = false; - if (hints->ai_flags & AI_ADDRCONFIG) - { - /* We might need information about what interfaces are available. - Also determine whether we have IPv4 or IPv6 interfaces or both. We - cannot cache the results since new interfaces could be added at - any time. */ - __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen); - check_pf_called = true; - - /* Now make a decision on what we return, if anything. */ - if (hints->ai_family == PF_UNSPEC && (seen_ipv4 || seen_ipv6)) - { - /* If we haven't seen both IPv4 and IPv6 interfaces we can - narrow down the search. */ - if ((! seen_ipv4 || ! seen_ipv6) && (seen_ipv4 || seen_ipv6)) - { - local_hints = *hints; - local_hints.ai_family = seen_ipv4 ? PF_INET : PF_INET6; - hints = &local_hints; - } - } - else if ((hints->ai_family == PF_INET && ! seen_ipv4) - || (hints->ai_family == PF_INET6 && ! seen_ipv6)) - { - /* We cannot possibly return a valid answer. */ - __free_in6ai (in6ai); - return EAI_NONAME; - } - } - if (service && service[0]) { char *c;