aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tunnel/winipcfg/winipcfg.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-06-17 13:08:13 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-06-18 12:08:51 +0200
commitb77c634b9eb0e1e732b60667a5974f8340a50253 (patch)
tree13a2d97bcb3ad8e44f288d3220fd9030d9eb968c /tunnel/winipcfg/winipcfg.go
parentversion: bump (diff)
downloadwireguard-windows-b77c634b9eb0e1e732b60667a5974f8340a50253.tar.xz
wireguard-windows-b77c634b9eb0e1e732b60667a5974f8340a50253.zip
tunnel: wait for IP service to attach to wintun
This helps fix startup races without needing to poll, as well as reconfiguring interfaces after wintun destroys and re-adds. It also deals gracefully with IPv6 being disabled.
Diffstat (limited to 'tunnel/winipcfg/winipcfg.go')
-rw-r--r--tunnel/winipcfg/winipcfg.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/tunnel/winipcfg/winipcfg.go b/tunnel/winipcfg/winipcfg.go
index 5af9f1aa..2fc0c875 100644
--- a/tunnel/winipcfg/winipcfg.go
+++ b/tunnel/winipcfg/winipcfg.go
@@ -32,13 +32,13 @@ import (
// GetAdaptersAddresses function retrieves the addresses associated with the adapters on the local computer.
// https://docs.microsoft.com/en-us/windows/desktop/api/iphlpapi/nf-iphlpapi-getadaptersaddresses
-func GetAdaptersAddresses(family uint32, flags GAAFlags) ([]*IPAdapterAddresses, error) {
+func GetAdaptersAddresses(family AddressFamily, flags GAAFlags) ([]*IPAdapterAddresses, error) {
var b []byte
size := uint32(15000)
for {
b = make([]byte, size)
- err := windows.GetAdaptersAddresses(family, uint32(flags), 0, (*windows.IpAdapterAddresses)(unsafe.Pointer(&b[0])), &size)
+ err := windows.GetAdaptersAddresses(uint32(family), uint32(flags), 0, (*windows.IpAdapterAddresses)(unsafe.Pointer(&b[0])), &size)
if err == nil {
break
}