Repository navigation
fix(internet): rebuild a whole extension header in the extension mode its parse used (#2768) - #2774
Merged
Merged
Conversation
… its parse used (#2768) Parsed with extension=True, as IPv6 parses each header of its chain, every extension header but ESP holds no next layer, yet from_data(info) rebuilt it without extension, so its info gained __next_type__, __next_name__ and nopayload. Internet.from_data now rebuilds an IPv6_Ext subclass whose data model holds no next layer with extension, unless the caller passes it. Shim6's protocol, which IPv6_Ext.read takes from the parse-only alias keyword, is left for a decision on how a rebuild may pass that keyword. Tests: test_ipv6_exthdr_extension_rebuild_2768_unit covers every member, standalone and from IPv6's __exthdr__, through info and to_dict().
…as keyword (#2768) IPv6_Ext.read takes Shim6's protocol from the alias keyword, which a from_data rebuild never passed, so the rebuilt protocol was None. IPv6_Ext._make_data now returns alias=data.protocol, and IPv6_Ext lists alias in __keywords__ so the construction check lets it through. Every member accepts and drops alias, as it does while parsing. Tests: the #2768 module adds the Shim6 alias and in-IPv6 cases, asserts no construction-keyword warning on rebuild, and pins a member dropping alias.
Owner
Author
|
GOOD TO GO at
|
JarryShaw
added a commit
that referenced
this pull request
Nov 4, 2026
- Fixed, a new entry beside the cut-header one: a whole header rebuilt through from_data reads back what its parse read. An extension header parsed with extension=True rebuilds in that mode, where 1.5.x's rebuild gained next-layer keys, and a rebuilt Shim6 header keeps its protocol, where 1.5.x's was None (#2774); a rebuilt or made TCP header reads its padding past the End of Option List, where 1.5.x read it as empty (#2775). Both measured on a v1.5.1 export. - 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— corrects a defectDescription of your pull request and other information
A whole extension header parsed with
extension=Truereturns before it decodes a next layer, so its info has no__next_type__.from_datadidn't passextensionon to the rebuild, so the rebuild decoded a next layer and gained__next_type__,__next_name__andnopayload.Internet.from_data, which every extension header inherits, now setsextension=Truefor anIPv6_Extsubclass whose data model has no__next_type__, unless the caller passes it. This is the same wayfrom_dataalready reads_short_of_headerfrom the data model. Only a method body changes.__exthdr__, frominfoand fromto_dict(). ESP was already exact.IPv6_Extdeclares__keywords__ = frozenset({'alias'})and_make_datahandsaliasback, so a rebuilt Shim6 keeps itsprotocolstandalone and in IPv6. Subclasses accept and dropalias.Closes #2768