From 1f3ea57ee9f0cabdcfd2b585f16bf754984a669d Mon Sep 17 00:00:00 2001 From: schwabe Date: Sun, 29 Apr 2012 15:22:01 +0200 Subject: Version 0.4 fixes iusse #1 fixes iusse #2 fixes iusse #3 --- openvpn/src/openvpn/init.c | 10 +++++++++- openvpn/src/openvpn/tun.c | 1 + openvpn/src/openvpn/tun.h | 17 +++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) (limited to 'openvpn/src') diff --git a/openvpn/src/openvpn/init.c b/openvpn/src/openvpn/init.c index bc7718e4..88d621a4 100644 --- a/openvpn/src/openvpn/init.c +++ b/openvpn/src/openvpn/init.c @@ -1477,6 +1477,13 @@ do_open_tun (struct context *c) &gc); do_ifconfig (c->c1.tuntap, guess, TUN_MTU_SIZE (&c->c2.frame), c->c2.es); } + + /* possibly add routes */ + if(ifconfig_order() == ROUTE_BEFORE_TUN) { + if (!c->options.route_delay_defined) + do_route (&c->options, c->c1.route_list, c->c1.route_ipv6_list, + c->c1.tuntap, c->plugins, c->c2.es); + } /* open the tun device */ open_tun (c->options.dev, c->options.dev_type, c->options.dev_node, @@ -1509,10 +1516,11 @@ do_open_tun (struct context *c) c->c2.es); /* possibly add routes */ + if(ifconfig_order() == ROUTE_AFTER_TUN) { if (!c->options.route_delay_defined) do_route (&c->options, c->c1.route_list, c->c1.route_ipv6_list, c->c1.tuntap, c->plugins, c->c2.es); - + } /* * Did tun/tap driver give us an MTU? */ diff --git a/openvpn/src/openvpn/tun.c b/openvpn/src/openvpn/tun.c index 58e9bc53..ae372e48 100644 --- a/openvpn/src/openvpn/tun.c +++ b/openvpn/src/openvpn/tun.c @@ -1383,6 +1383,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu for (i = 0; i < tt->options.dns_len; ++i) { android_set_dns(print_in_addr_t(tt->options.dns[i], 0, &gc)); } + if(tt->options.domain) android_set_domain(tt->options.domain); tt->fd = android_open_tun(); diff --git a/openvpn/src/openvpn/tun.h b/openvpn/src/openvpn/tun.h index 6754c726..095e77eb 100644 --- a/openvpn/src/openvpn/tun.h +++ b/openvpn/src/openvpn/tun.h @@ -300,6 +300,23 @@ ifconfig_order(void) #endif } +#define ROUTE_BEFORE_TUN 0 +#define ROUTE_AFTER_TUN 1 +#define ROUTE_ORDER_DEFAULT ROUTE_AFTER_TUN + +static inline int +route_order(void) +{ +#if defined(TARGET_ANDROID) + return ROUTE_BEFORE_TUN; +#else + return ROUTE_ORDER_DEFAULT; +#endif +} + + + + #ifdef WIN32 #define TUN_PASS_BUFFER -- cgit v1.2.3