ipn/ipnlocal: stop netmap expiry timer when resetting control client

This prevents a panic where we synthesize a new netmap in
setClientStatus after we've shut down and nil'd out the controlclient,
since that function expects to be called while connected to control.

Fixes #7392

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: Ib631eb90f34f6afa008d69bbb386f70da145e102
pull/7477/head
Andrew Dunham 2 years ago
parent 96a555fc5a
commit df2561f6a2

@ -3682,6 +3682,21 @@ func (b *LocalBackend) resetControlClientLockedAsync() {
if b.cc == nil { if b.cc == nil {
return return
} }
// When we clear the control client, stop any outstanding netmap expiry
// timer; synthesizing a new netmap while we don't have a control
// client will break things.
//
// See https://github.com/tailscale/tailscale/issues/7392
if b.nmExpiryTimer != nil {
b.nmExpiryTimer.Stop()
b.nmExpiryTimer = nil
// Also bump the epoch to ensure that if the timer started, it
// will abort.
b.numClientStatusCalls.Add(1)
}
go b.cc.Shutdown() go b.cc.Shutdown()
b.cc = nil b.cc = nil
b.ccAuto = nil b.ccAuto = nil

Loading…
Cancel
Save