Repository navigation
refactor(toolkit): revert dpkt's agreement-only code (#1708) - #1727
Conversation
|
Verdict: GOOD TO GO at
|
|
Coverage: 89.55% (unit tier, Python 3.15,
Per-file detail: the |
|
Resolve conflicts. |
|
And what exactly is re-serialising? I cannot make the decision without knowing the exact difference there. |
|
On an 802.1Q-then-802.1ad frame (the #1646 shape), dpkt's own header lengths put the IPv4 header at the wrong offset in the captured octets. The adapter then cannot slice that layer from the capture. "Re-serialising" means handing over I measured the difference on the PR head (
So the only observable change is a zero checksum arriving filled in. The other option, returning |
|
okay, go with re-serialising |
|
Recorded: re-serialising stays, which is what this PR already does. A layer that dpkt's own lengths misplace is handed over as dpkt's packing of it, and a zero checksum arrives filled in. The rebase onto |
|
resolve conflicts |
|
Conflicts are resolved locally: rebased onto |
Third-party engines are best effort (#1687), so the dpkt code that exists only to match the default engine comes out: - revert #1662, #1655, #1624, #1622, #1614 and the dpkt hunks of #1605: the octet walk and its link-type stash, IPv6 in IPv4 and IPv4 in IPv6, refusing MPLS and ISL, the tunnel and extension-header walks, the IPv4 header checks and the layer bounds - keep #1690's timestamps, #1594's parser choice, #1621 and #1653 - re-land as guards: a layer dpkt's own lengths misplace (#1646) is re-serialised, not refused with ProtocolError; a Total Length below the IHL keeps the header whole (#1616), and a header the capture cuts is no input; packet2dict and packet2chain take a str payload and a raw frame - delete the modules #1662 and #1655 added; the 1615/1616 module keeps only what its #1616 tests use, as no scapy test imports it now; dpkt's comparisons with the default engine assert constants or the capture's octets, or are dropped - drop pypcapfile's VLAN_TAGS, VLAN_TAG_LEN and IPV6_EXTENSION_HEADERS, which only dpkt imported, and the 1668 module's _Agreement base, which nothing subclasses now - the docs drop the depth claims and name what dpkt leaves out silently The dpkt modules, the shared modules that run dpkt, tests/foundation/engines and the project guards pass on 3.14 and 3.11 (dpkt 1.9.8, pypcapfile 0.12.0).
3ab3807 to
e79bd26
Compare
|
Pushed: rebased onto
The Sonnet check on this head is still running, so the label reads |
|
Verdict: GOOD TO GO at
|
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the change. Narrow runs only, listed below.Added a changelog entry under
docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible: N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
Tick the commit type your subject line carries.
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elseDescription of your pull request and other information
Phase 2 of #1708, for dpkt, per the plan on #1687.
packet2dictandpacket2chainaccept astrpayload and a raw frame (fix(toolkit): dpkt and scapy find TCP in IPv4 where the default engine does (#1606, #1617) #1624, fix(toolkit): dpkt walks IP layers off the octets as the default engine does (#1609, #1626, #1651, #1654) #1662);ProtocolError(fix(toolkit): dpkt ends the extraction with ProtocolError on 802.1Q then 802.1ad, two 802.1ad, or three VLAN tags #1646): see the decision below.VLAN_TAGSandVLAN_TAG_LEN, which only dpkt imported;_Agreementbase.Decision needed (#1646). dpkt's own lengths can misplace a layer, after 802.1Q then 802.1ad, or ISL then 802.1Q. This PR then re-serialises that layer from dpkt's fields, so the frame's data is kept, but those octets are dpkt's rather than the capture's. A zero checksum or length is recomputed. The alternative is to return
Noneand drop the frame from reassembly and tracing. Re-serialising is recommended. Which do you want?Tests:
tests/foundation/engines:main.