Repository navigation
feat(protocols)!: move OSPF and RARP to the application layer (#719) - #1031
Conversation
Layer is decided by designed function, with the IETF as the single source of truth: RFC 1812 §7 places routing protocols in the application layer and RFC 1122 §1.1.3 lists RARP there. Ruled on #719. * `OSPF` moves to `application/` with `Application` as its only base. `RARP` and `DRARP` move as `class RARP(Application, ARP)`: layer base first, because `ARP`'s chain reaches `Link`, which owns `__layer__`. `layer` is now `'Application'` for all three; `ARP` and `InARP` stay `'Link'`. * The matching `data/` and `schema/` modules and the `.rst` pages move too. No re-export is left at the old paths. `pcapkit/const` and `pcapkit/vendor` do not move. * Dispatch keys are unchanged: OSPF stays in `Internet.__proto__` at `TransType.OSPFIGP`, RARP in `Link.__proto__` by EtherType. Only the module each descriptor names changes. * Neither class overrides `__post_init__`, `_decode_next_layer` or `_import_next_layer`; both rely on the `-1` sentinel `Application` now accepts. * `OSPF.__proto__` becomes `ProtocolBase.__proto__`, so OSPF no longer sees Link's EtherType entries. `register` and `_read_protos` still resolve, on `ProtocolBase` rather than Link -- the strict difference Link minus Application minus ProtocolBase is empty. Inert either way: a `-1` lookup misses in both registries, resolves to `Raw`, and inserts nothing on the miss. * New conventions page `protocol-layer-placement`, and a 1.5.0 breaking-change entry listing the before/after import paths. Protochains are unchanged at every `layer=` value, `'internet'` included; only `_sigterm` moves, and on RARP as well as OSPF. Every tests/protocols subtree, tests/project and tests/foundation pass locally, run in separate chunks.
b05ddc1 to
0d382c3
Compare
|
Cross-review verdict on 1. My test-count split was wrong in both numbers. I wrote "11 of the 17 cases fail" and "Six are regression guards". Measured on an extracted 2. A stale cross-reference the sweep missed. 3. My own correction overstated, which makes this my third pass at the same claim. I had said OSPF "loses the EtherType registry, 4. Also fixed, from its unprompted findings: What it confirmed by independent derivation, all against a real extracted One thing I got wrong while verifying its findings, worth stating because I have been warning every agent about exactly it: my first re-run of Resetting |
|
Cross-review verdict on Scope, verified independently rather than taken on my word:
One residual imprecision it named, which I am recording here rather than pushing a fourth revision for. "The same inversion applies to RARP" is only half-observable: RARP's flag does go Two gaps I am carrying rather than closing, both UNVERIFIED on its side: |
Please follow the guide below
make pylint,make mypy,make isort)tests/protocols/application/docs/source/changelog/and regeneratedCHANGELOG.mdWhat is the purpose of your pull request?
fix— corrects a defectfeat— adds a featureperf/refactor/test/docs/ci/choreDescription of your pull request and other information
Implements the layer-placement ruling on #719, and depends on the
Applicationloosening that merged as #1030. The IETF is the single source of truth (RFC 1122 §1.1.3, RFC 1812 §7), so OSPF moves toapplication/withApplicationas its only base and RARP asclass RARP(Application, ARP)— base order load-bearing, layer base first. Thedata/andschema/modules and the.rstpages move with them. A new conventions page states the rule with its citations.Dispatch entries do not move. RARP is still reached from
Link.__proto__by EtherType and OSPF fromInternet.__proto__atTransType.OSPFIGP; only the module they point at changes. That decoupling of dispatch tier from subpackage is the thing most likely to look wrong to a reader, so the page says it explicitly.One correction carried in, because I got it wrong on the issue thread. I had written that
LinkandApplicationdefine "precisely the same three names beyondProtocolBase", so OSPF would inherit onlylayerfromLink. That is false. Measured on this tree, excluding dunder boilerplate,Linkoverrides__proto__,_read_protosandregisterwhereApplicationdoes not — but all three also exist onProtocolBase, so the strict differenceLink−Application−ProtocolBaseis empty and each still resolves. What changes is which registry:OSPF.__proto__becomesProtocolBase.__proto__, so OSPF no longer sees Link's EtherType entries, whileregisterand_read_protosresolve onProtocolBase. RARP keeps Link's throughARP.That turns out to be behaviourally nil, and the page and a new test now say why rather than asserting it: OSPF falls back to the root
ProtocolBase.__proto__, a-1lookup is absent from both registries and resolves toRaweither way, and_lookup_next_layerinserts nothing on a miss, so neither registry grows.A second correction, already posted on the issue: there is no extraction-boundary change.
layer='internet'givesIPv4:OSPFIGPbefore and after — IPv4 terminates the chain on its own. The only observable movement is_sigterm, on RARP as well as OSPF, inverting betweenlayer='link'andlayer='application'while protochains stay identical at everylayer=value including unset.Verified locally, in eleven separate narrow runs, because CI cannot tell us. The
Plain unittest ordering (protocols)leg currently cancels at its 45-minute cap on every run includingmain's (#1029), so local coverage is the only real evidence here:application152 passed,link35,internet279,transport152,schema38,misc116, dispatch 24, protocol-base/registry 49, option-roundtrip 6,tests/project268,tests/foundation270. No chunk skipped; every summary line read.Against the pre-move tree, 12 of the 17 cases in
test_layer_placement_unit.pyfail, plus 7 subtests oftest_the_names_left_the_link_subpackage. Five are regression guards that pass either way: ARP and InARP stayingLink,layer='internet'stopping at IPv4,Linkowning__layer__whereRawdoes not, RARP over Ethernet under every layer limit, and unlimited extraction. The four failures in the relocatedtest_ospf_unit.py/test_rarp_unit.pyare import failures on the old tree, so they are moves rather than new coverage.