2017-01-28 10:42:52 +01:00
|
|
|
diff -u -r ../libevent-release-2.1.8-stable/evdns.c ./evdns.c
|
|
|
|
--- ../libevent-release-2.1.8-stable/evdns.c 2017-01-26 00:37:15.000000000 +0100
|
|
|
|
+++ ./evdns.c 2017-01-28 00:02:43.332229763 +0100
|
|
|
|
@@ -52,6 +52,9 @@
|
|
|
|
#include "evconfig-private.h"
|
2016-08-26 23:20:32 +02:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
+#ifdef __ANDROID__
|
|
|
|
+# include <sys/system_properties.h>
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
#ifndef _FORTIFY_SOURCE
|
2017-01-28 10:42:52 +01:00
|
|
|
#define _FORTIFY_SOURCE 3
|
|
|
|
@@ -3959,6 +3962,21 @@
|
2016-08-26 23:20:32 +02:00
|
|
|
int r;
|
2017-01-28 10:42:52 +01:00
|
|
|
#ifdef _WIN32
|
2016-08-26 23:20:32 +02:00
|
|
|
r = evdns_base_config_windows_nameservers(base);
|
|
|
|
+#elif defined(__ANDROID__)
|
|
|
|
+ /** From: http://www.programering.com/a/MjMwcjMwATA.html */
|
|
|
|
+ int add_servers = 0;
|
|
|
|
+ char buf[PROP_VALUE_MAX];
|
|
|
|
+ r = __system_property_get("net.dns1", buf);
|
|
|
|
+ if (r >= 7) {
|
|
|
|
+ add_servers++;
|
|
|
|
+ evdns_base_nameserver_ip_add(base, buf);
|
|
|
|
+ }
|
|
|
|
+ r = __system_property_get("net.dns2", buf);
|
|
|
|
+ if (r >= 7) {
|
|
|
|
+ add_servers++;
|
|
|
|
+ evdns_base_nameserver_ip_add(base, buf);
|
|
|
|
+ }
|
|
|
|
+ if (add_servers == 0) evdns_base_nameserver_ip_add(base, "8.8.8.8");
|
|
|
|
#else
|
|
|
|
r = evdns_base_resolv_conf_parse(base, DNS_OPTIONS_ALL, "/etc/resolv.conf");
|
|
|
|
#endif
|