Repository navigation
feat(application): dissect STP, RSTP and MSTP BPDUs behind LLC SAP 0x42 (#3115) - #3156
Conversation
|
Review verdict: needs changes at
Confirmed, checked against Wireshark, tcpdump, scapy, tshark 4.6.10 and mstpd (the IEEE texts weren't reachable):
Notes, none blocking:
The fix goes to the original worker, and this head's CI is cancelled. |
…42 (#3115) - STP: the abstract base of the Spanning Tree Protocol family, bound in LLC.__proto__ at LSAP 0x42 and flagged in LLC.__paired__, so a PDU is handed on only with DSAP and SSAP both 0x42. It picks the member as IEEE 802.1Q-2022 clause 14.4 validates a BPDU; `version` (0, 2, 3) names the member on both paths, and from_data reads the data model. - STPv0: Configuration and TCN BPDUs (IEEE 802.1D-2004 clause 9), read whatever their Protocol Version Identifier, as clause 14.4 does. - RSTP: RST BPDUs of version 2, and of version 3 or more failing the MST checks, the 35-octet form without a Version 1 Length included. - MSTP: version 3 MST BPDUs with the MST Configuration Identifier and their MSTI Configuration Messages; a later version holding one is the SPT BPDU, which no member reads or builds, so it is left raw. - Shared Bridge and Port Identifier and flag data models; reserved bits kept, so parse -> rebuild and make -> parse are byte-exact. - pcapkit.const.stp and its DATA crawlers: Protocol Version Identifiers, BPDU Types and Port Roles; docs pages, convention rows, the llc dispatch case, sweep table rows and unit tests.
a0b1a5c to
f115e27
Compare
|
Fix round pushed at f115e27. MSTP now reads and builds protocol version 3 only. A version 4+ BPDU that passes the MST checks stays |
|
Good to go at f115e27. A Sonnet re-review checked the delta, and I checked the prose.
|
|
Coverage: 94.79% (unit tier, Python 3.15,
Per-file detail: the |
|
Asked in session: does the family have only
|
Please follow the guide below
Put an
xinto every box [ ] that applies to your pull request (like this: [x])Use the Preview tab to see how your pull request will look
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeDescribed the user-visible change below and left its changelog entry to the maintainer, keeping
docs/source/changelog/andCHANGELOG.mdout of the diff, if the change is user-visible: N/A — centralisedWhat 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 elseAlso tick if it regenerates constant or registry tables, members keeping their numeric values (the
constlabel)Description of your pull request and other information
Closes #3115.
flowchart TD LLC["LLC: DSAP and SSAP both 0x42, paired"] --> STP["STP base: IEEE 802.1Q-2022 cl. 14.4"] STP -->|"type 0x00 (35+ octets) or 0x80 (4+), any version"| V0["STPv0"] STP -->|"type 0x02: version 2 (36+), or 3+ failing the MST checks"| RSTP STP -->|"type 0x02, version 3, 102+ octets, v1 len 0, v3 len 64 + 16n, n up to 64"| MSTP STP -->|"anything else, an SPT BPDU of version 4+ included"| RAW["Raw, with the refusal as error"]version=0, 2 or 3 names the member on parse and build;from_datareads the data model's class and refuses a dict, as a BPDU's version alone does not pick the member. Theprotocol_versionfield keeps the octet as captured. Fields follow IEEE 802.1D-2004 cl. 9 and 802.1Q-2022 cl. 14; with the texts paywalled, layouts are cross-checked against Wiresharkpacket-bpdu.c, tcpdumpprint-stp.cand mstpd, and the test BPDUs against tshark 4.6.10 and scapy 2.7.0. Newpcapkit.const.stp, fromDATAcrawlers. SPT BPDUs are left raw, andMSTPreads and builds version 3 alone; PVST+ stays out.