Repository navigation
fix(toolkit): the default engine reads TCP under an IPv6 header of Version 4 (#1666) - #1675
Conversation
…rsion 4 (#1666) tcp_segment took the IPv4 branch of its later-fragment check by the header's Version field, but IPv6.read keeps whatever Version it reads. An IPv6 layer with Version 4 carrying a TCP header the parser rejected therefore read IPv4's `offset`, and the AttributeError ended the extraction, PCAP and PCAP-NG alike. The branch now goes by the layer's class, so those frames hand over the inputs dpkt and scapy already do. Closes #1666
|
Verdict: GOOD TO GO at
The worker's survey covered 38 cases, as PCAP and PCAP-NG, across every engine. The 32 cells that changed all went from Still open for you on #1666: should |
|
Coverage: 89.46% (unit tier, Python 3.14,
Per-file detail: the |
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 (the toolkit, traceflow and project tests near the change, file by file; not the whole suite)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
tcp_segment(pcapkit/toolkit/pcap.py) chose the IPv4 branch of its later-fragment check by the header's Version field.IPv6.readkeeps any Version, so an IPv6 layer with Version 4 carrying a rejected TCP header read IPv4'soffset, and theAttributeErrorended the extraction. The check now usesisinstance(ip, IPv4). The PCAP-NG adapters call the same function, sopcapng.pyis unchanged. The default engine's toolkit has no other.version ==dispatch.Measured on 3.14.8 and 3.11.15. The cases are the issue's 16 rows with every variant, plus 15 controls, giving 38 frame cases. Each was read as PCAP and as PCAP-NG with every engine that runs, and every TCP-reassembly, trace, IPv4-reassembly and IPv6-reassembly input was recorded:
AttributeErrorto inputs equal to dpkt's and scapy's, field for field.IPv6.readis left alone. I patched it at runtime only, to reject a Version other than 6. The default engine then hands over no inputs on rows 1-8 and 15, or on the H4 controls, while dpkt and scapy still hand them over.The new test fails on
main(2 failed,AttributeError) and passes with the fix (2 passed, 24 subtests), on both interpreters.Closes #1666