[PATCH v3 2/3] Revive route cleanup for /sbin/route code

Gernot Hillier gernot.hillier at siemens.com
Wed Feb 21 08:46:43 PST 2018


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 a5f6c9c..860add4 100755
--- a/vpnc-script
+++ b/vpnc-script
@@ -357,7 +357,6 @@ else # use route command
 		NETWORK="$1"
 		NETMASK="$2"
 		NETMASKLEN="$3"
-		del_network_route "$NETWORK" "$NETMASK" "$NETMASKLEN"
 		route add -net "$NETWORK" $route_syntax_netmask "$NETMASK" $route_syntax_gw "$INTERNAL_IP4_ADDRESS" $route_syntax_interface
 	}
 
@@ -392,12 +391,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