patch file cleanup... ick.. kaloz you owe me some love
[packages.git] / net / vpnc / patches / 002-vpn_script.patch
1 --- vpnc-0.4.0/vpnc-script      2007-02-18 12:52:03.000000000 +0100
2 +++ vpnc-0.4.0.patched/vpnc-script      2007-02-25 11:34:06.000000000 +0100
3 @@ -107,7 +107,7 @@
4  }
5  
6  do_ifconfig() {
7 -       ifconfig "$TUNDEV" inet "$INTERNAL_IP4_ADDRESS" $ifconfig_syntax_ptp "$INTERNAL_IP4_ADDRESS" netmask 255.255.255.255 mtu 1412 up
8 +       ifconfig "$TUNDEV" "$INTERNAL_IP4_ADDRESS" $ifconfig_syntax_ptp "$INTERNAL_IP4_ADDRESS" netmask 255.255.255.255 mtu 1412 up
9  }
10  
11  destroy_tun_device() {
12 @@ -388,6 +388,18 @@
13         fi
14  }
15  
16 +start_vpn_nat() {
17 +       iptables -A forwarding_rule -o $TUNDEV -j ACCEPT
18 +       iptables -A forwarding_rule -i $TUNDEV -j ACCEPT
19 +       iptables -t nat -A postrouting_rule -o $TUNDEV -j MASQUERADE
20 +}
21 +
22 +stop_vpn_nat() {
23 +       iptables -t nat -D postrouting_rule -o $TUNDEV -j MASQUERADE
24 +       iptables -D forwarding_rule -i $TUNDEV -j ACCEPT
25 +       iptables -D forwarding_rule -o $TUNDEV -j ACCEPT
26 +}
27 +
28  ####
29  
30  if [ -z "$reason" ]; then
31 @@ -401,8 +413,10 @@
32                 ;;
33         connect)
34                 do_connect
35 +               start_vpn_nat
36                 ;;
37         disconnect)
38 +               stop_vpn_nat
39                 do_disconnect
40                 ;;
41         *)