Resolve DNS64 hostname with Private DNS bypass
Test: as follows
- builds
- flashes
- boots
- runtest -x external/android-clat/clatd_test.cpp passes
Bug: 64133961
Bug: 72345192
Change-Id: If5238d0cdf27cb4cd689e1ff1ff776bc638d5a7b
diff --git a/dns64.c b/dns64.c
index 4e9252d..a9ca61d 100644
--- a/dns64.c
+++ b/dns64.c
@@ -27,6 +27,7 @@
#include "dns64.h"
#include "logging.h"
+#include "NetdClient.h"
#include "resolv_netid.h"
/* function: plat_prefix
@@ -46,6 +47,11 @@
logmsg(ANDROID_LOG_INFO, "Detecting NAT64 prefix from DNS...");
+ // Be sure to query local DNS64 servers, bypassing Private DNS (if enabled).
+ if (net_id != NETID_UNSET) {
+ net_id += NETID_USE_LOCAL_NAMESERVERS;
+ }
+
status = android_getaddrinfofornet(ipv4_name, NULL, &hints, net_id, MARK_UNSET, &result);
if (status != 0 || result == NULL) {
logmsg(ANDROID_LOG_ERROR, "plat_prefix/dns(%s) status = %d/%s",