summaryrefslogtreecommitdiff
path: root/net/vpnc/patches/patch-ac
diff options
context:
space:
mode:
Diffstat (limited to 'net/vpnc/patches/patch-ac')
-rw-r--r--net/vpnc/patches/patch-ac109
1 files changed, 109 insertions, 0 deletions
diff --git a/net/vpnc/patches/patch-ac b/net/vpnc/patches/patch-ac
new file mode 100644
index 00000000000..3f04ffdff11
--- /dev/null
+++ b/net/vpnc/patches/patch-ac
@@ -0,0 +1,109 @@
+$NetBSD: patch-ac,v 1.1 2006/01/03 21:48:17 hubertf Exp $
+
+--- vpnc-script.orig 2006-01-03 22:36:27.000000000 +0100
++++ vpnc-script
+@@ -19,10 +19,12 @@
+ #set -x
+
+ OS="`uname -s`"
+-DEFAULT_ROUTE_FILE=/var/run/vpnc/defaultroute
+-RESOLV_CONF_BACKUP=/var/run/vpnc/resolv.conf-backup
++STATEDIR=/var/run/vpnc
++DEFAULT_ROUTE_FILE=$STATEDIR/defaultroute
++RESOLV_CONF_BACKUP=$STATEDIR/resolv.conf-backup
+
+-IPROUTE="`which ip 2> /dev/null`"
++# stupid SunOS: no blubber in /usr/local/bin ... (on stdout)
++IPROUTE="`which ip | grep '^/' 2> /dev/null`"
+
+ if [ "$OS" = "Linux" ]; then
+ ifconfig_syntax_ptp="pointopoint"
+@@ -56,7 +58,9 @@ do_pre_init() {
+ fi
+ fi
+ elif [ "$OS" = "FreeBSD" ]; then
+- :
++ if [ ! -e /dev/tun ]; then
++ kldload if_tun
++ fi
+ elif [ "$OS" = "NetBSD" ]; then
+ :
+ elif [ "$OS" = "OpenBSD" ]; then
+@@ -64,6 +68,8 @@ do_pre_init() {
+ elif [ "$OS" = "SunOS" ]; then
+ :
+ fi
++
++ mkdir -p $STATEDIR
+ }
+
+ do_ifconfig() {
+@@ -72,7 +78,7 @@ do_ifconfig() {
+
+ if [ -n "$IPROUTE" ]; then
+ fix_ip_get_output () {
+- sed 's/cache//;s/metric[0-9]\+ [0-9]\+//g'
++ sed 's/cache//;s/metric \?[0-9]\+ [0-9]\+//g'
+ }
+
+ set_vpngateway_route() {
+@@ -117,7 +123,10 @@ if [ -n "$IPROUTE" ]; then
+ }
+ else
+ get_default_gw() {
+- netstat -r -n | grep '^0.0.0.0' | awk '{print $2}'
++ # Let's assume the first default gateway is IPv4...
++ # (On NetBSD '-f inet' and on Linux and probably Solaris,
++ # '-A inet' could be used to make sure... - HF)
++ netstat -rn | awk '/^(default|0.0.0.0)/{ print $2 ; exit } '
+ }
+
+ set_vpngateway_route() {
+@@ -131,7 +140,7 @@ else
+ set_default_route() {
+ DEFAULTGW="`get_default_gw`"
+ echo "$DEFAULTGW" > "$DEFAULT_ROUTE_FILE"
+- route $route_syntax_del default
++ route $route_syntax_del default "$DEFAULTGW"
+ route add default $route_syntax_gw "$INTERNAL_IP4_ADDRESS"
+ }
+
+@@ -219,11 +228,13 @@ do_connect() {
+ do_ifconfig
+ set_vpngateway_route
+ if [ -n "$CISCO_SPLIT_INC" ]; then
+- for ((i = 0 ; i < CISCO_SPLIT_INC ; i++ )) ; do
++ i=0
++ while [ $i -lt $CISCO_SPLIT_INC ] ; do
+ eval NETWORK="\${CISCO_SPLIT_INC_${i}_ADDR}"
+ eval NETMASK="\${CISCO_SPLIT_INC_${i}_MASK}"
+ eval NETMASKLEN="\${CISCO_SPLIT_INC_${i}_MASKLEN}"
+ set_network_route "$NETWORK" "$NETMASK" "$NETMASKLEN"
++ i=`expr $i + 1`
+ done
+ for i in $INTERNAL_IP4_DNS ; do
+ set_network_route "$i" "255.255.255.255" "32"
+@@ -239,11 +250,13 @@ do_connect() {
+
+ do_disconnect() {
+ if [ -n "$CISCO_SPLIT_INC" ]; then
+- for ((i = 0 ; i < CISCO_SPLIT_INC ; i++ )) ; do
++ i=0
++ while [ $i -lt $CISCO_SPLIT_INC ] ; do
+ eval NETWORK="\${CISCO_SPLIT_INC_${i}_ADDR}"
+ eval NETMASK="\${CISCO_SPLIT_INC_${i}_MASK}"
+ eval NETMASKLEN="\${CISCO_SPLIT_INC_${i}_MASKLEN}"
+ del_network_route "$NETWORK" "$NETMASK" "$NETMASKLEN"
++ i=`expr $i + 1`
+ done
+ for i in $INTERNAL_IP4_DNS ; do
+ del_network_route "$i" "255.255.255.255" "32"
+@@ -260,6 +273,8 @@ do_disconnect() {
+ if [ -n "$INTERNAL_IP4_DNS" ]; then
+ reset_resolvconf
+ fi
++
++ rm -fr -- $STATEDIR
+ }
+
+ ####