Repository navigation
fix(toolkit): pypcapfile TCP reads past VLAN tags, warns of tunnels, skips later fragments and padding (#1537, #1576, #1577) - #1575
Conversation
3d9d509 to
98e8606
Compare
|
Verdict: NEEDS CHANGES at Needed:
Confirmed:
Not this PR's: the review also found pypcapfile divergences that |
|
Coverage: 89.64% (unit tier, Python 3.14,
Per-file detail: the |
98e8606 to
a01fc0d
Compare
|
Verdict: NEEDS CHANGES at Blocking: the new tunnel check silences warnings process-wide.
Decision: drop the trial dissection. Detect from the header walk, plus a cheap TCP sanity check (Data Offset ≥ 5 and Confirmed:
|
…skips later fragments and padding (#1537, #1576, #1577) pcapfile 0.12.0's Ethernet.payload_type decodes EtherType 0x0800 only, and _transport() read the IPv4 payload to the end of the frame whatever its fragment offset, so the engine's TCP disagreed with the default engine's. - _network() reads past 802.1Q and 802.1ad tags, stacked to any depth, and decodes the IPv4 behind them with pcapfile's own IP decoder; one that will not decode warns as an untagged one does, once per frame (#1537). - TCP over IPv6 behind tags gets #1535's warn-once; TCP tunnelled in IP (4in4, 6in4, 6in6, 4in6) gets one of its own rather than being read through, as the default engine keys such a flow by the outer addresses. Both follow the default engine's rules off the raw headers: IP lengths, Jumbo Payload, later fragments, a Data Offset of at least 5 words, and in a tunnel a TCP header that fits; malformed options are not seen into (#1537). - A later IPv4 fragment is never read as a TCP header (#1576). - The TCP segment ends at the IPv4 Total Length, so Ethernet padding is no longer payload; 0 (TSO) keeps the rest of the frame (#1577). - Docs: the engines table and the toolkit note. Closes #1537 Closes #1576 Closes #1577
a01fc0d to
1de9194
Compare
|
Verdict: GOOD TO GO at
Nit: Filed as #1596 (not this PR's): pypcapfile accepts IPv4 options the default engine rejects. On |
…1721) Third-party engines are best effort (#1687), so the pypcapfile code that exists only to match the default engine comes out: - revert #1682, #1600, #1575 and #1535, and the pypcapfile hunks of #1655, #1608 and #1605: reading loopback and raw-IP link types, the frame layer bound, the VLAN and tunnel walks, keying tunnelled TCP by the innermost header, stepping over AH and extension headers, and checking options with the default engine's parsers - keep the helpers the dpkt and scapy adapters import, unchanged, until their own reverts drop them; their docstrings no longer say pypcapfile asks the default engine's parsers too - re-land #1576, #1577, #1590 and #1591 as guards in _network and _transport, #1513's once-per-capture warning for TCP straight over IPv6, and #1667's packet2dict fix: an undecoded frame is reported as its octets, not as hex text twice as long - keep #1569's record reader and #1690's packet2timestamp - delete the three test modules those reverts added, the pypcapfile timestamp agreement class, and #1682's link-type warning test; the re-landed guards' tests assert constants - drop what the reverts removed from the docs, READ_LINKTYPES included, and say that TCP behind a VLAN tag, in a tunnel or behind an extension header (an IPv6 one, or AH in IPv4) is now left out without a warning The pypcapfile modules, test_new_engine_parity_runtime.py, test_engine_runtime.py, the timestamp module and the project guards pass on 3.11 (pypcapfile 0.12.0) and 3.14.
Please follow the guide below
make pylint,make mypy,make isort)make testpasses, and a test case covers the change. Targeted selections only; see below.What is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
This makes the pypcapfile engine's TCP agree with the default engine's. All of it is in
pcapkit/toolkit/pypcapfile.py._network()steps over0x8100/0x88A8tags and decodes the IPv4 behind them with pcapfile's ownIPdecoder. A tagged IPv4 that will not decode warns in the same words as the engine's warning for an untagged one, once per frame.Tests (3.11 parity venv / 3.14 repo venv):
76 passedand59 passed, 17 skipped.origin/main's toolkit the test file fails 56 times: 11 tests and 45 subtests. Each fix's tests also fail with that fix reverted alone.pcapkit/toolkit/pypcapfile.pycoverage goes from 100% to 100% on 3.11 and from 98% to 99% on 3.14.main.Closes #1537
Closes #1576
Closes #1577