Skip to content

fix: Auto-sense server DTLS 1.2 fallback honors PSK mode#103

Merged
algesten merged 2 commits intomainfrom
fix/100-auto-server-psk-fallback
Apr 23, 2026
Merged

fix: Auto-sense server DTLS 1.2 fallback honors PSK mode#103
algesten merged 2 commits intomainfrom
fix/100-auto-server-psk-fallback

Conversation

@algesten
Copy link
Copy Markdown
Owner

Summary

  • Dtls::new_auto always built a certificate-auth Server12 on DTLS 1.3 to 1.2 fallback, so a PSK server config could not accept DTLS 1.2 PSK clients.
  • Peek at the buffered ClientHello to find the first cipher suite that is allowed by the config, and pick Server12::new_psk or Server12::new to match. Fragmented first-fragments (fragment_offset > 0) are skipped and the next buffered packet is tried.

Fixes #100

Test plan

  • New regression test auto_server_psk_fallback_with_dtls12_psk_client fails on main and passes with the fix.
  • Full suite: cargo test --features rcgen (401 tests pass).
  • cargo clippy --features rcgen clean for the library.

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
@algesten algesten merged commit 83e913f into main Apr 23, 2026
46 checks passed
@algesten algesten deleted the fix/100-auto-server-psk-fallback branch April 23, 2026 14:05
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.

bug: auto-sense server fallback to DTLS 1.2 ignores PSK mode

2 participants