2009-08-09 10:33:55 +00:00
|
|
|
--- a/vpnc-script.in
|
|
|
|
+++ b/vpnc-script.in
|
|
|
|
@@ -97,7 +97,7 @@ do_ifconfig() {
|
|
|
|
fi
|
2007-02-26 22:01:03 +00:00
|
|
|
|
2009-08-09 10:33:55 +00:00
|
|
|
# Point to point interface require a netmask of 255.255.255.255 on some systems
|
|
|
|
- ifconfig "$TUNDEV" inet "$INTERNAL_IP4_ADDRESS" $ifconfig_syntax_ptp "$INTERNAL_IP4_ADDRESS" netmask 255.255.255.255 mtu ${MTU} up
|
|
|
|
+ ifconfig "$TUNDEV" "$INTERNAL_IP4_ADDRESS" $ifconfig_syntax_ptp "$INTERNAL_IP4_ADDRESS" netmask 255.255.255.255 mtu ${MTU} up
|
2007-02-26 22:01:03 +00:00
|
|
|
|
2009-08-09 10:33:55 +00:00
|
|
|
if [ -n "$INTERNAL_IP4_NETMASK" ]; then
|
|
|
|
set_network_route $INTERNAL_IP4_NETADDR $INTERNAL_IP4_NETMASK $INTERNAL_IP4_NETMASKLEN
|
|
|
|
@@ -503,6 +503,18 @@ do_disconnect() {
|
|
|
|
destroy_tun_device
|
2007-02-26 22:01:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+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
|
|
|
|
+}
|
|
|
|
+
|
2008-07-05 13:20:48 +00:00
|
|
|
#### Main
|
2007-02-26 22:01:03 +00:00
|
|
|
|
|
|
|
if [ -z "$reason" ]; then
|
2009-08-09 10:33:55 +00:00
|
|
|
@@ -516,8 +528,10 @@ case "$reason" in
|
2007-02-26 22:01:03 +00:00
|
|
|
;;
|
|
|
|
connect)
|
|
|
|
do_connect
|
|
|
|
+ start_vpn_nat
|
|
|
|
;;
|
|
|
|
disconnect)
|
|
|
|
+ stop_vpn_nat
|
|
|
|
do_disconnect
|
|
|
|
;;
|
|
|
|
*)
|