summaryrefslogtreecommitdiffhomepage
path: root/tun/wintun/wintun_windows.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-10 21:31:37 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-10 21:31:37 +0200
commit5669ed326f1a1c535c1251f07a31323ec3c60ef1 (patch)
tree9a40715fd2547048ac1a31da2861a24b223e382e /tun/wintun/wintun_windows.go
parent2d847a38a29ed413f5907cc411c9ff4752001212 (diff)
wintun: call HrRenameConnection in another thread
Diffstat (limited to 'tun/wintun/wintun_windows.go')
-rw-r--r--tun/wintun/wintun_windows.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/tun/wintun/wintun_windows.go b/tun/wintun/wintun_windows.go
index b48ff80..4dfc0bc 100644
--- a/tun/wintun/wintun_windows.go
+++ b/tun/wintun/wintun_windows.go
@@ -513,10 +513,11 @@ func (wintun *Wintun) GetInterfaceName() (string, error) {
//
func (wintun *Wintun) SetInterfaceName(ifname string) error {
// We have to tell the various runtime COM services about the new name too. We ignore the
- // error because netshell isn't available on servercore.
+ // error because netshell isn't available on servercore. It's also slow, so we run it in a
+ // separate thread.
// TODO: netsh.exe falls back to NciSetConnection in this case. If somebody complains, maybe
// we should do the same.
- _ = netshell.HrRenameConnection(&wintun.CfgInstanceID, windows.StringToUTF16Ptr(ifname))
+ go netshell.HrRenameConnection(&wintun.CfgInstanceID, windows.StringToUTF16Ptr(ifname))
// Set the interface name. The above line should have done this too, but in case it failed, we force it.
key, err := registry.OpenKey(registry.LOCAL_MACHINE, wintun.GetNetRegKeyName(), registry.SET_VALUE)