Date: Sat, 21 Jan 2012 15:37:32 +0200 From: Nikos Vassiliadis <nvass@gmx.com> To: freebsd-net@freebsd.org Subject: STP id selection Message-ID: <4F1ABF9C.5010608@gmx.com>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------080102030109050709030808 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, The current code in bridgestp.c finds the lower MAC address from all available ethernets and uses it as the STP id. This is problematic when more than one STP bridges participate in the same STP domain because more than one bridges will use the same id. A similar fix was applied to the OpenBSD version of the code[1]. Could you review the attached patch? 1.http://www.openbsd.org/cgi-bin/cvsweb/src/sys/net/bridgestp.c?rev=1.33 Thanks, Nikos --------------080102030109050709030808 Content-Type: text/plain; name="bridgestp.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="bridgestp.c.diff" 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; --------------080102030109050709030808--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F1ABF9C.5010608>