Code Monkey home page Code Monkey logo

mstp-lib's Introduction

mstp-lib

A library that implements the Multiple / Rapid Spanning Tree Protocol as defined in 802.1Q-2018.

It's written in C++03 and is callable from C.

I integrated the library myself in various devices made by various OEMs (ship automation, tactical networking, in-flight entertainment) and I helped others integrate it in plenty other devices.

Simulator

A Simulator application for Windows is provided - both sources and binaries. The Simulator lets you create networks and see the library in action. See the screenshot below. This is a project for Visual Studio 2017.

Embedded Application Examples

The repository includes sources with a couple of RSTP implementations on embedded devices with microcontrollers and switches such as Marvell, Microchip, IC+. The projects are for Rowley CrossWorks (gcc and clang compilers) and IAR Embedded Workbench (EDG compiler).

These samples highlight the platform-specific code required by STP -- mostly code that writes to a few hardware registers of the switch chip. To integrate the library in your embedded application, you'll need to write platform-specific code for your particular switch IC. Drop me a message at [email protected] and I might be able to help.

API Help

The repository also includes help files for most of the library APIs - some rather extensive.

Screenshot of the Windows Simulator

screenshot

mstp-lib's People

Contributors

adigostin avatar szekelyisz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mstp-lib's Issues

Resume forwarding on all ports when STP is disabled by the app

i.e., from STP_StopBridge, call the enableLearning and enableForwarding callbacks for every tree of every port wherelearning and forwarding are false.

Make this explicit in the documentation of STP_StopBridge, explaining that the learning and forwarding states of a port are relevant only to STP and shouldn't be messed with while STP isn't running.

Also remove from simulator the code that restores learning and forwarding there.

Changing parameters

How can I change the following parameters:

  • Hello Time
  • Forwarding Delay
  • Max Age

Delete unclear paragraph from STP_OnBpduReceived.html

Delete this:
"It is recommended that the application, before passing a received BPDU frame to the STP library, performs a check for malformed frames by comparing the value in the EtherType/Size field of the frame to the length of the received frame. Such malformed frames should be discarded, not passed to the STP library."

The library checks the BPDU anyway, and it is also unclear in this paragraph what the app is supposed to do with regard to short frames padded to 64 bytes.

BPDU transmission period

In other implementations of RSTP that I've seen, the BPDU is only transmitted every hello time, or when there is a topology change: 1 BPDU per hello period in stable conditions.
Toying with the simulator, I have noticed that, on every hello period, 2 BPDUs are transmitted from the designated ports. Looks like one of the BPDUs received on the root port triggers the transmission of a BPDU on the designated ports, which is added to the BPDU transmitted on hello time.

This seems like unnecessary traffic. Is this intentional? Does this respect the 802.1 standard?
Thanks

Restarting the state machines not always correct

When BEGIN is asserted, for example due to changing the protocol version with STP_SetStpVersion(), each state machine must enter a well-defined state and execute the "state entry" code.

Bug: if a state machine is already in that state when BEGIN is asserted, then the "state entry" code is not executed. See this comment in various state machines: // The entry block for this state has been executed already.

Fix: In RestartStateMachines(), force the state of all state machines to "undefined" (value 0) after asserting BEGIN and before running the state machines. This will cause them to always transition to the well-defined state and execute its entry code.

DebugStrOut - flush parameter type differs in declaration,documentation and usages

In stp.h flush parameter is uint:

typedef void  (*STP_CALLBACK_DEBUG_STR_OUT)  (const struct STP_BRIDGE* bridge, int portIndex, int treeIndex, const char* nullTerminatedString, unsigned int stringLength, unsigned int flush);

In documentation StpCallback_DebugStrOut.html flush is bool type.

All usages inside stp_log.cpp provide true/false as flush argument

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.