Repository navigation
fix(engines): the dpkt engine applies the first PCAP-NG interface's linktype and timestamp resolution to every frame - #1396
Conversation
|
Cross-review verdict on
Nits, not blocking:
|
|
CI found a real defect on Python 3.10: back to NEEDS CHANGES. The red |
…inktype and timestamp resolution to every frame dpkt.pcapng.Reader reads only the first Interface Description Block, so every packet got interface 0's link type and if_tsresol, and a later section's interfaces were never read. The DPKT engine now reads PCAP-NG with its own PCAPNGReader: SHBs and IDBs are parsed by pcapkit's PCAPNG protocol per section, packet blocks are still decoded by dpkt, and each packet takes the link type, if_tsresol and if_tsoffset of the interface it names, with the default engine's timestamp arithmetic. Closes #1379
ac02fa9 to
5fcf07d
Compare
|
Delta verdict on |
|
Coverage: 89.42% (unit tier, Python 3.14,
Per-file detail: the |
make pylint,make mypy,make isort) — pylint/mypy onengines/dpkt.py, no new findings bar house-style local imports; isort viatests/projectmake testpasses, and a test case covers the change — modules listed belowdocs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible — N/A, added centrallyWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
Closes #1379
dpkt.pcapng.Readerreads only the first IDB, so every frame took interface 0's link type andif_tsresol. The engine now reads PCAP-NG with a newengines.dpkt.PCAPNGReader. It parses SHBs and IDBs with pcapkit's ownPCAPNGprotocol, one section at a time. Packet blocks are still decoded by dpkt. Each packet takes the link type,if_tsresolandif_tsoffsetof the interface it names, using the default engine'sDecimalarithmetic._extmpis now this reader on PCAP-NG, not dpkt's. SPBs are still skipped (#1361 note updated in3rdparty.rst).Before → after (dpkt vs default, EPB/PB frames):
profile.pcapng20/40 timestamps wrong (ns interface read as µs, e.g.1500000000.0005vs1500000.0000005) → 0.test.pcapngframe 2 (RAW, ns) parsed as Ethernet with the wrong timestamp → matches.many_interfaces.pcapngframes 3–4 (NULL, if 10) parsed as Ethernet → raw. A synthesised LE+BE two-section capture loses its last frame onmain(3 ≠ 4).Tests: new
tests/foundation/engines/test_dpkt_pcapng_interfaces_unit.py(4 passed). All 4 fail withengines/dpkt.pyreverted toorigin/main: two behavioural failures (timestamp list,3 != 4), twoImportError.test_runtime_engines.pynow patchesPCAPNGReaderrather thandpkt.pcapng.Reader. All 12tests/foundation/enginesmodules, the dpkt integration and extraction modules, and thefoundationordering leg (522 OK) pass.tests/project: 391 passed, 1 skipped.