Repository navigation
DTLS 1.3: resend HelloRetryRequest on a stateful server - #12224
mattia-moffa wants to merge 3 commits into
Conversation
With the HRR cookie disabled the server kept no copy of the HRR, so when it was lost the retransmitted ClientHello was simply answered with an ACK and the handshake stalled until the client gave up. This buffers the HRR when on a stateful (no-cookie) server, flushes the ACK list when sending it and clears it from the buffer once the next ClientHello arrives. Fixes wolfSSL#12136
|
retest this please |
There was a problem hiding this comment.
🟡 Changes recommended
Duplicate ClientHellos still trigger ACKs while an HRR is buffered, potentially stalling the handshake if both HRR transmissions are lost; ACK suppression and regression coverage for this loss scenario are needed.
1 open issue
What changed in this PR
Addresses #12136 by enabling stateful DTLS 1.3 servers with HRR cookies disabled to retain and retransmit a lost HelloRetryRequest.
Changes:
- Buffers stateful HRRs, clears pending ACKs when sending them, and clears retransmission buffers when the next ClientHello arrives.
- Adds loss-recovery tests for cookie-enabled servers and stateful servers using client- or server-triggered retransmission.
- Extends test helpers to recognize HRRs in both TLS and DTLS records.
| File | Description |
|---|---|
tests/utils.h |
Declares the raw-record HRR detection helper. |
tests/utils.c |
Adds DTLS-aware HRR detection and reuses it in the existing helper. |
tests/api/test_dtls.h |
Declares and registers the HRR loss test. |
tests/api/test_dtls.c |
Tests HRR loss recovery, buffer cleanup, and subsequent data exchange. |
src/dtls13.c |
Updates HRR buffering, ACK cleanup, and next-flight buffer clearing. |
Review effort: Balanced
| handshakeType == hello_retry_request) | ||
| Dtls13RtxFlushAcks(ssl); |
There was a problem hiding this comment.
a duplicate ClientHello still schedules an ACK before the buffered HRR is resent. If the ACK arrives but both the original and retransmitted HRR are lost, the client stops retransmitting its ClientHello
This part is true
so a server relying on client retransmissions stalls again
This part is not. The server's timer will fire and cause a retransmission of the HelloRetryRequest. A non-blocking server that never calls wolfSSL_dtls_got_timeout will stall, but it will also stall on ServerHello, so it would be a problematic server anyway.
I added a test to check that the server's timer recovers the handshake in this case.
Sending an ACK followed by a HelloRetryRequest is superfluous but not really a problem. Suppressing the ACK only while an HelloRetryRequest is buffered would be possible, but a bit of a hack, since the server currently ACKs every duplicate message during the handshake anyway, e.g. a duplicate ClientHello while ServerHello is buffered for retransmission.
|
|
Jenkins retest this please |
rizlik
left a comment
There was a problem hiding this comment.
Great work, thanks.
Optional: add a test case with a fragmented CH1, using cookie off.
39d3b89 to
f76617e
Compare

Description
With the HRR cookie disabled the server kept no copy of the HRR, so when it was lost the retransmitted ClientHello was simply answered with an ACK and the handshake stalled until the client gave up.
This buffers the HRR when on a stateful (no-cookie) server, flushes the ACK list when sending it and clears it from the buffer once the next ClientHello arrives.
Fixes #12136
Testing
Checklist