$OpenBSD: patch-vpnc-script_in,v 1.1 2009/01/29 19:07:06 pea Exp $
--- vpnc-script.in.orig	Wed Nov 19 21:55:51 2008
+++ vpnc-script.in	Thu Jan 22 14:00:42 2009
@@ -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
