fix: Auto-sense server DTLS 1.2 fallback honors PSK mode#103
Merged
Conversation
An auto-sense server falling back from DTLS 1.3 to DTLS 1.2 unconditionally constructed a certificate-auth Server12, so a server built with `Dtls::new_auto` and `with_psk_server(...)` rejected DTLS 1.2 PSK clients with "No mutually acceptable cipher suite". Peek at the buffered ClientHello to mirror the suite Server12 would pick and construct the matching auth mode before replay. Fixes #100
xnorpx
approved these changes
Apr 23, 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.
Summary
Dtls::new_autoalways built a certificate-authServer12on DTLS 1.3 to 1.2 fallback, so a PSK server config could not accept DTLS 1.2 PSK clients.Server12::new_pskorServer12::newto match. Fragmented first-fragments (fragment_offset > 0) are skipped and the next buffered packet is tried.Fixes #100
Test plan
auto_server_psk_fallback_with_dtls12_psk_clientfails onmainand passes with the fix.cargo test --features rcgen(401 tests pass).cargo clippy --features rcgenclean for the library.