Repository navigation
fix(hip): from_data no longer reads alias before _info is set (#1184) - #1188
Merged
Merged
Conversation
Outside an IPv6 extension chain, HIP.read ends in _decode_next_layer, which builds the protocol chain from self.alias. alias reads self._info.version, but __post_init__ assigns _info only after read returns, so parsing or constructing a standalone HIP header, and HIP.from_data over a parsed one, raised AttributeError. read now sets _info just before decoding the next layer. All 49 HIP headers in options-internet.pcap now rebuild byte for byte through HIP.from_data (49 raised before).
Owner
Author
|
Cross-review verdict on
|
3 of 5 tasks
Contributor
|
Coverage: 88.89% (unit tier, Python 3.14,
Per-file detail: the |
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) — run with the Makefile flags on the touched files: isort clean, mypy clean, pylint no new messagesmake testpasses, and a test case covers the change — the modules listed below only, not the whole suitedocs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible — N/A, added centrallyWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
Closes #1184. Path:
from_data→__post_init__→unpack→HIP.read→Internet._decode_next_layer(internet.py:236) →HIP.alias→self._info, whichProtocol.__post_init__assigns only afterreadreturns.readnow setsself._info = hipjust before decoding the next layer.aliasis unchanged, sincetest_hip_unit.pypins it as reading_info. Standalone HIP parse andmakehit the same error, and are fixed too.Probe over the 49 HIP headers in
options-internet.pcap:HIP.from_data: 49 raise → 0 raise, 49/49 byte-exactIPv6.from_data, merged with fix(ipv6): keep the extension-header chain in from_data rebuilds (#1177) #1182's head55c8ed67ein a scratch branch: 49 raise → 49/49 byte-exactTests: new
tests/protocols/internet/test_hip_from_data_alias_unit.py. Without the fix, all 6 subtests fail with the_infoAttributeError; with it,3 passed, 6 subtests passed. These also pass:test_hip_unit(34), the 5 othertest_hip_*_unitmodules,test_internet_unit,test_option_roundtrip_unit, andtests/project(389 passed, 1 skipped).run_unittest_leg.py protocols/internetreports 475 tests with 0 failures.