Repository navigation
fix(protocols): rebuild a cut standalone header with the values its parse read (#2761) - #2767
Merged
Merged
Conversation
…arse read (#2761) from_data rebuilt a header the capture cut short by reading the header make() built, cut back to the octets captured: its zero-filled Reserved octets, the PadN padding an option area out, a nested schema at full width. The octets matched; the values did not. - Protocol.__post_init__ drops that header, so unpack parses the octets back, except in a payload _make_payload rebuilds, which gives only its octets. - Protocol.unpack parses it as quietly as the made header was read, and gives it the data model's __short_read__ before read. - test-coverage.rst: a round trip reproduces the parsed values too. The new sweep and hand-picked tests fail without the fix; IPv6_Ext's length at cut 1 is recorded as still divergent.
Owner
Author
|
GOOD TO GO at
|
Contributor
|
Coverage: 94.45% (unit tier, Python 3.15,
Per-file detail: the |
JarryShaw
added a commit
that referenced
this pull request
Nov 4, 2026
- #2766 (Fixed): a cut list of plain values ends with the data, where 1.5.x read zero values past the cut (a cut Type 0 Routing header, measured on v1.5.1), into the ListField entry; IGMPv3's sources and the Query's num_sources, into the IGMP entry. - #2767: a cut header rebuilt on its own reads back its parsed values, a regression of the 1.6.0 rebuild path, into the cut-header Fixed entry; the round-trip test rule, into the conventions entry. - #2764: SSLv2, TLS and DTLS records rebuild from their to_dict(), into the TLS/DTLS Added entry, as those classes never shipped. - #2765: the further member reorders and guard rules, into the member-order entry, which records the earlier #2490 reorders. - CHANGELOG.md regenerated; util/changelog_md.py --check passes.
1 of 5 tasks
JarryShaw
added a commit
that referenced
this pull request
Nov 4, 2026
- #2770: 1.5.1's Protocol.__init_subclass__ already registered a subclass as it was defined. The entry names what changed, measured on a v1.5.1 export: an abstract subclass is skipped, where 1.5.x registered it, and a name clash keeps the existing entry and warns, where 1.5.x replaced it and warned that it was overwriting. - #2767: drops "length", since IPv6_Ext's length at cut 1 is still open on #2761. - CHANGELOG.md regenerated; util/changelog_md.py --check passes.
5 tasks done
JarryShaw
added a commit
that referenced
this pull request
Nov 4, 2026
…2761) (#2777) A cut header's rebuild was read at the width make() packs, so an IPv6_Ext cut at one octet, whose length is the width its parse was given, rebuilt with a length of two. - Data: a __short_width__ key, carried by to_dict() and left out of repr and the dumps, records the length the parse read a cut header at. - keep_short_read records it beside __short_read__, from the length each layer base passes on; Protocol.from_data reads the rebuild at it. - It replaces Protocol._uncaptured and _short_of_header: read at its parse's width, the rebuild leaves its next layer the length its parse did. - The #2767 sweep drops its known gap; the IGMPv3 direct-vs-IPv4 tests set the width aside, each read at its own; utilities-or-corekit.rst records the ruling. The new tests fail without the fix; every sample capture rebuilds unchanged.
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— corrects a defectDescription of your pull request and other information
A standalone header cut short rebuilt to exact octets, but
from_data(info).info != info.unpack()kept the header thatmake()had built, soread()returned the valuesmake()filled in past the cut: zeroed Reserved octets, an invented PadN, and nested schemas at full width.Protocol.__post_init__now drops that built header, sounpackparses the captured octets the same way a parse does. A payload rebuilt inside_make_payloadkeeps its built header, since only its octets are used. The re-parse runs with warnings held, and the data model's__short_read__is set afterwards. Only method bodies change.reserved, IPv6-Fragreserved_octet, and HOPOPT/IPv6-Optsoptions. The sweep also found and fixed MHoptionsandmsg_reserved, and IGMPv3length.test-coverage.rst(Round-Trip Invariants) now states the rule.IPv6_Extlengthat cut 1. The data model doesn't record which width the parse was given. A test table records the gap, and fix(protocols): a cut standalone IPv6 extension header rebuilds with values its parse did not read #2761 carries the decision.Part of #2761