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>
main
M. J. Fromberger 1 month ago committed by GitHub
parent ea1f1616b9
commit 26951a1cbb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      ipn/ipnlocal/local.go

@ -6241,10 +6241,12 @@ 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 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)
if ms, ok := b.sys.MagicSock.GetOK(); ok {
if nm != nil {

Loading…
Cancel
Save