ipn/ipnlocal: clear app connector storage on 'down'

App connectors store their routes in the state file, so that they may
have an understanding of which routes can be removed when app connectors
are reconfigured.

App connectors route storage is deleted if the AdvertisedRoutes are
edited by something else, such as `tailscale set`.

This should also happen on `tailscale down`.

Fixes #13680
Signed-off-by: Fran Bull <fran@tailscale.com>
This commit is contained in:
Fran Bull 2024-10-07 14:09:56 -07:00
parent 6f694da912
commit 008b0b8b2b

View File

@ -3627,7 +3627,8 @@ func (b *LocalBackend) SetUseExitNodeEnabled(v bool) (ipn.PrefsView, error) {
// AdvertiseRoutes has been set in the MaskedPrefs.
func (b *LocalBackend) MaybeClearAppConnector(mp *ipn.MaskedPrefs) error {
var err error
if b.appConnector != nil && mp.AdvertiseRoutesSet {
routesChanged := mp.AdvertiseRoutesSet || (mp.WantRunningSet && !mp.WantRunning)
if b.appConnector != nil && routesChanged {
err = b.appConnector.ClearRoutes()
if err != nil {
b.logf("appc: clear routes error: %v", err)