From fd77268770022059ea1d405ee648a38f794ee1c1 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 21 Sep 2020 14:52:52 -0700 Subject: [PATCH] wgengine/router: enumerate all interfaces when finding Tailscale adapter by GUID Might fix it. I've spent too much time failing to reproduce the issue. This doesn't seem to make it worse, though (it still runs for me), so I'll include this and see if it helps others while I still work on a reliable way to reproduce it. Updates tailscale/corp#474 --- wgengine/router/ifconfig_windows.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wgengine/router/ifconfig_windows.go b/wgengine/router/ifconfig_windows.go index 4dab02bbc..67030ef74 100644 --- a/wgengine/router/ifconfig_windows.go +++ b/wgengine/router/ifconfig_windows.go @@ -217,7 +217,13 @@ func setPrivateNetwork(ifcGUID *windows.GUID) (bool, error) { func configureInterface(cfg *Config, tun *tun.NativeTun) error { const mtu = 0 guid := tun.GUID() - iface, err := winipcfg.InterfaceFromGUID(&guid) + iface, err := winipcfg.InterfaceFromGUIDEx(&guid, &winipcfg.GetAdapterAddressesFlags{ + // Issue 474: on early boot, when the network is still + // coming up, if the Tailscale service comes up first, + // the Tailscale adapter it finds might not have the + // IPv4 service available yet? Try this flag: + GAA_FLAG_INCLUDE_ALL_INTERFACES: true, + }) if err != nil { return err }