Repository navigation
fix: defer PING-only packets too short for header protection - #2869
Merged
ghedo merged 3 commits intoNov 26, 2026
Merged
Conversation
ghedo
reviewed
Nov 12, 2026
ghedo
left a comment
Member
There was a problem hiding this comment.
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.
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
force-pushed
the
fix/defer-short-ping-packets
branch
from
November 23, 2026 18:02
2ec4f16 to
929e3bd
Compare
ghedo
approved these changes
Nov 24, 2026
Contributor
|
/bonk |
|
LGTM! |
jrouviere
approved these changes
Nov 26, 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.
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 reachPAYLOAD_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