Repository navigation
fix(ipv6-ext): raise the fallback length hint to the RFC 8200 minimum (#1178) - #1181
Merged
Merged
Conversation
…#1178) IPv6_Ext.__length_hint__ returned 2, the octets RFC 6564 §4 fixes rather than the shortest header it allows. Hdr Ext Len excludes the first 8 octets, and RFC 8200 §4 makes every extension header a multiple of 8, so the hint is now 8. A 2-7 octet tail of a longer declared payload becomes Raw and rebuilds exactly instead of an 8-octet header partly filled with uncaptured octets. - update the pin, renamed test_length_hint_is_the_eight_octet_rfc_6564_minimum - new test_ipv6_ext_hint_unit: 2-7 octets are Raw, 8 and 16 still parse Closes #1178
Owner
Author
|
Cross-review verdict on
|
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.
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort) — mypy onipv6_ext.py, isort and pylint E/W on the new test only; no new messages, but not the fullmaketargetsmake testpasses, and a test case covers the change — per module only, listed below; not the fullmake testAdded a changelog entry under
docs/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 #1178 (option 2).
IPv6_Ext.__length_hint__is now 8: RFC 6564 §4's Hdr Ext Len excludes the first 8 octets, and RFC 8200 §4 makes headers multiples of 8. All 8 subclasses (AH 20, HIP 40, ESP/HOPOPT/IPv6_Frag/IPv6_Opts/IPv6_Route/MH 8) define their own hint, so none inherits it._parse_next_layer(IPv6_Ext, tail, 300), alias absent/200/Shim6/HOPOPTIPv6_Ext, length 8Raw, rebuilds the tail exactlyIPv6_ExtThe
IPv6chain walk hands each header its captured slice, so it never met this guard; itsinfofor HOPOPT/Shim6/Opts/Route tails of 2–16 octets is identical before and after.Tests: new
test_ipv6_ext_hint_unit.py2 passed / 32 subtests; with the hint reverted to 2, 24 subtests fail. The pin is renamedtest_length_hint_is_the_eight_octet_rfc_6564_minimum. ipv6_ext 30, ipv6_extension 61, length_hint_minimum_header 4, next_layer_short_header 7, option_roundtrip 6,tests/project389 passed / 1 skipped. Ordering legprotocols/internet: 474 tests, 0F/0E.