mirror of
https://github.com/tailscale/tailscale.git
synced 2026-07-15 10:03:09 -04:00
Give nodeBackend a RouteManager and keep it in sync as routing inputs change: full netmaps resync the whole peer set (removals plus no-op-cheap upserts), incremental netmap deltas mirror their peer upserts and removes into the same mutation batch, and authReconfigLocked pushes the routing-relevant prefs (exit node, subnet route acceptance, OneCGNAT) after resolving the exit node's stable ID to its current numeric node ID. A selected exit node that doesn't resolve to a current peer (a nonexistent node, or MDM's "auto:any" placeholder awaiting resolution) is not the same as no exit node: per the long-standing ipn.Prefs.ExitNodeID contract, it blackholes internet traffic rather than letting it escape to the local network. RouteManager's Prefs gains an ExitNodeSelected bit so its OS route set keeps the default routes in that case, with no outbound peer to carry them, matching what routerConfigLocked does today, as pinned by TestRouterConfigExitNodeBlackhole in the previous commit. All mutations happen with nodeBackend.mu held, satisfying the RouteManager's serialized Begin/Commit contract. Nothing consumes its snapshots yet; the wgengine data plane and OS router wiring come next. Updates #12542 Change-Id: I677b6b2c9efb8e41b3d27071bd9db73e01640d3b Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>