Repository navigation
fix(internet): read a checksum behind a cut TSO IPv4 as truncated (#2689) - #2699
Conversation
|
GOOD TO GO at Two small follow-ups go into this PR: |
) - IPv4 Total Length 0 (TSO): the payload runs to the end of the frame, but `Internet._decode_next_layer` cleared `frame_length` regardless, so GRE, ICMP and IGMP summed the captured octets of a snaplen-cut frame and read INVALID with a false `ChecksumWarning`. `_decode_next_layer` gains `declared`; `IPv4.read` passes false for a Total Length of 0 and AH always does, since its payload is the rest of its parent's. Every other Internet layer still clears it. - `verify_message` now adds the frame's uncaptured octets itself, so ICMP and IGMP get the cut as GRE did; `GRE.read` drops its own copy of that term. - `GRE(cut)` and `IGMPv1/v2/v3(cut)` on octets ending inside the message verified a zero-filled checksum and read INVALID; `GRE.read` and `IGMP._verify_checksum` read TRUNCATED whenever the header carries a `__short_read__` record. - pep.rst: the GRE checksum bullet states the current truncation rule. New tests in test_ipv4_tso_cut_checksum_2689_unit, test_gre_header_cut_2689_unit and test_igmp_header_cut_2689_unit fail on main; sample captures parse identically.
9cc3387 to
e5665a1
Compare
|
Pushed
The three new modules fail on |
…s, the cut schema lists, the TSO checksum cut and short ZigBee keys into 1.6.0 (#2449) - Breaking: MH (#2700) refuses a mobility option, or a sub-option, QoS attribute or CGA extension of one, whose fields do not take its length, where 1.5.x rebuilt another; QualityOfServiceOption gains a required tc_reserved. Prefix lengths are held to their field's width, the NAI and service identifier makers count octets, and a long-form DER CGA key parses. Folded into the MH/DSS and makers' range-check entries, with a QoS entry of its own; old and new values measured against v1.5.1. - Fixed: ListField zero-fills a cut list of schema items, bounded by ZERO_PAD_BUDGET_RATIO with no free band, and a SACK past the data raises ProtocolError where it raised FieldValueError (#2701); a Decryption Secrets Block made from a short parsed ZigBee key is written as captured, and zigbee_key_held's schema holds the octets given (#2697). - Folded into unreleased entries: radiotap's mixed bitmaps, their known-bits registries and BitmapField (#2696), into the Radiotap entry; the TSO and AH checksum cut (#2699), into the checksum and contextvars entries; the zero-filled SETTINGS and IGMPv3 records and the IGMPv3 Additional Data rebuild (#2701), into the HTTP/2 SETTINGS and IGMP entries, dropping HTTPv2.make's unreleased frame_length. - No entry for the docstring-and-test-only be83061 (#2695). - CHANGELOG.md regenerated; util/changelog_md.py --check passes.
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
Two cases where a checksum read INVALID, with a false
ChecksumWarning, on a packet that was only cut by the capture:Internet._decode_next_layerclearedframe_lengthregardless. It now takesdeclared:IPv4.readpassesbool(ipv4.len), and AH in IPv4 mode passesFalse, so the cut reachesverify_message.verify_messageadds the uncaptured octets for ICMP, IGMP and GRE alike. Every other Internet layer still clearsframe_length.GRE(cut).GRE.readreports TRUNCATED whenever its header carries the built-in__short_read__record, so a cut anywhere in the header counts, not only one at or before the checksum.Tests cut GRE, ICMP and IGMP at every point behind a TSO IPv4, with and without AH, and through PCAP and PCAP-NG. They also cut GRE headers at every octet. Each cut test fails on
main. Whole packets, wrong checksums and declared lengths are the controls. Shipped captures parse identically tomain.Closes #2689