appc: setting AdvertiseRoutes explicitly discards app connector routes

This fixes bugs where after using the cli to set AdvertiseRoutes users
were finding that they had to restart tailscaled before the app
connector would advertise previously learned routes again. And seems
more in line with user expectations.

Fixes #11006
Signed-off-by: Fran Bull <fran@tailscale.com>
This commit is contained in:
Fran Bull
2024-04-15 11:30:00 -07:00
committed by franbull
parent c27dc1ca31
commit 6a0fbacc28
3 changed files with 29 additions and 0 deletions

View File

@ -116,6 +116,16 @@ func (e *AppConnector) storeRoutesLocked() error {
})
}
// ClearRoutes removes all route state from the AppConnector.
func (e *AppConnector) ClearRoutes() error {
e.mu.Lock()
defer e.mu.Unlock()
e.controlRoutes = nil
e.domains = nil
e.wildcards = nil
return e.storeRoutesLocked()
}
// UpdateDomainsAndRoutes starts an asynchronous update of the configuration
// given the new domains and routes.
func (e *AppConnector) UpdateDomainsAndRoutes(domains []string, routes []netip.Prefix) {