Handle DNS6 option on Android
PATCH 1/1 Handle DNS6 option on Android
--- doc/android.txt | 3 ++- src/openvpn/tun.c | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
doc/android.txt +2 -1
@@ -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.
src/openvpn/tun.c +6 -2
@@ -1629,18 +1629,22 @@ 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) { +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)); } +for (int i =0 ; i < tt->options.dns6_len; i++) { +management_android_control (management,"DNS6SERVER" , +print_in6_addr (tt->options.dns6[i],0 , &gc)); + } +if (tt->options.domain)management_android_control (management,"DNSDOMAIN" , tt->options.domain);
Signature · 1 line
2.9.3 (Apple Git-75)
PATCH v2 1/1 Handle DNS6 option on Android
Patch V2: Prefer IPv6 DNS servers
--- doc/android.txt | 3 ++- src/openvpn/tun.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-)
doc/android.txt +2 -1
@@ -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.
src/openvpn/tun.c +8 -2
@@ -1629,14 +1629,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)); }
Signature · 1 line
2.9.3 (Apple Git-75)
ACK. Code looks reasonable and straightforward (and even C99 :) ), but not having an Android build environment I can't say whether it compiles or even works :-) - it won't break anything else, though.
Your patch has been applied to the master branch.
commit 39b7d4da02c40e76640c4da96ef7da7a6354cc00
Author: Arne Schwabe Date: Tue Nov 22 12:38:36 2016 +0100
Handle DNS6 option on Android
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg13195.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Hi,
On Tue, Nov 22, 2016 at 6:38 AM, Arne Schwabe <[email protected]...> wrote:
...
Quoted 12 lines
src/openvpn/tun.c +5
-1-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));
src/openvpn/tun.c +3
-0+ } + +for (int i =0 ; i < tt->options.dns_len; i++) { management_android_control (management, "DNSSERVER", print_in_addr_t(tt->options.dns[i], 0,
Quoted 2 lines
&gc)); }
The code looks good to me, so ACK
(Note: the preferred comment closing style may be '*/' on a line by itself?).
Selva
Hi,
Quoted 1 line · Selva Nair
The code looks good to me, so ACK
Beat you to it :)
Quoted 2 lines
(Note: the preferred comment closing style may be '*/' on a line by itself?).
Indeed it is. I overlooked that, otherwise I would have fixed it on the fly. Meh.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...