Skip to content

fix: defer PING-only packets too short for header protection - #2869

Merged
ghedo merged 3 commits into
cloudflare:masterfrom
bhavyaKhatri2703:fix/defer-short-ping-packets
Nov 26, 2026
Merged

ghedo merged 3 commits into
cloudflare:masterfrom
bhavyaKhatri2703:fix/defer-short-ping-packets

Conversation

@bhavyaKhatri2703

Copy link
Copy Markdown
Contributor

Problem

When the congestion window leaves only 1...3 bytes for the payload, send() can emit a PING-only packet with a 1-byte payload. The padding pass then cannot reach PAYLOAD_MIN_LEN, leaving a packet too short for the 16-byte header-protection sample. The receiver drops it, and the sender later treats it as loss.

Fix

After the cwnd clamp, defer the packet when no frame has been packed yet and left < PAYLOAD_MIN_LEN. The PING remains pending and is sent once cwnd allows a valid padded packet.

Already packed ACK only packets and PTO probes that bypass cwnd are unchanged.

Tests

Added ping_padding_near_full_cwnd, covering CUBIC and Reno across packet number lengths 1...4 and remaining payload budgets 1...4. The 24 cases with 1...3 remaining bytes fail without the guard and pass with it.

Fixes #2835

@bhavyaKhatri2703
bhavyaKhatri2703 requested a review from a team as a code owner November 4, 2026 19:01
@ghedo ghedo added type: bugfix Corrects defective behavior. area: packet Changes related to packet. labels Nov 11, 2026

@ghedo ghedo 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.

The fix is necessary and RFC compliant, but neither the code nor the test is minimal. On master, when cwnd leaves 1 to 3 payload bytes and no ACK is packed, send() can emit a PING-only packet with a 1-byte payload. With 1- or 2-byte packet numbers, that packet is too short for the header-protection sample, so the peer must discard it (RFC 9001 §5.4.2). I reproduced this with CUBIC, Reno and BBR2. Deferring the packet respects RFC 9002 §7, and PTO probes, CONNECTION_CLOSE and ACK-only packets are unaffected. However, the new guard makes an existing check redundant, and the test can shrink to a small change in an existing test.

Comment thread quiche/src/lib.rs Resolved
Comment thread quiche/src/tests.rs Resolved
@ghedo
ghedo enabled auto-merge (squash) November 23, 2026 17:47
Signed-off-by: bhavyaKhatri2703 <khatribhavya2703@gmail.com>
Signed-off-by: bhavyaKhatri2703 <khatribhavya2703@gmail.com>
Signed-off-by: bhavyaKhatri2703 <khatribhavya2703@gmail.com>
@ghedo
ghedo force-pushed the fix/defer-short-ping-packets branch from 2ec4f16 to 929e3bd Compare November 23, 2026 18:02
@jrouviere

Copy link
Copy Markdown
Contributor

/bonk

@ask-bonk

ask-bonk Bot commented Nov 26, 2026

Copy link
Copy Markdown

LGTM!

github run

@ghedo
ghedo merged commit a85e747 into cloudflare:master Nov 26, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: packet Changes related to packet. type: bugfix Corrects defective behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Small PING packets can be emitted without sufficient padding when cwnd is nearly full

3 participants