Clean up DNS proxying.
Remove code duplication and fall back to trying directly if the proxy
isn't available. With this, tests still work if netd is dead (perhaps
because you've run "adb shell stop", or because you're running on the host).
Bug: 18547878
Change-Id: Ia4a9aa18b1fc79e09735107246989fa7fc6c8455
diff --git a/libc/dns/include/resolv_netid.h b/libc/dns/include/resolv_netid.h
index e5521b8..1d0f869 100644
--- a/libc/dns/include/resolv_netid.h
+++ b/libc/dns/include/resolv_netid.h
@@ -34,6 +34,7 @@
*/
#include <sys/cdefs.h>
#include <netinet/in.h>
+#include <stdio.h>
/*
* Passing NETID_UNSET as the netId causes system/netd/server/DnsProxyListener.cpp to
@@ -68,9 +69,9 @@
extern void _resolv_delete_cache_for_net(unsigned netid) __used_in_netd;
/* Internal use only. */
-struct hostent *android_gethostbyaddrfornet_proxy(const void *, socklen_t, int , unsigned);
-int android_getnameinfofornet(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t,
- int, unsigned, unsigned);
+struct hostent *android_gethostbyaddrfornet_proxy(const void *, socklen_t, int , unsigned, unsigned) __LIBC_HIDDEN__;
+int android_getnameinfofornet(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int, unsigned, unsigned) __LIBC_HIDDEN__;
+FILE* android_open_proxy(void) __LIBC_HIDDEN__;
/* delete the cache associated with a certain network */
extern void _resolv_delete_cache_for_net(unsigned netid);