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/Android.mk b/Android.mk
index 8c0a43e..cae37fc 100644
--- a/Android.mk
+++ b/Android.mk
@@ -6,7 +6,7 @@
 LOCAL_CFLAGS := -Wall -Werror -Wunused-parameter
 # Bug: http://b/33566695
 LOCAL_CFLAGS += -Wno-address-of-packed-member
-LOCAL_C_INCLUDES := external/libnl/include bionic/libc/dns/include
+LOCAL_C_INCLUDES := external/libnl/include bionic/libc/dns/include system/netd/include
 LOCAL_STATIC_LIBRARIES := libnl
 LOCAL_SHARED_LIBRARIES := libcutils liblog libnetutils
 
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",