fix: handle fragmented ClientHello in auto-sense server#87
Merged
Conversation
Collaborator
Author
|
Fixes #88 |
501cb22 to
e09a4bc
Compare
Firefox 148+ sends X25519MLKEM768 as its primary key_share, making the ClientHello too large for a single DTLS record. The supported_versions extension ends up in a later fragment, causing the auto-sense server to miss it and fall back to DTLS 1.2. Replace the lightweight packet-sniffing version detection (ServerPending) with a design that uses Server13 directly in auto mode. The DTLS 1.3 engine handles fragment reassembly natively. After reassembling the complete ClientHello: - If supported_versions contains DTLS 1.3: proceed as 1.3 (zero overhead) - If not: return Error::Dtls12Fallback, create Server12, replay packets Changes: - Add Error::Dtls12Fallback variant - Add auto_mode + auto_packets to Server13 - Remove ServerPending from Inner enum and detect.rs - new_auto() creates Server13::new_auto(), falls back to Server12 on Dtls12Fallback or ParseError - Server13 buffers raw packets during AwaitClientHello, frees on commit - 47 new tests: server_fallback (15) + cross_matrix (32) covering all version combinations at normal/fragmented/heavy MTU
e09a4bc to
6e819be
Compare
algesten
approved these changes
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Firefox 148+ sends X25519MLKEM768 as its primary key_share, making the ClientHello too large for a single DTLS record. The supported_versions extension ends up in a later fragment, causing the auto-sense server to miss it and fall back to DTLS 1.2.
Replace the lightweight packet-sniffing version detection (ServerPending) with a design that uses Server13 directly in auto mode. The DTLS 1.3 engine handles fragment reassembly natively. After reassembling the complete ClientHello:
Changes: