ipn/ipnlocal/netmapcache: add UpdateSelfOnly method (#19818)

Some netmap updates are guaranteed to affect only the "static" parts of the
netmap, and so should not require us to walk through all the peers and user
profiles when updating the cache. To support this, the new UpdateSelfOnly
method updates only the Self node and other tailnet settings that are not
dependent on the peers and profiles.

Use this when updating the cache on DERP home changes.

Updates #12542

Change-Id: Ifed522b29d579fb76e010b4ff738cc4e0a72d27f
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
This commit is contained in:
M. J. Fromberger
2026-05-20 16:29:04 -07:00
committed by GitHub
parent 93dbd33ef7
commit c09407002f
5 changed files with 133 additions and 37 deletions
+4 -4
View File
@@ -61,7 +61,7 @@ func TestWriteAndLoadHomeDERP(t *testing.T) {
b.mu.Lock()
defer b.mu.Unlock()
if err := b.writeNetmapToDiskLocked(nm); err != nil {
if err := b.writeNetmapToDiskLockedWithPeers(nm); err != nil {
t.Fatalf("writeNetmapToDiskLocked: %v", err)
}
@@ -127,7 +127,7 @@ func TestOnHomeDERPUpdate(t *testing.T) {
// Write an initial cache entry so we can verify it is not overwritten.
b.mu.Lock()
if err := b.writeNetmapToDiskLocked(nm); err != nil {
if err := b.writeNetmapToDiskLockedWithPeers(nm); err != nil {
b.mu.Unlock()
t.Fatalf("setup writeNetmapToDiskLocked: %v", err)
}
@@ -172,7 +172,7 @@ func TestOnHomeDERPUpdate(t *testing.T) {
// Write an initial cache entry so we can verify it is not overwritten.
b.mu.Lock()
if err := b.writeNetmapToDiskLocked(nm); err != nil {
if err := b.writeNetmapToDiskLockedWithPeers(nm); err != nil {
b.mu.Unlock()
t.Fatalf("setup writeNetmapToDiskLocked: %v", err)
}
@@ -218,7 +218,7 @@ func TestWriteNetmapDoesNotMutateOriginal(t *testing.T) {
b.mu.Lock()
defer b.mu.Unlock()
if err := b.writeNetmapToDiskLocked(nm); err != nil {
if err := b.writeNetmapToDiskLockedWithPeers(nm); err != nil {
t.Fatalf("writeNetmapToDiskLocked: %v", err)
}