AI_ADDRCONFIG is specified in RFC2553 to only return IPv6 data if an IPv6 interface works; otherwise only return IPv4 data.
This fixes wget and possibly others which error out when no IPv6 lookup is available, even with valid IPv4 DNS data coming back. See bug 5042 for more detail. Signed-off-by: Kevin Baker <[email protected]> --- libbb/xconnect.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/libbb/xconnect.c b/libbb/xconnect.c index 1c8bb2b..a182d69 100644 --- a/libbb/xconnect.c +++ b/libbb/xconnect.c @@ -261,6 +261,11 @@ IF_NOT_FEATURE_IPV6(sa_family_t af = AF_INET;) * for each possible socket type (tcp,udp,raw...): */ hint.ai_socktype = SOCK_STREAM; hint.ai_flags = ai_flags & ~DIE_ON_ERROR; +#ifdef AI_ADDRCONFIG + /* Pass AI_ADDRCONFIG to only return IPv6 data if a IPv6 interface + * works; otherwise only return IPv4 data. See bug 5042. */ + hint.ai_flags |= AI_ADDRCONFIG; +#endif rc = getaddrinfo(host, NULL, &hint, &result); if (rc || !result) { bb_error_msg("bad address '%s'", org_host); -- 1.7.0.4 _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
