Repository navigation
fix(corekit): read a capture cut inside an option area as a short read (#2694) - #2731
Merged
Merged
Conversation
#2694) Under the #1325 guards OptionField.unpack refused a capture cut landing in front of or inside an option area: "consumed no data", a FieldValueError logged at CRITICAL and again by beholder inside IPv6, or "runs past the end of the data". So MH(cut) raised for a cut inside its options or an LRI or UPA message's reserved octets, and HOPOPT cut to 2 or 3 octets logged. - OptionField.unpack: where the data ends short of the area, the list ends with the data, and an option it ends inside stands if its fields fit the area, so Schema.unpack records the cut. One past its area is still refused. A new _accepts_cut hook decides; PCAP-NG's OptionAreaField declines it. - IPv6 tells each header it walks, as __capture_cut__ in its packet, whether the octets handed fall short of the Payload Length left. Where they do not, an option area the data ends inside runs past the Payload Length and is refused, so such a header stays Raw, quietly. - MH, HOPOPT and IPv6-Opts keep a cut option only if its parser takes the zeros and its maker writes the captured octets back, else refuse it quietly. HOPOPT and IPv6-Opts read a cut header as its short read; their make() takes len, the Hdr Ext Len a cut header declared. IP_Pseudo stops its walk at a cut header. - MH: a fixed-width item list a length leaves part of an item in, as an odd Flow Summary option, is a ProtocolError rather than a logged FieldValueError. - The short-read ruling is on the utilities-or-corekit conventions page. - Tests cover every MH type, HOPOPT and IPv6-Opts at every cut, alone and in IPv6, both sides of the Payload Length, and the quiet refusals; pins of the old refusals, #2477's and the LRI/UPA ones of #2676's test among them, follow the short read. The new tests fail on 01f0634. protocols, corekit and project pass module by module. Closes #2694
Owner
Author
|
GOOD TO GO at
|
JarryShaw
added a commit
that referenced
this pull request
Nov 3, 2026
- Breaking: FrameRecord is an Info and TLSKeyLog.entries a TLSKeyLogEntries data model, not dicts (#2734); a new entry with 1.5.1's behaviour, and pickles checked loading both ways. - Fixed: MH's CGA Parameters maker builds a data model's raw extension and a schema without public_key_test (#2732), into the makers' Fixed entry. - Fixed: a capture cut inside or in front of an option area reads as a short read in MH, HOPOPT and IPv6-Opts, and an odd item list raises ProtocolError (#2731, ab7be2f, which the merge of 07ceaf7 also brings in); the short-read ruling into the conventions entry. - Old values measured against v1.5.1. - 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 defectA capture cut inside or before an option area was refused, sometimes loudly, where it should have been read as a short read.
OptionField.unpack: a cut inside the area now parses as a recorded short read throughSchema's built-in, and an option whose fields run past its area is still refused (fix(protocols): a declared length running past the data is accepted and zero-filled on rebuild #1325). A new_accepts_cuthook lets PCAP-NG keep its cut area raw.item_list_lengthcallback.make(len=)rebuilds the declared Hdr Ext Len.__capture_cut__. A header that runs past a declared Payload Length stays quietRaw, as onmain.IP_Pseudostops at a cut header.utilities-or-corekit.rst.The new tests fail on
main. The CALIPSO, SMF_DPD and MPL type-octet-only cut is #2727.Closes #2694