Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

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

Open
adminios opened this issue Apr 5, 2018 · 5 comments
Open

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

adminios opened this issue Apr 5, 2018 · 5 comments

Comments

@adminios
Copy link

adminios commented Apr 5, 2018

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 :)

@horar
Copy link
Member

horar commented Apr 5, 2018

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.

@chchuj
Copy link

chchuj commented Apr 19, 2018

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");

@horar
Copy link
Member

horar commented Apr 19, 2018

#180

chchuj added a commit to chchuj/useful_script that referenced this issue Apr 19, 2018
chchuj added a commit to chchuj/HIS-hack that referenced this issue Apr 19, 2018
@aminmazi
Copy link

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.

@horar
Copy link
Member

horar commented Jun 7, 2018

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants