From bba001018f0a8f2fb1c88a6b97adb23690a6512b Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 28 Sep 2019 19:20:49 +0200 Subject: tunnel: windows does not always add/remove routes with up/down interface On Linux, we're used to routes being added after an interface is up, and routes being removed as a consequence of an interface going down. On Windows, this isn't always the case, at least not from the perspective of the route notifiers. In order to work around this and make a multi-interface model coherent, we search for a new default route not only whenever the routing table changes but also whenever any interface link parameters change, such as up/down. The practical consequence is that now WireGuard connects properly when wifi is disconnected and then reconnected. Reported-by: Nenad Kozul Signed-off-by: Jason A. Donenfeld --- tunnel/winipcfg/types.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tunnel/winipcfg/types.go') diff --git a/tunnel/winipcfg/types.go b/tunnel/winipcfg/types.go index 684a6c77..81f9335d 100644 --- a/tunnel/winipcfg/types.go +++ b/tunnel/winipcfg/types.go @@ -510,6 +510,10 @@ const ( MibInitialNotification // Initial notification ) +type ChangeCallback interface { + Unregister() error +} + // TunnelType enumeration type defines the encapsulation method used by a tunnel, as described by the Internet Assigned Names Authority (IANA). // https://docs.microsoft.com/en-us/windows/desktop/api/ifdef/ne-ifdef-tunnel_type type TunnelType uint32 -- cgit v1.2.3-59-g8ed1b