Skip to content

dataplane: split out derp and stun traffic#237

Open
npry wants to merge 3 commits into
mainfrom
npry/dataplane.split_traffic
Open

dataplane: split out derp and stun traffic#237
npry wants to merge 3 commits into
mainfrom
npry/dataplane.split_traffic

Conversation

@npry

@npry npry commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

stacked on #214

Port packet identification logic from Go (wireguard vs disco vs stun), begin partitioning incoming packet stream by type. This isn't used in runtime yet — that integration depends on a bunch of other changes I made here so I'm holding off on PRing that until this round of changes merges.

This also eliminates the requirement for underlay transports to supply a peer id, as this is in general unnecessary since packets must cryptographically authenticate themselves anyway, and it will simplify implementation for the UDP transport. Peer ids are still required to route to a peer.

Base automatically changed from npry/netmon to main June 13, 2026 10:30
@npry npry force-pushed the npry/dataplane.split_traffic branch from 610a0ad to 5799dc4 Compare June 13, 2026 10:34
npry added 3 commits June 15, 2026 03:30
The peer id isn't actually known a priori from the underlay, even if
some transports can give an indication of what they think it is (such as
derp reporting the nodekey). Ultimately the only way the peer identity
can be trusted is if it's cryptographically authenticated by data within
the packet, which WireGuard derives from the ongoing session (identified
by the session id field), and disco gets from the disco pubkey field in
its header. STUN packets are unverified but don't require any association
to the peer's id.

Removing this requirement will simplify the architecture for the UDP
direct transport in future commits.

Signed-off-by: Nathan Perry <nathan@tailscale.com>
Change-Id: Ib3fe81d7f41fbd6e3b637f282b51f4f96a6a6964
Currently, receipt of a disco or stun packet causes the dataplane to
log errors because it doesn't understand the traffic and tries to treat
it as WireGuard. This provides comparable logic to
`wgengine/magicsock.go`'s packet identification. It is plumbed into the
dataplane in a future commit.

Signed-off-by: Nathan Perry <nathan@tailscale.com>
Change-Id: I87e84518ed0adbe4ba35358cab0a3dc66a6a6964
Signed-off-by: Nathan Perry <nathan@tailscale.com>
Change-Id: Ibf7d20ff1a3ab10e1277e78179285eb46a6a6964
@npry npry force-pushed the npry/dataplane.split_traffic branch from 5799dc4 to aedd011 Compare June 15, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant