Repository navigation
fix(protocols): dissect LINKTYPE_RAW by version nibble; add the BSD loopback layer for LINKTYPE_NULL/LOOP (#1502, #1574) - #1594
Conversation
|
Coverage: 89.74% (unit tier, Python 3.14,
Per-file detail: the |
|
Verdict: NEEDS CHANGES at Needed:
Also worth folding in:
Confirmed:
|
58a4ad7 to
789221b
Compare
|
Verdict: NEEDS CHANGES at Needed:
The cause is that the rebuild calls The owner's rule is that Optional: the Confirmed:
|
789221b to
4ede9e6
Compare
|
Verdict: GOOD TO GO at
Note for merging: this PR and #1569 delete neighbouring known-failure rows, |
…oopback layer for LINKTYPE_NULL/LOOP (#1502, #1574) - Frame and PCAPNG dispatch LINKTYPE_RAW (101) data as IPV4 or IPV6 by the version nibble of its first octet (_dispatch_linktype), unless RAW itself is registered; any other version stays Raw. - New Loopback link layer (protocols/link, schema/link, data/link): a 4-octet address family, big-endian under LINKTYPE_LOOP (108) and inferred under LINKTYPE_NULL (0) (family_byteorder). The byte order is kept in info and read back by from_data, so a rebuild returns the same info. 2 goes to IPv4 and 24/28/30 to IPv6 through its own __proto__. Registered for NULL and LOOP in both tables, exported, and documented. - dpkt engine: RAW by version nibble; NULL/LOOP through a dpkt Loopback, cached per base/IP/IP6 class and link type, that reads the family as pcapkit does and names its ip/ip6 payload. - Delete Gap(1502): all four labels now agree, many_interfaces.pcapng's two NULL frames included (36 datagrams in default, scapy and dpkt). - Dispatch generator pins the new entries and walks Loopback.__proto__. - New tests for RAW, Loopback (7 families x 2 byte orders x 3 link-type hints, info-exact from_data, PCAP and PCAP-NG) and the dpkt engine. Closes #1502 Closes #1574
|
Resolve conflicts |
4ede9e6 to
ab543c4
Compare
|
Verdict: GOOD TO GO at Conflicts resolved: 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).
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).
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) — Makefile flags on the changed modules, no new findingsmake testpasses, and a test case covers the change — narrow selections only, not the full suiteAdded 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
Frame.__proto__andPCAPNG.__proto__had noLinkType.RAWentry. Both now dispatch raw-IP data asIPV4/IPV6by its version nibble, unlessRAWis registered. The dpkt engine's_get_protocoldoes the same.pcapkit.protocols.link.loopback.Loopbackreads the 4-octet address family: big-endian underLINKTYPE_LOOP, inferred from the octets underLINKTYPE_NULL, with the byte order kept ininfo. It dispatches 2 to IPv4 and 24/28/30 to IPv6, and is registered forLINKTYPE_NULLandLINKTYPE_LOOPin both tables and in the dpkt engine.Gap(1502)is deleted. All four labels pass, andmany_interfaces.pcapngnow gives 36 IPv4 datagrams in default, scapy and dpkt alike. The agreement module shows dpkt and scapy matching default on all 207 labels each.from_data(info.to_dict())are byte-exact in both byte orders, in PCAP and PCAP-NG.examples/generators/dispatch.pynow pins the new entries and walksLoopback.__proto__.Header.makedefaultsnetworktoLinkType.NULL, so a frame built without a link type now parses asLoopback:…rather thanNULL. Round trips are unchanged.Closes #1502
Closes #1574