From 19eca34f47f58037222e1152133b45fb52075402 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 10 Apr 2021 19:36:26 -0700 Subject: [PATCH] wgengine/router: fix FreeBSD configuration failure on the v6 /48. On FreeBSD, we add the interface IP as a /48 to work around a kernel bug, so we mustn't then try to add a /48 route to the Tailscale ULA, since that will fail as a dupe. Signed-off-by: David Anderson --- wgengine/router/router_userspace_bsd.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wgengine/router/router_userspace_bsd.go b/wgengine/router/router_userspace_bsd.go index 6e3c35a77..a81f699b6 100644 --- a/wgengine/router/router_userspace_bsd.go +++ b/wgengine/router/router_userspace_bsd.go @@ -14,6 +14,7 @@ import ( "github.com/tailscale/wireguard-go/tun" "inet.af/netaddr" + "tailscale.com/net/tsaddr" "tailscale.com/types/logger" "tailscale.com/version" ) @@ -134,6 +135,12 @@ func (r *userspaceBSDRouter) Set(cfg *Config) (reterr error) { newRoutes := make(map[netaddr.IPPrefix]struct{}) for _, route := range cfg.Routes { + if route == tsaddr.TailscaleULARange() { + // Because we added the interface address as a /48 above, + // the kernel already created the Tailscale ULA route + // implicitly. We mustn't try to add/delete it ourselves. + continue + } newRoutes[route] = struct{}{} } // Delete any pre-existing routes.