From 4c09ea6c24a13102debb99d717949db71d40b36c Mon Sep 17 00:00:00 2001 From: Nick Khyl Date: Fri, 9 May 2025 20:19:36 -0500 Subject: [PATCH] ipn/ipnlocal: call authReconfig once per cc status update Updates #12027 Signed-off-by: Nick Khyl --- ipn/ipnlocal/local.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 5d6433002..8a24f5e11 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -1550,13 +1550,23 @@ func (b *LocalBackend) SetControlClientStatus(c controlclient.Client, st control // Auth completed, unblock the engine b.blockEngineUpdates(false) } - b.authReconfig() b.send(ipn.Notify{LoginFinished: &empty.Message{}}) } // Lock b again and do only the things that require locking. 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 cn := b.currentNode() prefs := b.pm.CurrentPrefs().AsStruct() @@ -1718,9 +1728,6 @@ func (b *LocalBackend) SetControlClientStatus(c controlclient.Client, st control b.setAuthURL(st.URL) } 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 {