aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tunnel/ifaceconfig.go
diff options
context:
space:
mode:
Diffstat (limited to 'tunnel/ifaceconfig.go')
-rw-r--r--tunnel/ifaceconfig.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/tunnel/ifaceconfig.go b/tunnel/ifaceconfig.go
index 1ad076fa..3954441b 100644
--- a/tunnel/ifaceconfig.go
+++ b/tunnel/ifaceconfig.go
@@ -10,6 +10,7 @@ import (
"log"
"net"
"sort"
+ "time"
"golang.org/x/sys/windows"
"golang.zx2c4.com/wireguard/tun"
@@ -221,3 +222,21 @@ func enableFirewall(conf *conf.Config, tun *tun.NativeTun) error {
}
return firewall.EnableFirewall(tun.LUID(), conf.Interface.DNS, restrictAll)
}
+
+func waitForFamilies(tun *tun.NativeTun) {
+ //TODO: This whole thing is a disgusting hack that shouldn't be neccessary.
+
+ f := func(luid winipcfg.LUID, family winipcfg.AddressFamily, maxRetries int) {
+ for i := 0; i < maxRetries; i++ {
+ _, err := luid.IPInterface(family)
+ if i != maxRetries-1 && err == windows.ERROR_NOT_FOUND {
+ time.Sleep(time.Millisecond * 50)
+ continue
+ }
+ break
+ }
+ }
+ luid := winipcfg.LUID(tun.LUID())
+ f(luid, windows.AF_INET, 100)
+ f(luid, windows.AF_INET6, 3)
+} \ No newline at end of file