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 <kylej61...@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

_______________________________________________
openconnect-devel mailing list
openconnect-devel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/openconnect-devel

Reply via email to