Skip to content

Don't back off on a DTLS 1.3 quick timeout that sends ACKs - #12143

Merged
philljj merged 1 commit into
wolfSSL:masterfrom
Frauschi:dtls13-quick-timeout-fix
Nov 19, 2026
Merged

philljj merged 1 commit into
wolfSSL:masterfrom
Frauschi:dtls13-quick-timeout-fix

Conversation

@Frauschi

@Frauschi Frauschi commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Description

Dtls13RtxTimeout cleared dtls13FastTimeout while sending the pending ACKs and only then checked it, so a quick timeout with ACKs to send took the long-timeout path. While a peer flight arrives in parts, nothing of ours is buffered, so the quick timeout doubled the timeout without retransmitting anything, on top of the doubling at the next full timeout; RFC 9147 5.8.2 doubles only at a retransmission. With a maximum close to the initial timeout, the quick timeout failed the handshake while the peer was still sending.

Changes

  • Dtls13RtxTimeout no longer clears dtls13FastTimeout before sending ACKs, so a quick timeout only sends ACKs.
  • The next full timeout retransmits and backs off as before.

Testing

  • New test_dtls13_quick_timeout_no_backoff: a quick timeout on a partly received client flight sends one ACK and keeps the timeout, the next full timeout backs off, and with the timeout already at its maximum the quick timeout succeeds and the handshake completes. Fails on master.

@Frauschi Frauschi self-assigned this Nov 16, 2026
Copilot AI balanced review requested due to automatic review settings November 16, 2026 14:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are identified for the DTLS 1.3 quick-timeout handling fix.

No open issues 🎉

What changed in this PR

Fixes DTLS 1.3 quick-timeout handling so sending pending ACKs with nothing to retransmit does not increase the timeout or prematurely fail an ongoing handshake.

Changes:

  • Preserves the quick-timeout state before sending ACKs and skips backoff when the retransmission queue is empty.
  • Retains existing behavior for buffered retransmissions and full timeouts.
  • Adds regression coverage for normal and maximum timeout values, subsequent full-timeout backoff, and handshake completion.
File Description
tests/​api/​test_dtls.h Declares and registers the new regression test.
tests/​api/​test_dtls.c Tests quick-timeout handling during a partially received client flight.
src/​dtls13.c Skips backoff for quick timeouts with no buffered retransmissions.

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

zephyr-frdm_rw612

  • FLASH: datas +16 B, log_const_area -8 B, rodata +104 B, text +13,192 B (+4.7%, 295,768 B / 67,108,864 B, total: 0% used)
  • RAM: bss +49 B, datas +16 B (+0.1%, 58,423 B / 983,040 B, total: 6% used)

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #12143

Scan targets checked: wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): tests/api/test_dtls.h
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Max

@Frauschi

Copy link
Copy Markdown
Member Author

Jenkins retest this please

Comment thread src/dtls13.c Resolved

@julek-wolfssl julek-wolfssl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks to me that removing the clearing of ssl->dtls13FastTimeout before SendDtls13Ack is the correct way to handle this instead of the current changes.

Dtls13RtxTimeout cleared dtls13FastTimeout before sending the pending
ACKs and only then checked the flag to decide whether this was the quick
timeout. Whenever ACKs could be sent, the quick timeout took the long
timeout path and doubled the retransmission timeout. While a peer flight
arrives in parts, each quick timeout doubled it with nothing lost on our
side, and with a low maximum the quick timeout could fail the handshake
while the peer was still sending.

Leave the flag set while sending the ACKs, so a quick timeout only sends
ACKs, as it already did when there was nothing to ACK. The next full
timeout retransmits and backs off.
@Frauschi
Frauschi force-pushed the dtls13-quick-timeout-fix branch from 07216e1 to ccb05d6 Compare November 18, 2026 17:51
@Frauschi Frauschi changed the title Don't back off on a DTLS 1.3 quick timeout with nothing to retransmit Don't back off on a DTLS 1.3 quick timeout that sends ACKs Nov 18, 2026
@Frauschi

Copy link
Copy Markdown
Member Author

Agreed, that's simpler. Removed the clear instead of the snapshot and early return, so a quick timeout only sends ACKs and the next full timeout retransmits and backs off. The new test passes unchanged.

@philljj philljj self-assigned this Nov 19, 2026
@philljj
philljj merged commit 895c758 into wolfSSL:master Nov 19, 2026
437 checks passed
@Frauschi
Frauschi deleted the dtls13-quick-timeout-fix branch November 19, 2026 06:24
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.

6 participants