mirror of
https://github.com/tailscale/tailscale.git
synced 2026-07-15 18:13:06 -04:00
Engine.Reconfig previously diffed cfg.Peers disco keys against the previous config to find restarted peers and flush their WireGuard sessions, with a TSMP-learned-key map to suppress resets for key changes that arrived over a working session. That was the last per-peer state computed from wgcfg.Config.Peers inside the engine, and it only ran on full reconfigs, so incremental netmap deltas never got session resets at all. Move the detection into nodeBackend, which sees every peer change: full netmaps in SetNetMap and incremental upserts in UpdateNetmapDelta both now report which peers changed disco keys, with the same TSMP suppression and mismatch accounting as before. LocalBackend acts on the result via a new Engine.ResetDevicePeer method, which just removes the peer from the WireGuard device and lets the peer lookup func lazily re-create it with fresh state. LocalBackend.PatchDiscoKey now records TSMP-learned keys in nodeBackend instead of forwarding to the engine, so the engine's PatchDiscoKey method and tsmpLearnedDisco map are gone. The controlclient patchDiscoKeyer interface becomes the exported DiscoKeyUpdater so LocalBackend can compile-time assert that it implements it, alongside its NetmapDeltaUpdater friends, replacing the test that asserted the same of the engine. This is one of the last steps toward removing Peers from wgcfg.Config. Updates #12542 Change-Id: I6b42e460f42924816beae89ca43731cb91b66054 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>