wgengine/wgcfg,wgengine,ipn/ipnlocal: remove Peers from wgcfg.Config
The wireguard-go device now learns its peer set solely from the live per-peer config source that LocalBackend installs with Engine.SetPeerConfigFunc, backed by the route manager. Peers are created lazily on first packet and converged per peer with Engine.SyncDevicePeer, so the full-peer-list snapshot in wgcfg.Config and the diff-and-reconfigure machinery around it (wgcfg.Peer, ReconfigDevice, and the engine's full device sync in maybeReconfigWireguardLocked) are dead weight: they duplicated state that the route manager already owns and forced every netmap change to rebuild and rehash the entire peer list. Delete the Peers field and the Peer type from wgcfg, along with ReconfigDevice and maybeReconfigWireguardLocked. Engine.Reconfig no longer does any device peer work; it only manages the private key, addresses, and the non-peer subsystems. Full-netmap application converges the device by syncing exactly the peers whose routes the route manager reports as changed or removed. Updates #12542 Change-Id: Ic776e42cfaa5be6b9329b3d381d5cbde17d7078b Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
87c0d36942
commit
72ca0cae4b
+2
-2
@@ -1746,7 +1746,7 @@ func TestFallbackTCPHandler(t *testing.T) {
|
||||
// Before aa5da2e5f22a, every peer change rebuilt a full netmap on
|
||||
// the engine, so [wgengine.Engine.SetNetworkMap] kept the engine's
|
||||
// cached netmap fresh and [wgengine.Engine.Reconfig] kept wgdev and
|
||||
// e.lastCfgFull fresh. After that refactor, peer adds and removes
|
||||
// e.lastCfg fresh. After that refactor, peer adds and removes
|
||||
// ride the delta path and only mutate [nodeBackend]; the engine's
|
||||
// cached netmap and wireguard config stayed stale, and
|
||||
// [wgengine.Engine.PeerForIP] / [wgengine.Engine.Ping] / wgdev's
|
||||
@@ -1925,7 +1925,7 @@ func TestPingSubnetRouteOfDeltaPeer(t *testing.T) {
|
||||
// outbound wgdev encryption, magicsock transport. The receiving
|
||||
// side (s2's tstun.Wrapper) intercepts TSMP regardless of dst
|
||||
// IP and replies with a pong. So this catches both halves of
|
||||
// the bug: a stale BART / lastCfgFull (PeerForIP / lookupPeerByIP
|
||||
// the bug: a stale BART / lastCfg (PeerForIP / lookupPeerByIP
|
||||
// miss) AND a stale wgdev PeerLookupFunc closure (peer's noise
|
||||
// key not yet registered for outbound encryption).
|
||||
pingCtx, cancelPing := pingTimeout(ctx)
|
||||
|
||||
Reference in New Issue
Block a user