From owner-freebsd-net@FreeBSD.ORG Sat Jan 21 13:37:55 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02A4A106564A for ; Sat, 21 Jan 2012 13:37:55 +0000 (UTC) (envelope-from nvass@gmx.com) Received: from mailout-us.gmx.com (mailout-us.gmx.com [74.208.5.67]) by mx1.freebsd.org (Postfix) with SMTP id B4BFA8FC14 for ; Sat, 21 Jan 2012 13:37:54 +0000 (UTC) Received: (qmail invoked by alias); 21 Jan 2012 13:37:52 -0000 Received: from unknown (EHLO [192.168.73.192]) [91.140.99.89] by mail.gmx.com (mp-us006) with SMTP; 21 Jan 2012 08:37:52 -0500 X-Authenticated: #46156728 X-Provags-ID: V01U2FsdGVkX1+iErpuT++i0nX2bIOZweeyTtysbl70BuLH2D64Hk nJJB6EYuSzQ1Pi Message-ID: <4F1ABF9C.5010608@gmx.com> Date: Sat, 21 Jan 2012 15:37:32 +0200 From: Nikos Vassiliadis User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: freebsd-net@freebsd.org Content-Type: multipart/mixed; boundary="------------080102030109050709030808" X-Y-GMX-Trusted: 0 Subject: STP id selection X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jan 2012 13:37:55 -0000 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--