You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.0 KiB
35 lines
1.0 KiB
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"
|
|
|
|
#include <sys/types.h>
|
|
+#ifdef __ANDROID__
|
|
+# include <sys/system_properties.h>
|
|
+#endif
|
|
|
|
#ifndef _FORTIFY_SOURCE
|
|
#define _FORTIFY_SOURCE 3
|
|
@@ -3959,6 +3962,21 @@
|
|
int r;
|
|
#ifdef _WIN32
|
|
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
|
|
|