packages/net/vpnc/patches/002-vpn_script.patch
pavlov 14c1a8db5f patch file cleanup... ick.. kaloz you owe me some love
git-svn-id: svn://svn.openwrt.org/openwrt/packages@6526 3c298f89-4303-0410-b956-a3cf2f4a3e73
2007-03-05 01:34:12 +00:00

42 lines
1.0 KiB
Diff

--- vpnc-0.4.0/vpnc-script 2007-02-18 12:52:03.000000000 +0100
+++ vpnc-0.4.0.patched/vpnc-script 2007-02-25 11:34:06.000000000 +0100
@@ -107,7 +107,7 @@
}
do_ifconfig() {
- ifconfig "$TUNDEV" inet "$INTERNAL_IP4_ADDRESS" $ifconfig_syntax_ptp "$INTERNAL_IP4_ADDRESS" netmask 255.255.255.255 mtu 1412 up
+ ifconfig "$TUNDEV" "$INTERNAL_IP4_ADDRESS" $ifconfig_syntax_ptp "$INTERNAL_IP4_ADDRESS" netmask 255.255.255.255 mtu 1412 up
}
destroy_tun_device() {
@@ -388,6 +388,18 @@
fi
}
+start_vpn_nat() {
+ iptables -A forwarding_rule -o $TUNDEV -j ACCEPT
+ iptables -A forwarding_rule -i $TUNDEV -j ACCEPT
+ iptables -t nat -A postrouting_rule -o $TUNDEV -j MASQUERADE
+}
+
+stop_vpn_nat() {
+ iptables -t nat -D postrouting_rule -o $TUNDEV -j MASQUERADE
+ iptables -D forwarding_rule -i $TUNDEV -j ACCEPT
+ iptables -D forwarding_rule -o $TUNDEV -j ACCEPT
+}
+
####
if [ -z "$reason" ]; then
@@ -401,8 +413,10 @@
;;
connect)
do_connect
+ start_vpn_nat
;;
disconnect)
+ stop_vpn_nat
do_disconnect
;;
*)