From 01aa01f3108150196e7402958674e49d20cd68a1 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Mon, 17 Jun 2024 16:11:50 +0200 Subject: [PATCH] ipn/ipnlocal: network-lock, error if no pubkey instead of panic Updates tailscale/corp#20931 Signed-off-by: Kristoffer Dalby --- ipn/ipnlocal/network-lock.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ipn/ipnlocal/network-lock.go b/ipn/ipnlocal/network-lock.go index 593c5493c..90d3e30e7 100644 --- a/ipn/ipnlocal/network-lock.go +++ b/ipn/ipnlocal/network-lock.go @@ -255,7 +255,10 @@ func (b *LocalBackend) tkaSyncIfNeeded(nm *netmap.NetworkMap, prefs ipn.PrefsVie b.logf("tkaSyncIfNeeded: enabled=%v, head=%v", nm.TKAEnabled, nm.TKAHead) } - ourNodeKey := prefs.Persist().PublicNodeKey() + ourNodeKey, ok := prefs.Persist().PublicNodeKeyOK() + if !ok { + return errors.New("tkaSyncIfNeeded: no node key in prefs") + } isEnabled := b.tka != nil wantEnabled := nm.TKAEnabled