CS485 Sylabus

Detecting and handling cycles

• Cycles...

• There are two types of cycles in a network:

• Odd cycles: the number of nodes in the cycle is odd

Example: this cycle contains 5 nodes

• Even cycles: the number of nodes in the cycle is even

Example: this cycle contains 6 nodes

• Detecting even cycles

• Observation:

• In an even cylce:

 There is exactly one bridge that have two paths with the same distance to the root bridge

Example:

• My nomemclature:

• For simplicity, I (not in any book) will call this node:

 the last node in the even cycle

• Fact:

• The last node in the even cycle can tell that:

 It is the last node in an even cycle

How:

• Handling even cycles

• Goal:

 We want to obtain a tree (= cycle-free) logical network !!!

Therefore:

• When the last node in an even cycle detects that it is the last node:

 The last node in an even cycle must block one of its ports (to break the cycle ) !!!

• Depending on the order in which the 2 configuration messages are received, you can have one of two possible states:

• If the configuration message from the left bridge (L) arrives first:

then:

 The left port will be the root port

• If the configuration message from the right bridge (R) arrives first:

then:

 The right port will be the root port

• How to break an even cycle:    by block the non-root port

 ``` ** Bridge receives a configuration message on port Port; /* ===================================================== How to detect the last node in an even cycle ===================================================== */ if ( ( RootID in the control message == myRoot ) AND ( Distance in message == myDistance - 1 ) ) then { if ( Status(Port) != Root ) Status(Port) = BLOCKED; // Block the non-root port ! } ```

• Example:

• The bridge 5 just received a configuration message with equal distance to root node on a non-root port:

Now the bridge 5 can tell that:

 It is the last node in an even cycle !!!

• Bridge 5 will block the receiving port:

The cycle is now broken !!!

• Detecting odd cycles

• Observation:

• In an odd cylce:

• There will be two bridges that have the same maximum distance to the root bridge

Example:

I.e.:

 There are 2 last nodes in the cycle

• How to determine if a bridge is a last node in an odd cycle:

• A last node in an odd cycle will receive a configuration message with:

 ``` Distance in configuration message == myDistance ```

to the same root bridge

• Example:

• Caveat

• Note:

 There are 2 last nodes in an odd cycle Both last nodes can (and will) determine that it is (one of) a last node in an odd cycles

Caveat:

 Only one of the bridges must block its port !!!

Graphically:

(You must not block both bridges, or else you will disconnect some LAN !!!)

• Tie breaker rules used in the Spanning Tree algorithm

• IEEE 802.11D rule to determine the block port:

 The bridge with a large ID value must make its non-root port into a blocked port

Example:

• Handling odd cycles

• Algorithm is pseudo code:

 ``` Bridge received a configuration message Msg on port Port; /* ================================================ How to detect the last node in an odd cycle ================================================ */ if ( ( Msg(RootID) == myRoot ) AND ( Msg(Distance) == myDistance ) ) { /* ================================================ Block the port of the bridge with the large ID ================================================ */ if ( myID > Msg(SourceID) ) Status(Port) = BLOCKED; } ```

• A concrete example:

• Bridge 5 and bridge 3 are 4 hops away from the root bridge:

• When bridge 3 receives a configuration message from node 5:

Brigde 3 will find out that it is one of the last nodes in an odd cycle:

However:

 Brigde 3 will ignore the message because its ID is smaller than bridge 5

Graphically:

• But, when bridge 5 receives a configuration message from node 3:

Brigde 5 will find out that it is one of the last nodes in an odd cycle:

In this case:

 Brigde 5 will change the status of the incoming port to blocked

Graphically:

because its ID is larger than bridge 3

• Result:

The cycle is also broken