Repository navigation
feat(link): add a FRAD dissector for Frame Relay over LinuxSLL (#2460) - #2499
Conversation
|
Cross-review (Sonnet) at
RFC 2427 framing itself confirmed correct (Q.922 address layout, NLPID dispatch, SNAP OUI/PID handling), LinuxSLL wiring correct, changelog present, PR body correctly says 'Part of #2460' not 'Closes'. Fixing both now. |
Part of #2460's five arphrd_type follow-ups: LinuxSLL/LinuxSLL2 fell back to Raw for ARPHRD_FRAD, the narrowest of the five, since no Frame Relay dissector existed. - Add pcapkit.protocols.link.frad.FRAD, parsing the Q.922 address, control field and NLPID of RFC 2427's multiprotocol encapsulation (obsoleting RFC 1490), both the direct-NLPID and SNAP-encapsulated forms. - Wire LinuxSLL1/LinuxSLL2 to dispatch ARPHRD_FRAD to it instead of Raw. - Direct NLPID 0xCC/0x8E dispatch onward to IPv4/IPv6; a SNAP header with OUI 00-00-00 dispatches by its PID through the EtherType registry Ethernet/VLAN/LinuxSLL already share (reaching ARP, among others). Every other NLPID, and a SNAP header naming a bridged medium, stays Raw. - Add tests/protocols/link/test_frad_unit.py; move ARPHRD_FRAD out of the LinuxSLL "kept raw" sweep into its own dispatch test; add two FRAD cases to the short-read round-trip sweep. - Register FRAD in every export registry it was missing from: pcapkit, pcapkit.all, pcapkit.protocols, and the data/schema registries under pcapkit.protocols.{data,schema}[.link]. - Add NOT_A_COPY entries to the #1739 constant-sweep test for FRAD's bit offsets and field bounds that coincidentally match homed RFC constants. Build: mypy and pylint clean; FRAD, LinuxSLL, export-registry, #1739 sweep, and protocol-convention test suites all pass.
286a783 to
a8b5c0e
Compare
|
Pushed Verified: |
|
Cross-review (Sonnet) at |
|
Coverage: 94.47% (unit tier, Python 3.15,
Per-file detail: the |
Part of #2460.
What
Adds
pcapkit.protocols.link.frad.FRAD, a dissector for Frame Relay'smultiprotocol encapsulation (RFC 2427, obsoleting RFC 1490), and wires
LinuxSLL/LinuxSLL1/LinuxSLL2to dispatch to it for theARPHRD_FRADarphrd_typeinstead of falling back toRaw.Why this slice
#2460 lists five
arphrd_typevalues thatLinuxSLL/LinuxSLL2keep wholeas
Raw:NETLINK,IPGRE,IP6GRE,IEEE80211_RADIOTAP,FRAD. Theissue itself calls each one "effectively its own new-protocol
implementation, not a tweak" and too much for one PR.
FRADis thenarrowest and rarest of the five -- no Netlink framing, no GRE tunnelling,
no 802.11/radiotap -- just a thin link-layer header, which keeps this PR
reviewable. The other four are filed as separate issues (linked from #2460)
rather than implemented here.
What the dissector covers
The frame, per RFC 2427 §3/§4.1: a 2-octet Q.922 address (DLCI, C/R, FECN,
BECN, DE -- the 2-octet form only), a 1-octet control field, then either
encapsulated protocol directly.
0xCC(IPv4) and0x8E(IPv6) dispatchonward; every other NLPID (Q.933 signalling, ISO CLNP/ES-IS/IS-IS,
FRF.9/FRF.12 compression, PPP-in-Frame-Relay) has no dissector in this
package and is kept as
Raw, exactly as the fivearphrd_types were keptbefore this PR.
0x00pad, then NLPID0x80, then a 3-octetOUI and 2-octet PID. An OUI of
00-00-00carries an EtherType in the PID,resolved through the same family registry (
Link.__proto__) thatEthernet, VLAN and LinuxSLL already share -- which is how ARP (PID
0x0806) over Frame Relay reachesARP, not just IPv4/IPv6. Any otherOUI (RFC 2427 §4.2's bridged-medium encapsulation) is kept as
Raw: thispackage has no bridging dissector.
No FCS is parsed or expected: per tcpdump.org's own LINUX_SLL page, the
ARPHRD_FRADpayload is "a Frame Relay LAPF frame... without an FCS at theend of the frame".
Tests
tests/protocols/link/test_frad_unit.py-- the address-field bit layout(checked against RFC 2427 §3's own worked example, DLCI 50 =
0x0C21),both encapsulation forms, the SNAP/EtherType dispatch,
make()validation, and byte-exact round trips.
tests/protocols/link/test_linux_sll1_unit.py/test_linux_sll2_unit.py--ARPHRD_FRADmoved out of the "kept raw"sweep into its own dispatch test; the other four
arphrd_types areunaffected.
tests/protocols/test_short_read_roundtrip_unit.py-- twoFRADcases(direct and SNAP) added to the generic "cut at every offset" sweep.
make testpasses;mypy/pylintare clean on every new/changed file.Checklist
pylint,mypy,isortclean on thechanged files)
make testpasses, and a test case covers the changedocs/source/changelog/1.6.0.rstandregenerated
CHANGELOG.mdfeat