[PATCH 4/6] Improved vpnc-script.js

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


From: Zhenyu Wu <Adam5Wu at users.noreply.github.com>

2. Added REDIRECT_GATEWAY_METHOD = -1 mode, which leaves default route intact, but do all other necessary route setup. This mode can be used by advanced users who already have the persistent route set up. For example, only certain IP/subnet will to through VPN, while all other traffic still go through native interface (improves latency for, i.e. Google search)

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

diff --git a/vpnc-script-win.js b/vpnc-script-win.js
index d2bf78a..64a40db 100644
--- a/vpnc-script-win.js
+++ b/vpnc-script-win.js
@@ -37,6 +37,7 @@ function waitForInterface() {
 	return false;
 }
 
+
 // --------------------------------------------------------------
 // Script starts here
 // --------------------------------------------------------------
@@ -47,6 +48,7 @@ var ws = WScript.CreateObject("WScript.Shell");
 var env = ws.Environment("Process");
 
 // How to add the default internal route
+// -1 - Do not touch default route (but do other necessary route setups)
 // 0 - As interface gateway when setting properties
 // 1 - As a 0.0.0.0/0 route with a lower metric than the default route
 // 2 - As 0.0.0.0/1 + 128.0.0.0/1 routes (override the default route cleanly)
@@ -95,7 +97,7 @@ case "connect":
 		run("netsh interface ip set interface \"" + tundevid + "\" metric=1");
 	}
 	
-	if (env("CISCO_SPLIT_INC") || REDIRECT_GATEWAY_METHOD > 0) {
+	if (env("CISCO_SPLIT_INC") || REDIRECT_GATEWAY_METHOD != 0) {
 		run("netsh interface ip set address \"" + tundevid + "\" static " +
 			env("INTERNAL_IP4_ADDRESS") + " " + env("INTERNAL_IP4_NETMASK"));
 	} else {
-- 
2.12.0.windows.1




More information about the openconnect-devel mailing list