summaryrefslogtreecommitdiff
path: root/openvpn/src
diff options
context:
space:
mode:
authorschwabe <devnull@localhost>2012-04-29 15:22:01 +0200
committerschwabe <devnull@localhost>2012-04-29 15:22:01 +0200
commit1f3ea57ee9f0cabdcfd2b585f16bf754984a669d (patch)
treea40f9151d8bd58ec0c39835168f268101d5a4104 /openvpn/src
parent63e466054c2f1d66e4618ac4d73208751f1e5bd1 (diff)
Version 0.4
fixes iusse #1 fixes iusse #2 fixes iusse #3
Diffstat (limited to 'openvpn/src')
-rw-r--r--openvpn/src/openvpn/init.c10
-rw-r--r--openvpn/src/openvpn/tun.c1
-rw-r--r--openvpn/src/openvpn/tun.h17
3 files changed, 27 insertions, 1 deletions
diff --git a/openvpn/src/openvpn/init.c b/openvpn/src/openvpn/init.c
index bc7718e..88d621a 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 58e9bc5..ae372e4 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 6754c72..095e77e 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