[PATCH] Windows VPN connection script fix to set default domain for DNS

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

 



In most work environments it's important to set the default domain for
DNS requests, so this addition to the connection script achieves that.
I should note that this is accomplished via WMI instead of using NETSH
since NETSH strangely doesn't have the capability to actually set this
parameter.  It's also available via PowerShell, but I'm fairly certain
this doesn't work in earlier versions of Windows, so the WMI solution
ought to be more universal.

Signed-off-by: Kyle Johnson <KyleJ61782 at gmail.com>
---
 vpnc-script-win.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/vpnc-script-win.js b/vpnc-script-win.js
index a3a0974..ac473a5 100644
--- a/vpnc-script-win.js
+++ b/vpnc-script-win.js
@@ -84,6 +84,11 @@ case "connect":
      }
  }

+ // Set default DNS search domain
+ if (env("CISCO_DEF_DOMAIN")) {
+ run("wmic path Win32_NetworkAdapterConfiguration where
InterfaceIndex=" + env("TUNIDX") + " call SetDNSDomain " +
env("CISCO_DEF_DOMAIN"));
+ }
+
  echo("Configuring \"" + env("TUNDEV") + "\" interface for Legacy IP...");

  if (!env("CISCO_SPLIT_INC") && REDIRECT_GATEWAY_METHOD != 2) {
-- 
2.18.0



[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