Repository navigation
fix(protocols): refuse or build what the TCP, HIP and MH makers mishandled (#2708) - #2724
Merged
Merged
Conversation
…and ENCRYPTED, MH CGA parameters (#2708) - TCP: a raw-octets option resolves its kind through _make_index, as a (code, arguments) pair does, so kind 255, which Option.get refuses, builds instead of raising EnumValueError; empty raw octets raise ProtocolError rather than IndexError. - HIP version: IPv6_Ext.__post_init__ defaults version to 6, the IP version, and hands it to make(), which wrote it as the HIP version. HIP.__post_init__ takes version with make()'s default, so HIP(next=59) writes version 2. - HIP ENCRYPTED maker: an IV given with a cipher other than AES-128-CBC and AES-256-CBC raises ProtocolError, instead of counting in Length while the schema drops it. - HIP ENCRYPTED parse: its schema looked for the cipher in a packet['options'] no parse sets, so it warned of a missing HIP_CIPHER and read an AES IV as data. HIP_CIPHER now records its cipher IDs in the context the area's parameters share, and ENCRYPTED reads the Nth of them. - MH _make_opt_cga_param: the annotation drops dict[str, Any], which the maker always refused; the docstring documents the refusal. - Tests: one module per family that fails on the base; the HIP version pin in test_protocol_make_unit and the HIP tests that passed a stray IV or drove the old cipher lookup are updated.
Owner
Author
|
GOOD TO GO at
|
Merged
5 tasks done
JarryShaw
added a commit
that referenced
this pull request
Nov 3, 2026
…s.pickle, FRAD's pad and the TCP and HIP maker fixes into 1.6.0 (#2449) - Breaking: a fixed-size octet field given any other width raises, where 1.5.x padded or cut it, and IPv4's Timestamp option refuses a slot count past what it holds, where 1.5.x cut it (#2691); folded into the IPv4 to HIP makers' range-check entry, with the ZigBee keys into the PCAP-NG entry. Old values measured against v1.5.1. - Added: pcapkit.utilities.pickle, whose ReduceAsProtocol2 lets Info, Schema and the reassembly engines pickle under protocols 0 and 1 on GraalPy, and numbers._reduce_unregistered_member's removal (#2722). - Fixed: TCP's raw-octet options, HIP's default version, HIP's ENCRYPTED IV and its cipher on parse (#2724). - Folded into unreleased entries: FRAD's pad field and make(pad=) (#2721). - No entry for the docstring-only 596dcfa, the test-only 149cced, or #2724's MH annotation. - 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 defectThis fixes small
make()defects in TCP, HIP and MH found while reviewing #2692, plus a HIP parse defect found while fixing them._make_index, the same call the pair form uses. An unassigned kind such as 255 builds instead of raisingEnumValueError. An empty raw item raisesProtocolErrorrather thanIndexError.HIP(next=59, parameters=[])wrote version 6.IPv6_Ext.__post_init__defaultsversionto the IP version, and that default reached HIP'smake().HIP.__post_init__now defaults it to 2, as RFC 7401 §5.1 gives.read()still ignores the enclosing layer's version.ENCRYPTED: an IV given with a cipher that uses none is refused, through both the keyword and the data-model paths.ENCRYPTEDon parse: it never found theHIP_CIPHERbefore it. It warned, read the cipher as 0xFFFF and took the IV as data, becauseOptionField.unpackhands every parameter one shared dict and never fillsoptions.HIP_CIPHERnow records its IDs in that context, and eachENCRYPTEDtakes the next one._make_opt_cga_param:dictis dropped from the annotation and the refusal is documented, matching what the maker already did.The new tests fail on
main. Every parsed TCP option and every HIP cipher id rebuilds byte-exactly.Closes #2708