Repository navigation
fix(hip): make() without parameters writes Header Length 0, below the RFC 7401 minimum of 4 - #1191
Merged
Merged
Conversation
… RFC 7401 minimum of 4 - make(): a parameterless header now writes Header Length 4, which covers the two 16-octet HITs (RFC 7401 §5.1), so it is 40 octets and parses back. - read(): reject a wire Header Length below 4 up front, instead of passing a negative parameter length to _read_hip_param. - test_hip_unit: update the assertion that pinned the old length of 0. Closes #1189
Owner
Author
|
Cross-review verdict on
|
Contributor
|
Coverage: 88.90% (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.
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort) — not run in full; isort clean on the new test, mypy shows no errors on the changed linesmake testpasses, and a test case covers the change — only the modules listed belowAdded a changelog entry — N/A, added centrally
fix— corrects a defectCloses #1189
make(parameters=None)now writes Header Length 4 (the two HITs, RFC 7401 §5.1).read()rejects a wire length below 4, because_prml = (len - 4) * 8would be negative but still truthy. The parameters-present path (total // 8 + 4) was already correct.test_hip_unit.py:229pinned the old0and now expects4.Probe, HIPv1 and HIPv2: before,
ProtocolError: HIPv{1,2}: invalid format. After, 40 octets, length byte 4, and it parses back toinfo.length == 40.New
tests/protocols/internet/test_hip_parameterless_length_unit.py: 3 passed. With themakefix reverted, 4 subtests fail. With thereadguard reverted, 2 subtests fail.Each
test_hip_*module andtest_option_roundtrip_unit.pypass.tests/project: 389 passed, 1 skipped.run_unittest_leg.py protocols/internet: 487 tests, 0 failures.