ipn/ipnlocal: call authReconfig once per cc status update

Updates #12027

Signed-off-by: Nick Khyl <nickk@tailscale.com>
This commit is contained in:
Nick Khyl 2025-05-09 20:19:36 -05:00
parent 565ebbdeb8
commit 4c09ea6c24
No known key found for this signature in database

View File

@ -1550,13 +1550,23 @@ func (b *LocalBackend) SetControlClientStatus(c controlclient.Client, st control
// Auth completed, unblock the engine // Auth completed, unblock the engine
b.blockEngineUpdates(false) b.blockEngineUpdates(false)
} }
b.authReconfig()
b.send(ipn.Notify{LoginFinished: &empty.Message{}}) b.send(ipn.Notify{LoginFinished: &empty.Message{}})
} }
// Lock b again and do only the things that require locking. // Lock b again and do only the things that require locking.
b.mu.Lock() b.mu.Lock()
// [LocalBackend.authReconfig] should be called once per control client status update,
// and only after the new netmap has been set.
//
// This is currently (2020-07-28) necessary; conditionally disabling it is fragile!
// This is where netmap information gets propagated to router and magicsock.
//
// TODO(nickkhyl): Revisit this after the state machine refactor.
// We shouldn't be calling it from five different places, and the authReconfig logic
// may need its own refactor.
defer b.authReconfig()
prefsChanged := false prefsChanged := false
cn := b.currentNode() cn := b.currentNode()
prefs := b.pm.CurrentPrefs().AsStruct() prefs := b.pm.CurrentPrefs().AsStruct()
@ -1718,9 +1728,6 @@ func (b *LocalBackend) SetControlClientStatus(c controlclient.Client, st control
b.setAuthURL(st.URL) b.setAuthURL(st.URL)
} }
b.stateMachine() b.stateMachine()
// This is currently (2020-07-28) necessary; conditionally disabling it is fragile!
// This is where netmap information gets propagated to router and magicsock.
b.authReconfig()
} }
type preferencePolicyInfo struct { type preferencePolicyInfo struct {