tailscale/wgengine
Brad Fitzpatrick d4f2917c1b wgengine, ipn/ipnlocal: route PeerForIP through LocalBackend's live data
userspaceEngine.PeerForIP read from e.netMap.Peers and
e.lastCfgFull.Peers, both of which go stale when peers arrive via
netmap deltas (which skip Engine.SetNetworkMap and Engine.Reconfig).
Every PeerForIP caller (Engine.Ping, the TSMP disco-key handler,
pendopen diagnostics, tsdial.Dialer.UseNetstackForIP, and
LocalBackend.GetPeerEndpointChanges) would report "no matching peer"
for freshly-added peers.

Fix it the same way SetPeerByIPPacketFunc fixed the outbound packet
hot path: have LocalBackend install a callback that reads the live
nodeBackend. nb.NodeByAddr is built from both SelfNode and Peers
(updateNodeByAddrLocked), so a single lookup covers the common case
with IsSelf set when the matched node ID is SelfNode's. The subnet-
route / exit-node-default-route slow path goes through a new
Engine.PeerKeyForIP that exposes the engine's AllowedIPs BART table
(the same table the outbound packet hot path already consults, with
exit-node selection honored), and resolves the matched key back to a
NodeView via the live nodeBackend.

Updates #12542

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Change-Id: I0d4b0d8997c8e796b7367c46b49b61d4fdc717b0
2026-06-23 14:37:15 -07:00
..
bench wgengine/magicsock: restore SetDERPMap signature, add SetDERPMapWithoutReSTUN 2026-04-29 12:46:15 -07:00
filter net/tstun, wgengine/filter: track UDP flow state for injected packets 2026-06-22 15:57:37 -07:00
magicsock wgengine/magicsock: consider VNI as part of peer relay handshake suppression 2026-06-23 13:09:52 -07:00
netlog wgengine/netlog: stop using netmap.NetworkMap type, use LocalBackend 2026-06-17 15:11:57 -07:00
netstack wgengine/netstack: stop inject goroutine from leaking in Impl.Start (#19721) 2026-05-13 08:13:40 -07:00
router wgengine/router/osrouter: skip netfilter add-ons when chain setup fails (#19757) 2026-05-15 09:32:30 -04:00
wgcfg go.mod,wgengine/magicsock: pull wireguard-go fix for roaming endpoints (#20118) 2026-06-12 10:50:35 -07: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
mem_ios.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
pendopen_omit.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
pendopen.go feature/conn25: recreate transit IP mappings when connector loses them 2026-06-17 13:50:51 -04:00
userspace_ext_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
userspace_test.go ipn/ipnlocal: add wireguard session state metrics + publish on IPN bus 2026-06-15 11:41:18 -07:00
userspace.go wgengine, ipn/ipnlocal: route PeerForIP through LocalBackend's live data 2026-06-23 14:37:15 -07:00
wgengine.go wgengine, ipn/ipnlocal: route PeerForIP through LocalBackend's live data 2026-06-23 14:37:15 -07:00