From 008b0b8b2bb6eca31ef86b44a5d0c49d964d2641 Mon Sep 17 00:00:00 2001 From: Fran Bull Date: Mon, 7 Oct 2024 14:09:56 -0700 Subject: [PATCH] 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 --- ipn/ipnlocal/local.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 8fc78a36b..3b94f91e8 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -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)