[PATCH v2 3/3] Revive route cleanup for /sbin/route code

Gernot Hillier gernot.hillier at siemens.com
Mon Oct 30 07:04:29 PDT 2017


Cleanup our routes upon disconnect also when using /sbin/route command - even
if OS will do it for us when TUNDEV gets removed. That's the same what the
ip-route code already does.

Additionally, we obviously didn't need route deletion in set_network_route for
/sbin/route mode - this function didn't do anything until now. So remove this
call -- it's a bad idea to call del_network_route inside set_network_route
anyways because both modify the same global variables.

Signed-off-by: Gernot Hillier <gernot.hillier at siemens.com>
Tested-by: Thomas Zander <thomas.zander at siemens.com>
---
 vpnc-script | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/vpnc-script b/vpnc-script
index ad514dd..f56b5e1 100755
--- a/vpnc-script
+++ b/vpnc-script
@@ -358,7 +358,6 @@ else # use route command
 		else
 			NETGW="$INTERNAL_IP4_ADDRESS"
 		fi
-		del_network_route "$NETWORK" "$NETMASK" "$NETMASKLEN"
 		route add -net "$NETWORK" $route_syntax_netmask "$NETMASK" $route_syntax_gw "$NETGW" $route_syntax_interface
 	}
 
@@ -393,12 +392,6 @@ else # use route command
 	}
 
 	del_network_route() {
-		case "$OS" in
-		Linux|NetBSD|OpenBSD|Darwin|SunOS) # and probably others...
-			# routes are deleted automatically on device shutdown
-			return
-			;;
-		esac
 		NETWORK="$1"
 		NETMASK="$2"
 		NETMASKLEN="$3"
-- 
2.13.6




More information about the openconnect-devel mailing list