summaryrefslogtreecommitdiff
path: root/src/openvpn/contrib/openvpn-fwmarkroute-1.00/fwmarkroute.down
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2008-04-12 11:38:42 +0000
committerOthmar Gsenger <otti@anytun.org>2008-04-12 11:38:42 +0000
commitfffd213c8cba2135afda493d797c41c10354770e (patch)
treebb5eea1b12871d8c3fed0e687d83be3e504d11b2 /src/openvpn/contrib/openvpn-fwmarkroute-1.00/fwmarkroute.down
parentsvn cleanup (diff)
big svn cleanup
Diffstat (limited to 'src/openvpn/contrib/openvpn-fwmarkroute-1.00/fwmarkroute.down')
-rwxr-xr-xsrc/openvpn/contrib/openvpn-fwmarkroute-1.00/fwmarkroute.down22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/openvpn/contrib/openvpn-fwmarkroute-1.00/fwmarkroute.down b/src/openvpn/contrib/openvpn-fwmarkroute-1.00/fwmarkroute.down
new file mode 100755
index 0000000..87d67d4
--- /dev/null
+++ b/src/openvpn/contrib/openvpn-fwmarkroute-1.00/fwmarkroute.down
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Bring down vpn routing.
+
+# calculate the network address
+remote_network=`ipcalc -n "$remote"/"$remote_netmask_bits"`
+remote_network="${remote_network#*=}"
+
+# clear routing via VPN
+ip route del "$remote_network"/"$remote_netmask_bits" via "$5" table vpn.out
+ip route del table vpnonly.out via "$5"
+iptables -D OUTPUT -t mangle -p "$proto" \
+ -d "$remote_network"/"$remote_netmask_bits" \
+ --dport "$remote_port" -j ACCEPT
+iptables -D OUTPUT -t mangle -d "$remote" -j MARK --set-mark 2
+
+# undo the ICMP ping tunneling
+iptables -D OUTPUT -t mangle --protocol icmp --icmp-type echo-request \
+ -j MARK --set-mark 3
+
+# flush route cache
+ip route flush cache