control/controlclient: fix a nil-indirection bug in DERP key pruning (#19565)

Upon deciding to update the LastSeen timestamp, we weren't checking that the
field we are replacing into was non-nil. Rather than add an additional check,
just allocate a fresh pointer for the updated time.

Updates #19564

Change-Id: I589ebe65175fc7677c04a31dd6c4670e2531ee62
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
This commit is contained in:
M. J. Fromberger 2026-04-29 07:57:38 -07:00 committed by GitHub
parent a29e42135b
commit 7b53550fe6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -521,7 +521,11 @@ func (ms *mapSession) removeUnwantedDiscoUpdatesFromFullNetmapUpdate(resp *tailc
// Overwrite the key and last seen in the full netmap update.
peer.DiscoKey = existingNode.DiscoKey()
*peer.LastSeen = existingNode.LastSeen().Get()
if t, ok := existingNode.LastSeen().GetOk(); ok {
peer.LastSeen = new(t)
} else {
peer.LastSeen = nil
}
}
}