diff --git a/src/ChangeLog b/src/ChangeLog index 3cfc1b45..d58e371e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2003-11-15 Hrvoje Niksic + + * host.c (lookup_host): Use AI_ADDRCONFIG only if the family is + unspecified. This ensures that specifying `--no-inet4' on systems + where IPv6 resolves, but doesn't work behaves the same regardless + of the availability of AI_ADDRCONFIG. + 2003-11-15 Hrvoje Niksic * host.c: Don't refer to the now-removed function diff --git a/src/host.c b/src/host.c index d5475bed..b77c1170 100644 --- a/src/host.c +++ b/src/host.c @@ -575,16 +575,19 @@ lookup_host (const char *host, int flags) xzero (hints); hints.ai_socktype = SOCK_STREAM; - hints.ai_family = AF_UNSPEC; if (opt.ipv4_only && !opt.ipv6_only) hints.ai_family = AF_INET; else if (opt.ipv6_only && !opt.ipv4_only) hints.ai_family = AF_INET6; - + else + { + hints.ai_family = AF_UNSPEC; #ifdef HAVE_GETADDRINFO_AI_ADDRCONFIG - /* Use AI_ADDRCONFIG where available. See init.c:defaults(). */ - hints.ai_flags |= AI_ADDRCONFIG; + /* Use AI_ADDRCONFIG if available and if specific family isn't + explicitly requested. See init.c:defaults(). */ + hints.ai_flags |= AI_ADDRCONFIG; #endif + } if (flags & LH_BIND) hints.ai_flags |= AI_PASSIVE;