ipn/ipnlocal: skip writing netmaps to disk when disabled (#18883)

We use the TS_USE_CACHED_NETMAP knob to condition loading a cached netmap, but
were hitherto writing the map out to disk even when it was disabled. Let's not
do that; the two should travel together.

Updates #12639

Change-Id: Iee5aa828e2c59937d5b95093ea1ac26c9536721e
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
This commit is contained in:
M. J. Fromberger 2026-03-04 15:13:30 -08:00 committed by GitHub
parent ea1f1616b9
commit 26951a1cbb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6241,8 +6241,10 @@ func (b *LocalBackend) setNetMapLocked(nm *netmap.NetworkMap) {
var login string
if nm != nil {
login = cmp.Or(profileFromView(nm.UserProfiles[nm.User()]).LoginName, "<missing-profile>")
if err := b.writeNetmapToDiskLocked(nm); err != nil {
b.logf("write netmap to cache: %v", err)
if envknob.Bool("TS_USE_CACHED_NETMAP") {
if err := b.writeNetmapToDiskLocked(nm); err != nil {
b.logf("write netmap to cache: %v", err)
}
}
}
b.currentNode().SetNetMap(nm)