ipn/ipnlocal: derive the OS routes from the route manager
routerConfigLocked previously computed router.Config.Routes with peerRoutes, a from-scratch pass over cfg.Peers on every reconfig. The route manager already maintains the same set incrementally (ULA and CGNAT coarsening included) and updateRouteManagerPrefs runs earlier in authReconfig, so its OS route set is current by the time the router config is built. Read it from there instead, and delete peerRoutes and its tests; the routemanager package tests cover the same behavior. This removes a consumer of cfg.Peers, which is on its way out. Updates #12542 Change-Id: I4a5b7a63d530e3fe1b70f0faf3f49def6a10be2e Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
8eb18d902e
commit
318807bdb9
@@ -861,6 +861,17 @@ func (nb *nodeBackend) updateRouteManagerPrefs(p routePrefs) (changedAllowedIPs
|
||||
return res.AllowedIPs
|
||||
}
|
||||
|
||||
// osRoutes returns the sorted set of prefixes that the route manager
|
||||
// wants programmed into the OS routing table.
|
||||
func (nb *nodeBackend) osRoutes() []netip.Prefix {
|
||||
var routes []netip.Prefix
|
||||
for pfx := range nb.routeMgr.OSRoutes().All() {
|
||||
routes = append(routes, pfx)
|
||||
}
|
||||
tsaddr.SortPrefixes(routes)
|
||||
return routes
|
||||
}
|
||||
|
||||
// setPacketFilter stores the live packet filter rules and parsed
|
||||
// matches. It does not touch the frozen netMap. nb.mu is acquired by
|
||||
// this method.
|
||||
|
||||
Reference in New Issue
Block a user