Repository navigation
fix(protocols): understated __length_hint__ and an unguarded next-layer import still fabricate octets - #1176
Merged
Merged
Conversation
…er import still fabricate octets IPv6_Route hinted 4 octets and MH 6, though both headers are at least 8 (RFC 8200 section 4.4, RFC 6275 section 6.1.1), so _parse_next_layer parsed a 4-7 or 6-7 octet stream and rebuilt a full 8-octet header. HOPOPT and IPv6_Opts hinted 2 for the same 8-octet minimum (RFC 8200 sections 4.3 and 4.6). All four now hint 8. The two tests that pinned the old hints now pin 8. Application payloads already reach _parse_next_layer through ProtocolBase._import_next_layer, so application.py is unchanged; the new test pins that route.
Contributor
|
Coverage: 88.89% (unit tier, Python 3.14,
Per-file detail: the |
Owner
Author
|
Cross-review verdict on
Two follow-ups, both reproduced on |
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) — mypy on the 4 source files 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 testdocs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible — N/A, added centrally after the waveWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
Closes #1173.
IPv6_Route(4),MH(6),HOPOPTandIPv6_Opts(2) now hint 8, their minimum header (RFC 8200 §4.4/§4.3/§4.6, RFC 6275 §6.1.1).ApplicationBase._import_next_layeralready reaches_parse_next_layerthroughsuper(), so it is unchanged; a test pins that route.IPv6_Route, 4–7 octetsIPv6-Route, rebuilds 8Raw, rebuilds 4–7MH, 6–7 octetsMH, rebuilds 8Raw, rebuilds 6–7HOPOPT/IPv6_Optswere not fabricating (short streams already fail to parse), so their change is for correctness only.test_ipv6_extension_unitandtest_mh_unitpinned the old hints and now pin 8.from_datasweep overexamples/captures/(1612 frames) is the same before and after: IPv4 0/0, UDP 0/0, TCP 0/0, IPv6 0 / 183 (pre-existing), with byte-identical layer chains.Tests: the new
test_length_hint_minimum_header_unit.pygives 4 passed; without the fix, 10 subtests fail. ipv6_extension 61, mh 52, ipv6_ext 30, next_layer_short_header 7, ospf 3, option_roundtrip 6,tests/project389 passed / 1 skipped. Ordering legs:protocols (rest)838, 0F/0E before and after;protocols/internet468 → 472, 0F/0E.