$OpenBSD: patch-vpnc-script,v 1.2 2008/04/04 21:41:27 okan Exp $
--- vpnc-script.orig	Thu Sep  6 22:05:15 2007
+++ vpnc-script	Thu Sep 13 21:53:21 2007
@@ -108,7 +108,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'
 	}
@@ -195,6 +195,13 @@ else # use route command
 		case "$OS" in
 		Linux|NetBSD) # 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
