summaryrefslogtreecommitdiffstats
path: root/libc/netbsd
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2011-09-28 19:47:38 -0700
committerLorenzo Colitti <lorenzo@google.com>2011-09-28 22:38:08 -0700
commitf432de2de7288c0589d1e50c2aa949a76c571794 (patch)
tree85acbd556d21ef44361b56b4b117b734412c8e21 /libc/netbsd
parentb82532d11a301370c14f77f2e56dee11f8bfa971 (diff)
downloadbionic-f432de2de7288c0589d1e50c2aa949a76c571794.zip
bionic-f432de2de7288c0589d1e50c2aa949a76c571794.tar.gz
bionic-f432de2de7288c0589d1e50c2aa949a76c571794.tar.bz2
Send both A and AAAA queries if all probes fail.
AI_ADDRCONFIG is currently implemented by trying to connect to well-known addresses in order to see if IPv4 and/or IPv6 connectivity is available. In some cases (e.g., walled gardens with no global connectivity) both probes can fail. If this happens, query for both IPv4 and IPv6 addresses instead of doing nothing and failing the query. Bug: 5284168 Change-Id: I4e3a69ea86fb6d839a6bd31236b98da81e5cbf45
Diffstat (limited to 'libc/netbsd')
-rw-r--r--libc/netbsd/net/getaddrinfo.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libc/netbsd/net/getaddrinfo.c b/libc/netbsd/net/getaddrinfo.c
index cf05036..ace8c1a 100644
--- a/libc/netbsd/net/getaddrinfo.c
+++ b/libc/netbsd/net/getaddrinfo.c
@@ -1911,6 +1911,13 @@ _dns_getaddrinfo(void *rv, void *cb_data, va_list ap)
if (pai->ai_flags & AI_ADDRCONFIG) {
query_ipv6 = _have_ipv6();
query_ipv4 = _have_ipv4();
+ if (query_ipv6 == 0 && query_ipv4 == 0) {
+ // Both our IPv4 and IPv6 connectivity probes failed, which indicates
+ // that we have neither an IPv4 or an IPv6 default route (and thus no
+ // global IPv4 or IPv6 connectivity). We might be in a walled garden.
+ // Throw up our arms and ask for both A and AAAA.
+ query_ipv6 = query_ipv4 = 1;
+ }
}
if (query_ipv6) {
q.qtype = T_AAAA;