Skip to content

Improvements to STP/RSTP#459

Closed
ManiAm wants to merge 27 commits into
inet-framework:masterfrom
ManiAm:stp
Closed

Improvements to STP/RSTP#459
ManiAm wants to merge 27 commits into
inet-framework:masterfrom
ManiAm:stp

Conversation

@ManiAm

@ManiAm ManiAm commented Sep 15, 2019

Copy link
Copy Markdown
Contributor

@ZoltanBojthe

Copy link
Copy Markdown
Contributor

I try to run fingerprint tests for STP/RSTP simulations: (on topic/ManiAm-stp branch in inet repo)

These simulations generates errors:

  • /examples/ieee8021d/ -f omnetpp.ini -c STP-LargeNet -r 0 (runtime error with exitcode=1: <!> Error: Logic error: frame BPDU from higher layer has local MAC address as dest (AA-AA-AA-00-00-02) -- in module (inet::EtherMac) LargeNet.switch2.eth[3].mac (id=139), at t=79.000001348s, event #57894)
  • /examples/ieee8021d/ -f omnetpp.ini -c STP-LinkReconnect -r 0 (runtime error with exitcode=1: <!> Error: Logic error: frame BPDU from higher layer has local MAC address as dest (AA-AA-AA-00-00-03) -- in module (inet::EtherMac) LargeNet.switch3.eth[2].mac (id=178), at t=79.000001348s, event #59736)

All other STP/RSTP simulation reports FAILED fingerprint values

@ManiAm

ManiAm commented Oct 14, 2019

Copy link
Copy Markdown
Contributor Author

Ok, I am going to take a look at it.

@ManiAm

ManiAm commented Oct 28, 2019

Copy link
Copy Markdown
Contributor Author

Still haven't found any free time to look into this.

I think the failed fingerprint is expected. In the original INET code, each switch is using the MAC address of its first Ethernet interface as its Switch MAC. I do not know what is the logic/rationale behind this, but in almost all implementations, each switch has a base MAC port that is unique. When you power up a switch, you will see its base MAC address getting printed on the console. In my PL, I have added the base MAC port concept and each switch is using it for communication. Hence the change in fingerprint.

@levy levy added this to the INET 4.6 milestone Feb 21, 2023
@levy levy modified the milestones: INET 4.6, Postponed Mar 13, 2023
@levy levy force-pushed the master branch 2 times, most recently from b4106be to 59bbb86 Compare March 24, 2023 14:27
@levy levy force-pushed the master branch 4 times, most recently from e4fdb4a to 4f97fe0 Compare April 17, 2023 14:17
@adamgeorge309 adamgeorge309 force-pushed the master branch 3 times, most recently from 374c448 to 6723bbf Compare September 30, 2024 08:33
@adamgeorge309 adamgeorge309 force-pushed the master branch 11 times, most recently from d9e6d36 to 2b58f34 Compare February 16, 2026 14:53
@avarga

avarga commented Jun 23, 2026

Copy link
Copy Markdown
Member

Thanks for this, @ManiAm — and apologies it sat open so long. I finally went through it carefully against current master.

The honest summary is that STP/RSTP has been reworked fairly extensively in the years since you opened this, so most of the PR has been overtaken by independent work — usually arriving at the same destination you were aiming for. Rather than leave it lingering, I'd like to close it as superseded, with credit where it's due. Here's the mapping, for the record.

Already in master (done independently, often along the lines you proposed)

  • BPDU serializer — there's now an Ieee8021dBpduSerializer for byte-level (de)serialization, same idea as yours.
  • BPDU message cleanup + named constants — the message was restructured into a BpduBase / BpduTcn / BpduCfg class hierarchy with BpduType / BpduProtocolVersionIdentifier enums, replacing the old magic numbers - the same intent as your struct grouping and enums.
  • STP vs RSTP port states — the BLOCKING-vs-DISCARDING distinction you added is in, and extended further (BLOCKING + LISTENING for STP).
  • WATCHes / debug visibility — added across the board.
  • Plus a lot that goes beyond the PR: a real RSTP Proposal/Agreement handshake, TC-storm fixes, an 802.1D hold timer, and related cleanups.

Not adopted (deliberately)

  • Base-MAC-address bridge identifier (getBaseMacAddress() and switching the bridge ID off it) — this is the change behind the runtime error and fingerprint failures Zoltán reported in this very thread back in 2019. Deriving the bridge address from the first non-loopback interface is retained on purpose, so this part is best left out.
  • Renaming the XML attributes cost→portCost / priority→portPriority - backward-incompatible for existing configs, without a corresponding benefit.

Worth keeping — being extracted with attribution

  • Your datarate-based default port cost (IEEE 802.1D-2004, Table 17-3) is a genuinely nice improvement that has no equivalent on master — today the configurator still uses a flat default. I'm lifting that idea into the current L2NetworkConfigurator as a separate, properly-tested change (re-implemented against the current code, since the file and surrounding APIs have moved), and you'll be credited for it.

So I'm closing this as superseded. Note that because none of the commits landed verbatim, GitHub won't mark it as merged. Thanks again for the contribution and for your patience — the port-cost idea in particular will make it in.

@avarga avarga closed this Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants