[PATCH 6/6] Allow control of REDIRECT_GATEWAY_METHOD variable via env. variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: ?ubom?r Carik <Lubomir.Carik at gmail.com>
---
 vpnc-script-win.js | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/vpnc-script-win.js b/vpnc-script-win.js
index e409542..ba61401 100644
--- a/vpnc-script-win.js
+++ b/vpnc-script-win.js
@@ -5,18 +5,11 @@
 // needed by vpnc.
 //
 
-var internal_ip4_netmask = "255.255.255.0";
-
-// 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)
-var REDIRECT_GATEWAY_METHOD = 0;
-
 // --------------------------------------------------------------
-// Utilities
+// Initial setup
 // --------------------------------------------------------------
+var internal_ip4_netmask = "255.255.255.0";
+
 var accumulatedExitCode = 0;
 
 var ws = WScript.CreateObject("WScript.Shell");
@@ -29,6 +22,21 @@ if (env("LOG2FILE")) {
 	var log = fs.OpenTextFile(tmpdir + "vpnc.log", 8, true);
 }
 
+// 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)
+if (env("REDIRECT_GATEWAY_METHOD")) {
+	var REDIRECT_GATEWAY_METHOD = env("REDIRECT_GATEWAY_METHOD");
+} else {
+	var REDIRECT_GATEWAY_METHOD = -1;
+}
+
+
+// --------------------------------------------------------------
+// Utilities
+// --------------------------------------------------------------
 function echo(msg)
 {
 	// TODO: prepend UTC? timestamp to every message
-- 
2.12.0.windows.1




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux