Repository navigation
fix(protocols): cut a rebuilt short read back before it is read and verified (#2703) - #2712
Merged
Merged
Conversation
…erified (#2703) Every layer base rebuilt a header the capture cut short at full width, the missing octets as zeros, parsed and verified that, and only then let replay_short_read cut it back. A layer verifying during its parse read the zero-filled checksum INVALID and warned, where its capture read TRUNCATED. - Protocol.from_data hands the data model's __short_read__ to the construction, as it does __reconstructing__. - Protocol.pack cuts the header it makes back through the schema's own record and Schema._cut_short_read, and __post_init__ reads the octets captured at the width the header declares, as a capture is read at its parent's. GRE, ICMP, IGMPv1/v2/v3 and OSPF then read TRUNCATED from the same checks their capture used, with no verifier changed; replay_short_read finds the rebuild already cut. test_short_read_rebuild_quiet_2703_unit fails without the fix, and pins that the instance keeps no __short_read__ once from_data returns or raises. The internet, link, transport, application, misc, schema and root protocols modules, both schema round trips and the project guards pass. Closes #2703
Owner
Author
|
GOOD TO GO at
|
This was referenced Nov 3, 2026
JarryShaw
added a commit
that referenced
this pull request
Nov 3, 2026
… helpers, MH options 6 and 27, the cut SCTP and option-area schemas and dict-built secrets into 1.6.0 (#2449) - Breaking: a make() enumeration field takes a member or an int, its X_default/X_namespace/X_reversed keywords removed with no alias, and names, wide codes and wide option codes are refused (#2692); the schema helpers move to pcapkit.corekit.schema and pcapkit.corekit.fields.byteorder is removed (#2704); MobileNetworkPrefixOption gains prefix_length and keeps an IPv6Address prefix, and TimestampOption's timestamp is None past 9999 (#2709). Folded into the MH data-model entry; old values measured against v1.5.1. - Fixed: the SCTP schema cut inside its padding and a header schema cut inside an option area pack back as captured (#2682), into the SCTP entry; a Decryption Secrets Block rebuilds from its dict as captured (#2707), into the DSB entry. - Folded into unreleased entries: FRAD's Q.922 address refusal and quiet cut rebuild (#2719); a from_data rebuild's checksum status (#2712); a failed ListField fill's ledger (#2706); pad_length's path (#2704); TLS's enumeration fields (#2692); the make() and schema-helper rulings, into the conventions entry (#2692, #2704); the GraalPy shards, into the CI-legs entry (#2720). - 1.5.0's corekit.fields.byteorder role points at corekit.schema.byteorder, where #2704 moved it, so the nitpicky build does not warn on it; 1.5.0's text unchanged. - No entry for the test-only 72b2bd8 (#2715), or the docs-and-test-only 0c07940 (#2718). - 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 defectDescription of your pull request and other information
A layer rebuilt by
from_datafrom a cut capture rebuilt the right octets, but verified before its short read was replayed. GRE, ICMP, IGMP and OSPF therefore read INVALID and raised a falseChecksumWarning. The cause was on the shared path: each layer base replays the record only after the full-width, zero-filled rebuild has been parsed.The fix is in
Protocol, one level below the layer bases:from_datahands the data's__short_read__record to the construction for that call, as it does__reconstructing__.packcuts the header it makes back withSchema._cut_short_read.__post_init__givesreadthe captured octets at the declared width, as a parse inside a capture already does.Each verifier then reads TRUNCATED through its existing check, with no per-protocol code.
replay_short_readand the layer bases are unchanged.For every cut that leaves a record,
from_data(info)andfrom_data(info.to_dict())give back the captured octets and checksum status and log nothing. This holds for directly built GRE, IGMPv1/v2/v3 and OSPF, and for ICMP and IGMPv3 read from a cut savefile. The tests fail onmain, with whole and wrong-checksum messages as controls.Closes #2703