The script tries to set IPROUTE to the 'ip' command. The script works fine when IPROUTE is empty, but without an additional 2>/dev/null, the script always displays errors from which(1). Attached is an updated patch-vpnc-script_in for the port.

--
David Cantrell | KB1PCX
http://www.burdell.org/
$OpenBSD: patch-vpnc-script_in,v 1.1 2009/01/29 19:07:06 pea Exp $
--- vpnc-script.in.orig Wed Nov 19 10:55:51 2008
+++ vpnc-script.in      Thu Dec 16 11:25:54 2010
@@ -59,7 +59,7 @@ if [ ! -d "/var/run/vpnc" ]; then
 fi
 
 # stupid SunOS: no blubber in /usr/local/bin ... (on stdout)
-IPROUTE="`which ip | grep '^/' 2> /dev/null`"
+IPROUTE="`which ip 2> /dev/null | grep '^/' 2> /dev/null`"
 
 if [ "$OS" = "Linux" ]; then
        ifconfig_syntax_ptp="pointopoint"
@@ -114,7 +114,7 @@ destroy_tun_device() {
 
 # =========== route handling ====================================
 
-if [ -n "$IPROUTE" ]; then
+if [ -x "$IPROUTE" ]; then
        fix_ip_get_output () {
                sed 's/cache//;s/metric \?[0-9]\+ [0-9]\+//g;s/hoplimit 
[0-9]\+//g'
        }
@@ -201,6 +201,13 @@ else # use route command
                case "$OS" in
                Linux|NetBSD|Darwin) # and probably others...
                        # routes are deleted automatically on device shutdown
+                       return
+                       ;;
+               OpenBSD)
+                       # delete only routes that are present
+                       if [ `route -n get $1|grep $2|wc -l` -ne 0 ]; then
+                               route $route_syntax_del -net "$NETWORK" 
$route_syntax_netmask "$NETMASK" $route_syntax_gw "$INTERNAL_IP4_ADDRESS"
+                       fi
                        return
                        ;;
                esac

Reply via email to