[PATCH 3/6] Establish the direct route to the gateway earlier.

Ľubomír Carik lubomir.carik at gmail.com
Fri Mar 3 14:56:07 PST 2017


From: Nikos Mavrogiannopoulos <nmav at redhat.com>

By establishing the route prior to interface configuration
we avoid traffic loops. Report and fix by Niels Peen.
Resolves #5

Signed-off-by: Ľubomír Carik <Lubomir.Carik at gmail.com>
---
 vpnc-script-win.js | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/vpnc-script-win.js b/vpnc-script-win.js
index 8df9651..d2bf78a 100644
--- a/vpnc-script-win.js
+++ b/vpnc-script-win.js
@@ -75,6 +75,9 @@ case "connect":
 	echo("Internal Gateway: " + internal_gw);
 	echo("Interface idx: \"" + tundevid + "\" (\"" + env("TUNDEV") + "\")");
 	
+	// Add direct route for the VPN gateway to avoid routing loops
+	run("route add " + env("VPNGATEWAY") + " mask 255.255.255.255 " + gw);
+
 	if (env("INTERNAL_IP4_MTU")) {
 	    echo("MTU: " + env("INTERNAL_IP4_MTU"));
 	    run("netsh interface ipv4 set subinterface \"" + tundevid +
@@ -101,10 +104,6 @@ case "connect":
 			env("INTERNAL_IP4_ADDRESS") + " " + env("INTERNAL_IP4_NETMASK") + " " + internal_gw + " 1");
 	}
 
-	// Add direct route for the VPN gateway to avoid routing loops
-	run("route add " + env("VPNGATEWAY") +
-            " mask 255.255.255.255 " + gw);
-
     if (env("INTERNAL_IP4_NBNS")) {
 		var wins = env("INTERNAL_IP4_NBNS").split(/ /);
 		for (var i = 0; i < wins.length; i++) {
-- 
2.12.0.windows.1




More information about the openconnect-devel mailing list