Merge "Send both A and AAAA queries if all probes fail."
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 @@
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;