kern/164369: [patch] two STP bridges have the same id

Nikos Vassiliadis nvass at gmx.com
Sun Jan 22 11:30:12 UTC 2012


>Number:         164369
>Category:       kern
>Synopsis:       [patch] two STP bridges have the same id
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 22 11:30:11 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Nikos Vassiliadis
>Release:        10.0-CURRENT
>Organization:
>Environment:
FreeBSD lab.local 10.0-CURRENT FreeBSD 10.0-CURRENT #110 r230309M: Wed Jan 18 21:07:24 EET 2012     root at lab.local:/usr/obj/usr/src/sys/LAB  i386
>Description:
The current code in STP selects the id of a bridge from all available ethernet ifnets regardless if they are part of the said bridge. This is problematic when more than one STP bridges exist, that is, more than one bridges will have the same bridge id.
>How-To-Repeat:
ifconfig bridge0 create
ifconfig bridge1 create
ifconfig bridge0 addm em0 addm em1 stp em0 stp em1
ifconfig bridge1 addm em2 addm em3 stp em2 stp em3

The resulting bridges are:
bridge0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 02:46:61:bb:95:00
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        id 08:00:27:0f:88:a5 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200
        root id 08:00:27:0f:88:a5 priority 32768 ifcost 0 port 0
        member: em1 flags=1c7<LEARNING,DISCOVER,STP,AUTOEDGE,PTP,AUTOPTP>
                ifmaxaddr 0 port 3 priority 128 path cost 20000 proto rstp
                role designated state discarding
        member: em0 flags=1c7<LEARNING,DISCOVER,STP,AUTOEDGE,PTP,AUTOPTP>
                ifmaxaddr 0 port 1 priority 128 path cost 20000 proto rstp
                role designated state discarding

bridge1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 02:46:61:bb:95:01
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        id 08:00:27:0f:88:a5 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200
        root id 08:00:27:0f:88:a5 priority 32768 ifcost 0 port 0
        member: em3 flags=1c7<LEARNING,DISCOVER,STP,AUTOEDGE,PTP,AUTOPTP>
                ifmaxaddr 0 port 5 priority 128 path cost 20000 proto rstp
                role designated state discarding
        member: em2 flags=1c7<LEARNING,DISCOVER,STP,AUTOEDGE,PTP,AUTOPTP>
                ifmaxaddr 0 port 4 priority 128 path cost 20000 proto rstp
                role designated state discarding

Both have the same id

>Fix:
The MAC address candidates for the bridge id should be only from the bridge's members

Patch attached with submission follows:

Index: sys/net/bridgestp.c
===================================================================
--- sys/net/bridgestp.c	(revision 230309)
+++ sys/net/bridgestp.c	(working copy)
@@ -2017,20 +2017,27 @@
 	BSTP_LOCK_ASSERT(bs);
 
 	mif = NULL;
+	bp = LIST_FIRST(&bs->bs_bplist);
 	/*
 	 * Search through the Ethernet adapters and find the one with the
-	 * lowest value. The adapter which we take the MAC address from does
-	 * not need to be part of the bridge, it just needs to be a unique
-	 * value.
+	 * lowest value. Make sure the adapter which we take the MAC address
+	 * from is part of this bridge, so we can have more than one independent
+	 * bridges in the same STP domain.
 	 */
 	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		if (ifp->if_type != IFT_ETHER)
 			continue;
 
+		if (ifp->if_bridge == NULL || bp == NULL)
+			continue;
+
 		if (bstp_addr_cmp(IF_LLADDR(ifp), llzero) == 0)
 			continue;
 
+		if (ifp->if_bridge != bp->bp_ifp->if_bridge)
+			continue;
+
 		if (mif == NULL) {
 			mif = ifp;
 			continue;


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list