Repository navigation
fix(protocols)!: refuse Quick-Start values their fields cannot carry - #2630
Merged
Merged
Conversation
…2617) - Move the RFC 4782 rate codec into a ProtocolBase reader/maker pair, _read_qs_rate and _make_qs_rate, called by IPv4, HOPOPT, IPv6-Opts and TCP in place of their own copies. - Raise ProtocolError for a rate other than 0 or 80..2621439 kbps, and, via _make_uint, for a TTL, nonce or reserved value outside its bits, where the makers clamped or wrapped them, wrote reserved bits into the nonce, or raised ValueError, OverflowError or FieldValueError. - HOPOPT and IPv6-Opts make an unassigned QS function as an unassigned option, the form their readers keep one in, as IPv4 does. - Tests: the codec, every refusal, and make -> parse and parse -> rebuild for every rate code; TCP's clamp pin becomes a refusal.
Owner
Author
|
GOOD TO GO at |
JarryShaw
added a commit
that referenced
this pull request
Nov 2, 2026
…in the constants sweep (#2617) #2630 added ProtocolBase._read_qs_rate and _make_qs_rate. Their literals are RFC 4782 section 3.1's rate unit, K = 40 kbps, and the 2 ** 16 bound the four-bit rate code cannot reach, which the sweep read as copies of IPV6_HEADER_LEN and RECORD_HEADER_LEN. Four NOT_A_COPY entries say why. test_rfc_constants_one_home_1739_unit.py and test_conventions_doc_claims.py pass.
JarryShaw
added a commit
that referenced
this pull request
Nov 2, 2026
…types and the registry split into 1.6.0 (#2449) - Breaking: Quick-Start values their fields cannot carry raise, reversing 1.5.0's round-down of a TCP rate under 80 kbps (#2630). - Folded into unreleased entries: tls12_cid records and DTLSContext (#2631), LinkType 105 and 127 in Frame and PCAP-NG (#2632), and DTLS.analyze_handshake behind dtls_handshake and packet (#2634). - Changed: foundation.registry.protocols split into per-layer submodules (#2635); 1.6.0's register_* roles and 1.5.0's three register_protocol* roles point at their submodules, 1.5.0's text unchanged. - The conventions entry records the per-layer wrapper placement (#2635) and parse ownership (#2634). No entry for #2629, which changes no released behaviour. - CHANGELOG.md regenerated; util/changelog_md.py --check passes.
1 of 5 tasks
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)make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
fix— a bug fixDescription of your pull request and other information
The Quick-Start rate codec, which had four makers and seven readers that disagreed, becomes one pair on
ProtocolBase:_read_qs_ratebefore_make_qs_rate. IPv4, HOPOPT, IPv6_Opts and TCP all use it. Per the owner's ruling on #2617, a rate the field cannot carry raisesProtocolErroreverywhere, so there is no clamp. The valid range is 0, or 80 to 2,621,439 kbps. HOPOPT and IPv6_Opts gain the unassigned-function maker that IPv4 has, so every reader has a maker. Each pair round-trips both ways. TTL, nonce and reserved are range-checked through_make_uintas well.Valid input builds the same bytes as before: every rate from 0 to 3,000,000, all 1,024 parse cases, and all 23 captures. Rates between two codes still round down, as on
main; for example, 100 becomes 80. A few tests pin behaviourmainalready had, so they pass there by design:RoundTripTests, the past-four-bits refusal, the bounds builds, the Report TTL and TTL Diff.Breaking: these inputs built packets in 1.5.x and now raise:
1.5.0.rstrecords for fix(tcp): Quick-Start Response reader reads a stray octet; maker fails below 40 kbps #1119;Truefor TTL, nonce or reserved.A Sonnet cross-review checked the codec against RFC 4782 and returned GOOD TO GO. Its findings are folded in.
Closes #2617