tailscale/wgengine
Brad Fitzpatrick 4660a961eb ipn/ipnlocal, wgengine/wgcfg/nmcfg: stop building peer lists on delta path
Processing a peer add/remove delta still materialized the full netmap
(an O(n) slicesx.MapValues plus sort over all peers, at 10k+
peers in a large tailnet) twice per delta: once in UpdateNetmapDelta
purely to hand the self node to Engine.SetSelfNode, and once in
authReconfigLocked.

Neither needs peers anymore. SetSelfNode gets the self node from the
existing nodeBackend.Self accessor. authReconfigLocked only reads
self-node fields (SelfNode, NodeKey, GetAddresses, HasCap) now that
WireGuard peers ride the incremental route manager and per-peer config
source, so it can use the peers-free NetMap accessor.

That also makes nmcfg.WGCfg vestigial: since wgcfg.Config lost its
Peers field, its peer walk existed only to emit the [v1] skip logs
(expired peers, unselected exit nodes, unaccepted subnet routes),
duplicating filtering the route manager already does. Delete the
package and construct the two-field wgcfg.Config inline. The skip
logs go away; if they're missed, the route manager can log them
incrementally at upsert time instead of rescanning every peer on
every reconfig.

With this, the runtime.DidRange analysis (see the ts_rangehook test)
shows a delta netmap update performing no O(n) range loops except
updateRouteManagerExtras, and the delta phase of that test drops from
1.09s to 0.14s for 400 deltas at n=10000 (from 4.79s at the
start of this effort, before the incremental route manager work).

Updates #12542

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Change-Id: Ia0e03ef9db0c988790b2c29de1f0505305e93f58
2026-07-15 11:21:36 -04:00
..
bench wgengine/wgcfg,wgengine,ipn/ipnlocal: remove Peers from wgcfg.Config 2026-07-14 19:57:59 -04:00
filter all: fix more typos caused by unnecessary repetition 2026-07-06 10:36:17 +01:00
magicsock ipn/ipnlocal, wgengine/wgcfg/nmcfg: stop building peer lists on delta path 2026-07-15 11:21:36 -04:00
netlog wgengine/netlog: stop using netmap.NetworkMap type, use LocalBackend 2026-06-17 15:11:57 -07:00
netstack wgengine/netstack: reject unserved ports on Service (VIP) IPs (#20363) 2026-07-10 14:06:15 -04:00
router wgengine/router/osrouter,util/linuxfw: remove orphaned tailnet addrs (#20199) 2026-06-24 13:41:36 -07:00
wgcfg ipn/ipnlocal, wgengine/wgcfg/nmcfg: stop building peer lists on delta path 2026-07-15 11:21:36 -04:00
wgint all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
wglog wgengine/wglog: stop using netmap.NetworkMap here too 2026-06-23 09:06:37 -07:00
winnet all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
bird_hooks.go wgengine,cmd/tailscaled,feature/bird: move BIRD integration to ./feature 2026-07-14 10:48:09 -07:00
mem_ios.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
netlog_hooks.go wgengine,wgcfg,feature/netlog: move network flow logging behind a feature hook 2026-07-09 12:56:37 -07:00
pendopen_omit.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
pendopen.go wgengine,ipn/ipnlocal,tsnet,cmd/tailscaled: remove PeerForIP from the Engine interface 2026-07-13 15:15:16 -07:00
userspace_ext_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
userspace_test.go wgengine/wgcfg,wgengine,ipn/ipnlocal: remove Peers from wgcfg.Config 2026-07-14 19:57:59 -04:00
userspace.go wgengine/wgcfg,wgengine,ipn/ipnlocal: remove Peers from wgcfg.Config 2026-07-14 19:57:59 -04:00
wgengine.go net/tstun,wgengine,ipn/ipnlocal: make tstun's peerConfigTable use RouteManager table 2026-07-14 12:41:11 -07:00