Skip to content

dataplane/packet_ident: support identifying stun - #433

Merged
npry merged 3 commits into
mainfrom
npry/packet_ident.stun
Sep 24, 2026
Merged

npry merged 3 commits into
mainfrom
npry/packet_ident.stun

Conversation

@npry

@npry npry commented Sep 23, 2026

Copy link
Copy Markdown
Member

Implement heuristics for identifying STUN packets, primarily based on the magic value. These weren't provided before, so incoming STUN traffic had been treated as WireGuard.

@npry
npry added this pull request to stack #435 September 23, 2026 19:22

@dylan-tailscale dylan-tailscale left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, one non-blocking suggestion

Comment thread ts_dataplane/src/packet_ident.rs
@npry
npry force-pushed the npry/packet_ident.stun branch 2 times, most recently from 3a9a455 to ef04bb1 Compare September 23, 2026 20:34
These were separate to enforce strict dependence netstack -> netsock ->
netcore (and allow incremental inclusion of deps). I no longer think it's
worth the crate bloat to do this -- there isn't much of a cost. In the
event anyone wants _just_ netcore, that's still accessible. The top-level
crate is `#![no_std]` and doesn't pull in tokio or anything heavy unless
you feature flag it in, so it seems fine to do this.

Signed-off-by: Nathan Perry <nathan@tailscale.com>
Change-Id: I9b559af57ee4d6f94c8ebad0d2f164c76a6a6964
@npry
npry force-pushed the npry/packet_ident.stun branch from ef04bb1 to 0d87cea Compare September 24, 2026 07:31
Wrappers to take `FnOnce` and convert it to `Fn` or `FnMut` by runtime-
checking that the function is only ever called once and panicking
otherwise. This is needed in a number of cases where we know but would
have a hard time proving to rustc that the function is indeed called
at most once.

Signed-off-by: Nathan Perry <nathan@tailscale.com>
Change-Id: I6093e8428891cf9cebb513338820f26b6a6a6964
Implement heuristics for identifying STUN packets, primarily based on
the magic value. These weren't provided before, so incoming STUN traffic
had been treated as WireGuard.

Signed-off-by: Nathan Perry <nathan@tailscale.com>
Change-Id: If0b13f3ae89ff3c30d74d68f595e072c6a6a6964
@npry
npry force-pushed the npry/packet_ident.stun branch from 0d87cea to ede063f Compare September 24, 2026 07:32
@npry
npry merged commit ede063f into main Sep 24, 2026
23 checks passed
@npry
npry deleted the npry/packet_ident.stun branch September 24, 2026 19:10
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.

2 participants