openconnect-gui icon indicating copy to clipboard operation
openconnect-gui copied to clipboard

vpnc-script.js doesn't revert dns settings in windows

Open adminios opened this issue 6 years ago • 5 comments

Hello, everyone!

I've use to openconnect and openvpn. It's both clients share the same tun interface and when I switch from openconnect to openvpn, settings for dns servers still from openconnect. I've resolved problem by change 2 lines in vpnc-script.js:

// ReSet Tunnel Adapter IP = nothing echo("Resetting Tunnel Adapter IP"); // exec("netsh interface ip set address " + env("TUNIDX") + " source=static 1.0.0.0 255.255.255.255"); //exec("netsh interface ip delete address " + env("TUNIDX") + " 1.0.0.0"); exec("netsh interface ip set dns " + env("TUNIDX") + " source=dhcp"); exec("netsh interface ip set address " + env("TUNIDX") + " source=dhcp");

That doesn't revert settings back to previous state, but in my opinion, that doesn't need for tun interface :)

adminios avatar Apr 05 '18 09:04 adminios

Hello, thanks for report! Yes, the script is not perfect and there are many open issues. Anyway, the best place to discuss it or propose the fixes/workaround is an upstream openconnect project community. There is no need to register into mailinglist. This project is just about GUI based on top of openconnect library and vpnc scripts.

horar avatar Apr 05 '18 20:04 horar

I‘ve got the similar problem: openconnect-gui 1.5.3 does not reset both ipv4 and ipv6 address. @adminios 's scripts work for ipv4. I modify it as follows to revert ipv6 address to DHCP

	// ReSet Tunnel Adapter IP = nothing
	echo("Resetting Tunnel Adapter IP");
	//exec("netsh interface ip set address " + env("TUNIDX") + " source=static 1.0.0.0 255.255.255.255");
	//exec("netsh interface ip delete address " + env("TUNIDX") + " 1.0.0.0");
	exec("netsh interface ipv6 delete address " + env("TUNIDX") + " " + env("INTERNAL_IP6_ADDRESS"));
	exec("netsh interface ip set dns " + env("TUNIDX") + " source=dhcp");
	exec("netsh interface ip set address " + env("TUNIDX") + " source=dhcp");

chchuj avatar Apr 19 '18 15:04 chchuj

#180

horar avatar Apr 19 '18 17:04 horar

Hi I Replaced the latest script from OpenConnect Web site with the script that exist in release package of this product, It works very good now in windows 10 please update the release package with new script.

aminmazi avatar May 29 '18 07:05 aminmazi

Oh, ok. As far I remember, the last changes use 2 variant of the vpnc script. The goal is to use original (upstream) version for openconnect.exe and slightly modified (not merged into upstream yet) for GUI.

The reason is very simple. When user get issues with GUI and console doesn't work as well, the problem should be fixed in upstream openconnect project.

May be, I will update notes/hints.

horar avatar Jun 07 '18 19:06 horar