Repository navigation
fix(tcp): Quick-Start Response reader reads a stray octet; maker fails below 40 kbps - #1135
Merged
Merged
Conversation
Owner
Author
|
Cross-review verdict on
Merge order: this PR and #1131 both delete neighbouring |
Contributor
|
Coverage: 88.75% (unit tier, Python 3.14,
Per-file detail: the |
…s below 40 kbps - _read_mode_qs read one octet past the option before its length check, so every Quick-Start Response failed with "StructError: unpack: empty buffer". - _make_mode_qs took floor(log2(rate / 40)), negative for rates under 40 kbps, which cannot pack into the 4-bit field. Clamp to N = 0: RFC 4782 Section 3.1 defines N = 0 as a rate of zero, and Section 4.3 lets a response report a lower rate than requested. - Drop the tcp-option/Quick_Start_Response EXPECTED_FAILURES entry, now closed. - Add tests/protocols/transport/test_tcp_quick_start_response_unit.py. Closes #1119
JarryShaw
force-pushed
the
fix/1119-tcp-qs-response
branch
from
October 6, 2026 20:41
fe0471f to
6011af7
Compare
Owner
Author
|
Cross-review verdict on This round reviewed the rebase onto
The round-1 findings still hold. |
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.
make pylint,make mypy,make isort). Ran with the Makefile flags ontcp.pyonly: no new findings. pylint'sW0612 unused-variable 'size'is gone.make testpasses, and a test case covers the change. Not the full suite; the modules run are listed below.docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible — N/A, added centrally after the waveWhat is the purpose of your pull request?
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingchore— anything elseDescription of your pull request and other information
Closes #1119
_read_mode_qscalledself._read_unpack(1)past the option before its length check. That line is removed._make_mode_qsproduced a negative rate code below 40 kbps. It now clamps toN = 0. RFC 4782 §3.1 defines the rate as40 kbps * 2**N, with N=0 meaning a rate of zero. §4.3 allows a response to report a lower rate than requested, so rounding down is valid and nothing is refused.tcp-option/Quick_Start_ResponseEXPECTED_FAILURESentry.make_samplesnow captures the option (257 cases, 7 left out).Probe (rates 0 / 80 / 640 + payload / 20 / 60 kbps):
StructError: unpack: empty buffer×4; at 20 kbpsValueError … b'0000-001'0,80.0,640.0,0,0, each withttl_diff=3,nonce=0x1234Tests: new
tests/protocols/transport/test_tcp_quick_start_response_unit.pycovers wire parsing and round trips, with and without payload, and rate flooring. Without the fix it gives 18 failed. With only the reader fixed, the 3 sub-40 kbps subtests fail. Each module was run in its own process:test_option_roundtrip_unit: 6 passed, 360 subtests passedtest_tcp_udp_unit: 18 passed;test_tcp_runtime: 5 passedtests/project: 379 passed, 1 skipped