wgengine/magicsock: restore SetDERPMap signature, add SetDERPMapWithoutReSTUN

Commit 78627c132f changed the signature of magicsock.Conn.SetDERPMap to
take an additional bool doReStun parameter. Avoid both the boolean
parameter and the API signature change by restoring SetDERPMap to its
original single-argument form and adding a new SetDERPMapWithoutReSTUN
method for the cache-loading caller that wants to skip the post-set
ReSTUN.

Updates #19490

Change-Id: I97d9e82156bfc546ccf59756d1ea52f039b5de06
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2026-04-29 19:36:30 +00:00
committed by Brad Fitzpatrick
parent 1cd8bcc827
commit 22ff402da9
5 changed files with 31 additions and 18 deletions
+3 -3
View File
@@ -1867,7 +1867,7 @@ func (b *LocalBackend) setControlClientStatusLocked(c controlclient.Client, st c
}
b.e.SetNetworkMap(st.NetMap)
b.MagicConn().SetDERPMap(st.NetMap.DERPMap, false)
b.MagicConn().SetDERPMapWithoutReSTUN(st.NetMap.DERPMap)
if c == nil && st.NetMap.Cached && st.NetMap.SelfNode.Valid() {
// Loading from a cached netmap (c == nil means no live control
// client). Pre-seed the home DERP from the cached self node so
@@ -3445,7 +3445,7 @@ func (b *LocalBackend) DebugForceNetmapUpdate() {
nm := b.currentNode().NetMap()
b.e.SetNetworkMap(nm)
if nm != nil {
b.MagicConn().SetDERPMap(nm.DERPMap, true)
b.MagicConn().SetDERPMap(nm.DERPMap)
}
b.setNetMapLocked(nm)
}
@@ -4903,7 +4903,7 @@ func (b *LocalBackend) setPrefsLocked(newp *ipn.Prefs) ipn.PrefsView {
}
if netMap != nil {
b.MagicConn().SetDERPMap(netMap.DERPMap, true)
b.MagicConn().SetDERPMap(netMap.DERPMap)
}
if !oldp.WantRunning() && newp.WantRunning && cc != nil {