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 <danderson@tailscale.com>
This commit is contained in:
David Anderson 2021-04-10 19:36:26 -07:00
parent 58760f7b82
commit 19eca34f47

View File

@ -14,6 +14,7 @@
"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.