]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Handle DNS6 option on Android
authorArne Schwabe <arne@rfc2549.org>
Tue, 22 Nov 2016 11:38:36 +0000 (12:38 +0100)
committerGert Doering <gert@greenie.muc.de>
Tue, 22 Nov 2016 16:31:30 +0000 (17:31 +0100)
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>
doc/android.txt
src/openvpn/tun.c

index 5f4ee95290ed61627276145730387f518d45116f..e287be0a8b23e369472d9e4e2d30b5a9afd97abf 100644 (file)
@@ -47,7 +47,8 @@ ROUTE network netmask
 
 To tell the UI which routes should be set on the tun interface.
 
-DNSSERVER serverip
+DNSSERVER IP server address
+DNS6SERVER IPv6 server address
 DNSDOMAIN searchdomain
 
 To set the DNS server and search domain.
index a079f4718d217621d1a92bbd89ed60a446c8da7c..3ebf2b2b531c8dd273083e8978c96e50050daf8a 100644 (file)
@@ -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));
   }