net/netns: add windows support.

Also remove rebinding logic from the windows router. Magicsock will
instead rebind based on link change signals.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2020-09-10 18:40:02 +00:00
committed by Dave Anderson
parent 3f4d93feb2
commit 8f5b52e571
10 changed files with 235 additions and 111 deletions

View File

@@ -49,13 +49,10 @@ func newUserspaceRouter(logf logger.Logf, wgdev *device.Device, tundev tun.Devic
}
func (r *winRouter) Up() error {
// MonitorDefaultRoutes handles making sure our wireguard UDP
// traffic goes through the old route, not recursively through the VPN.
r.removeFirewallAcceptRule()
var err error
r.routeChangeCallback, err = monitorDefaultRoutes(r.wgdev, true, r.nativeTun)
r.routeChangeCallback, err = monitorDefaultRoutes(r.nativeTun)
if err != nil {
log.Fatalf("MonitorDefaultRoutes: %v", err)
}
@@ -116,6 +113,7 @@ func (r *winRouter) Close() error {
if r.routeChangeCallback != nil {
r.routeChangeCallback.Unregister()
}
return nil
}