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>
pull/1691/head
David Anderson 4 years ago
parent 58760f7b82
commit 19eca34f47

@ -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.

Loading…
Cancel
Save