aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArne Schwabe2016-11-22 12:38:36 +0100
committerGert Doering2016-11-22 17:31:30 +0100
commit39b7d4da02c40e76640c4da96ef7da7a6354cc00 (patch)
tree6f3ab9b7ba1a64129682e3bc9769317261feab20 /src
parent786e06ade9f5dfad8ac360499187fa8e536d15cb (diff)
downloadopenvpn-39b7d4da02c40e76640c4da96ef7da7a6354cc00.zip
openvpn-39b7d4da02c40e76640c4da96ef7da7a6354cc00.tar.gz
Handle DNS6 option on Android
Patch V2: Prefer IPv6 DNS servers Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1479814716-20116-1-git-send-email-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13195.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src')
-rw-r--r--src/openvpn/tun.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index a079f47..3ebf2b2 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -1638,14 +1638,20 @@ void
open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt)
{
#define ANDROID_TUNNAME "vpnservice-tun"
- int i;
struct user_pass up;
struct gc_arena gc = gc_new ();
bool opentun;
int oldtunfd = tt->fd;
- for (i = 0; i < tt->options.dns_len; ++i) {
+ /* Prefer IPv6 DNS servers,
+ * Android will use the DNS server in the order we specify*/
+ for (int i = 0; i < tt->options.dns6_len; i++) {
+ management_android_control (management, "DNS6SERVER",
+ print_in6_addr (tt->options.dns6[i], 0, &gc));
+ }
+
+ for (int i = 0; i < tt->options.dns_len; i++) {
management_android_control (management, "DNSSERVER",
print_in_addr_t(tt->options.dns[i], 0, &gc));
}