Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
58156b2
stp: reordering code to better reflect the execution flow
ManiAm Sep 8, 2019
6e4ff28
mac: watch the address table
ManiAm Sep 8, 2019
def034c
mac: adding base MAC address to each switch
ManiAm Sep 8, 2019
7fa2cf2
stp: using the base mac address
ManiAm Sep 8, 2019
ad3cd33
stp; use enum for bpdu type
ManiAm Sep 8, 2019
693c5e9
stp: fix the field names in the bpdu
ManiAm Sep 9, 2019
b576002
stp: adding protocol serializer
ManiAm Sep 9, 2019
299a616
stp: adding important variables into WATCH
ManiAm Sep 9, 2019
ba00ebb
stp: using enum instead
ManiAm Sep 9, 2019
367a628
stp: adding more debug
ManiAm Sep 10, 2019
aebff32
stp: adding a new disabledInterfaces parameter to stp
ManiAm Sep 10, 2019
ae5fe33
stp: L2NetworkConfigurator is now working properly
ManiAm Sep 11, 2019
8ce04f8
stp: set port cost to recommended value from IEEE when not explicitly…
ManiAm Sep 11, 2019
960ce21
stp: set bridge mac address correctly
ManiAm Sep 11, 2019
4a88844
stp: move color values to ned param
ManiAm Sep 11, 2019
7bcecdc
rstp: adding link colors to ned
ManiAm Sep 12, 2019
5b85c2e
rstp: reordering code to better reflect the execution flow
ManiAm Sep 12, 2019
7d231ce
stp,rstp: fix protocol version and type in BPDUs
ManiAm Sep 12, 2019
2b1b5c6
stp: use better types
ManiAm Sep 12, 2019
361c267
stp: print isEdge information of an interface
ManiAm Sep 12, 2019
9b9ab6a
stp: refactoring
ManiAm Sep 12, 2019
4ba018e
stp: stp does not have any DISCARDING states
ManiAm Sep 12, 2019
97da4e0
stp: cosmetics
ManiAm Sep 12, 2019
eb6fbee
rtp: adding more debug output
ManiAm Sep 13, 2019
1a399ed
stp: source MAC address is now set correctly
ManiAm Sep 13, 2019
ee636c7
rtp: fix tcn bpdu value
ManiAm Sep 14, 2019
bd18b91
stp: adding more debugs
ManiAm Sep 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
stp: stp does not have any DISCARDING states
  • Loading branch information
ManiAm committed Sep 15, 2019
commit 4ba018e69da652730262ff2ff6d784fc038ca93e
47 changes: 25 additions & 22 deletions src/inet/linklayer/configurator/Ieee8021dInterfaceData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,43 +64,46 @@ std::string Ieee8021dInterfaceData::detailedInfo() const
const char *Ieee8021dInterfaceData::getRoleName(PortRole role)
{
switch (role) {
case ALTERNATE:
return "ALTERNATE";
case NOTASSIGNED:
return "NOTASSIGNED";

case NOTASSIGNED:
return "NOTASSIGNED";
case ROOT:
return "ROOT";

case DISABLED:
return "DISABLED";
case DESIGNATED:
return "DESIGNATED";

case DESIGNATED:
return "DESIGNATED";
case ALTERNATE:
return "ALTERNATE";

case BACKUP:
return "BACKUP";
case DISABLED:
return "DISABLED";

case ROOT:
return "ROOT";
case BACKUP:
return "BACKUP";

default:
throw cRuntimeError("Unknown port role %d", role);
default:
throw cRuntimeError("Unknown port role %d", role);
}
}

const char *Ieee8021dInterfaceData::getStateName(PortState state)
{
switch (state) {
case DISCARDING:
return "DISCARDING";
case BLOCKING:
return "BLOCKING";

case LEARNING:
return "LEARNING";
case LEARNING:
return "LEARNING";

case FORWARDING:
return "FORWARDING";
case FORWARDING:
return "FORWARDING";

default:
throw cRuntimeError("Unknown port state %d", state);
case DISCARDING:
return "DISCARDING";

default:
throw cRuntimeError("Unknown port state %d", state);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/inet/linklayer/configurator/Ieee8021dInterfaceData.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class INET_API Ieee8021dInterfaceData : public InterfaceProtocolData
public:
enum PortRole { NOTASSIGNED, ROOT, DESIGNATED, ALTERNATE, DISABLED, BACKUP /*rstp only*/ };

enum PortState { DISCARDING, LEARNING, FORWARDING };
enum PortState { BLOCKING /*stp only*/, LEARNING, FORWARDING, DISCARDING /*rstp only*/ };

class PortInfo
{
Expand Down
10 changes: 5 additions & 5 deletions src/inet/linklayer/ieee8021d/stp/Stp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void Stp::initInterfacedata(unsigned int interfaceId)

// note: port cost and port priority are configured by the L2NetworkConfigurator

ifd->setState(Ieee8021dInterfaceData::DISCARDING);
ifd->setState(Ieee8021dInterfaceData::BLOCKING);
ifd->setRootPriority(bridgePriority);
ifd->setRootAddress(bridgeAddress);
ifd->setRootPathCost(0);
Expand Down Expand Up @@ -244,7 +244,7 @@ void Stp::checkTimers()
if (port->getRole() == Ieee8021dInterfaceData::ROOT || port->getRole() == Ieee8021dInterfaceData::DESIGNATED) {
if (port->getFdWhile() >= currentFwdDelay) {
switch (port->getState()) {
case Ieee8021dInterfaceData::DISCARDING:
case Ieee8021dInterfaceData::BLOCKING:
EV_DETAIL << "Port=" << interfaceId << " goes into learning state." << endl;
port->setState(Ieee8021dInterfaceData::LEARNING);
port->setFdWhile(0);
Expand All @@ -263,9 +263,9 @@ void Stp::checkTimers()
}
}
else {
EV_DETAIL << "Port=" << interfaceId << " goes into discarding state." << endl;
EV_DETAIL << "Port=" << interfaceId << " goes into BLOCKING state." << endl;
port->setFdWhile(0);
port->setState(Ieee8021dInterfaceData::DISCARDING);
port->setState(Ieee8021dInterfaceData::BLOCKING);
}
}
}
Expand Down Expand Up @@ -536,7 +536,7 @@ bool Stp::isSuperiorBPDU(int interfaceId, const Ptr<const Bpdu>& bpdu)
// BPDU is superior
if (result < 0) {
port->setFdWhile(0); // renew info
port->setState(Ieee8021dInterfaceData::DISCARDING);
port->setState(Ieee8021dInterfaceData::BLOCKING);
setSuperiorBPDU(interfaceId, bpdu); // renew information
delete xBpdu;
return true;
Expand Down