summaryrefslogtreecommitdiffstats
path: root/rootdir/etc
diff options
context:
space:
mode:
Diffstat (limited to 'rootdir/etc')
-rwxr-xr-xrootdir/etc/ppp/ip-up-vpn18
1 files changed, 18 insertions, 0 deletions
diff --git a/rootdir/etc/ppp/ip-up-vpn b/rootdir/etc/ppp/ip-up-vpn
new file mode 100755
index 0000000..5d6b611
--- /dev/null
+++ b/rootdir/etc/ppp/ip-up-vpn
@@ -0,0 +1,18 @@
+#!/system/bin/sh
+
+/system/bin/setprop "vpn.dns1" "$DNS1"
+/system/bin/setprop "vpn.dns2" "$DNS2"
+
+GATEWAY=${6#*@}
+VPNSERVER=${6%@*}
+
+# Protect the route to vpn server
+/system/bin/route add -net "$VPNSERVER" netmask 255.255.255.255 gw "$GATEWAY"
+
+if (exp $?) ; then exit $?; fi
+
+# Route all traffic to vpn connection
+/system/bin/route add -net 0.0.0.0 netmask 128.0.0.0 gw $IPREMOTE
+/system/bin/route add -net 128.0.0.0 netmask 128.0.0.0 gw $IPREMOTE
+
+/system/bin/setprop "vpn.up" "1"