Repository navigation
Conversation
…rt read (#2727) In HOPOPT and IPv6-Opts, a capture cut leaving only the type octet of a CALIPSO, SMF_DPD or MPL option logged "FieldValueError: ... invalid <X> option length: 0", at CRITICAL and again by beholder inside IPv6: the callbacks sizing the option refused the zero the cut left for Opt Data Len, before the short read could record the cut. - Schema.unpack gives the fields after the one the data ends inside the short read, as __short_read__ in their packet, a forward match included, and clears it as each unpack starts, so a nested schema finds only its own. - calipso_pad_len, mpl_opt_pad_len, smf_i_dpd_id_len and smf_dpd_data_selector leave an Opt Data Len the data ends before to the short read. #2694's rule then keeps CALIPSO and SMF_DPD, and refuses MPL quietly, as its parser refuses the zero, as Router Alert's does. - An Opt Data Len on the wire too short raises ProtocolError, not FieldValueError, so a header refused for it is refused quietly. The four helpers' documented Raises class moves: the breaking change. - Schema._note_short_read takes packet as an optional argument, so a caller with none keeps the record on the schema alone. - The utilities-or-corekit page says how a callback tells a cut. - Tests sweep every option of both headers at every cut, alone and in IPv6; the pins of the FieldValueError move to ProtocolError. The new tests fail on ab7be2f. protocols, corekit and project pass module by module.
Owner
Author
|
GOOD TO GO at
|
Open
5 tasks done
Contributor
|
Coverage: 94.45% (unit tier, Python 3.15,
Per-file detail: the |
This branch has not been deployed
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 that left only the type octet of a CALIPSO, SMF_DPD or MPL option, in HOPOPT or IPv6-Opts, logged a
FieldValueError, at CRITICAL inside IPv6. The option's length callback rejected the zero-filled length.Schema.unpackhands the fields after a cut the record of where the data ended, aspacket['__short_read__']. The record is popped at the start of each unpack, so it never leaks between siblings or packets.Schema._note_short_readtakes the packet as an optional argument.ipv6_option.pydefer only when that record shows the data ended before the length field. Nothing is clamped. CALIPSO and SMF_DPD then read as a recorded short read and rebuild byte-exactly throughinfoandto_dict(). MPL is refused quietly, because its parser rejects a length under 2, as fix(corekit): a capture cut inside an option area is refused, and loudly, instead of a short read #2694 pins for Router Alert.ProtocolErrorwhere 1.5.1 raisedFieldValueError. The two are siblings underBaseErrorandValueError. Inside IPv6 such a header becomes quietRawinstead of logging CRITICAL.The new tests fail on
main. A trial merge with #2711's commit passes both sides' new tests.Closes #2727