From owner-freebsd-net@FreeBSD.ORG Mon Mar 6 00:23:45 2006 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 92A8F16A420 for ; Mon, 6 Mar 2006 00:23:45 +0000 (GMT) (envelope-from thompsa@freebsd.org) Received: from dbmail-mx1.orcon.net.nz (loadbalancer1.orcon.net.nz [219.88.242.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id D62E143D48 for ; Mon, 6 Mar 2006 00:23:44 +0000 (GMT) (envelope-from thompsa@freebsd.org) Received-SPF: none Received: from heff.fud.org.nz (60-234-149-201.bitstream.orcon.net.nz [60.234.149.201]) by dbmail-mx1.orcon.net.nz (8.13.2/8.13.2/Debian-1) with SMTP id k260OA2n028823; Mon, 6 Mar 2006 13:24:11 +1300 Received: by heff.fud.org.nz (Postfix, from userid 1001) id 2F6C31CCC1; Mon, 6 Mar 2006 13:23:41 +1300 (NZDT) Date: Mon, 6 Mar 2006 13:23:41 +1300 From: Andrew Thompson To: Nik Lam Message-ID: <20060306002341.GB44857@heff.fud.org.nz> References: <440683E2.8000009@j2d.lam.net.au> <440B4759.6010106@j2d.lam.net.au> <20060305204051.GA44857@heff.fud.org.nz> <440B6644.3050800@j2d.lam.net.au> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="1yeeQ81UyVL57Vl7" Content-Disposition: inline In-Reply-To: <440B6644.3050800@j2d.lam.net.au> User-Agent: Mutt/1.5.11 X-Virus-Scanned: ClamAV version 0.88, clamav-milter version 0.87 on dbmail-mx1.orcon.net.nz X-Virus-Status: Clean Cc: freebsd-net@freebsd.org Subject: Re: configuring if_bridge with stp at boot in /etc/rc.conf 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: Mon, 06 Mar 2006 00:23:45 -0000 --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Mar 06, 2006 at 09:29:24AM +1100, Nik Lam wrote: > Andrew Thompson wrote: > >On Mon, Mar 06, 2006 at 07:17:29AM +1100, Nik Lam wrote: > >>To re-iterate, when I try to activate the bridge with STP parameters > >>in rc.conf, one of the bridge interfaces goes into forwarding mode, > >>but the other interfaces remains in disabled mode. > > > >Can you post the full output from ifconfig and tell us what version of > >the OS you are running. > > > > Here's what I see about a minute after booting up. If I run it earlier > I get to see the em1 member of bridge0 go through the listening and > learning modes, but em2 remains disabled throughout. > It may be possible that the link-up notification is not happening for em2 or we are somehow missing the first one. Can you try this patch and see if stp on em2 kicks into life. Can you also test unplugging/plugging the network cable for em2 and see if you get link change messages in your dmesg. Andrew --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="bstp_linktick.diff" Index: bridgestp.c =================================================================== RCS file: /home/ncvs/src/sys/net/bridgestp.c,v retrieving revision 1.11 diff -u -p -r1.11 bridgestp.c --- bridgestp.c 28 Feb 2006 00:13:24 -0000 1.11 +++ bridgestp.c 6 Mar 2006 00:19:06 -0000 @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD: src/sys/net/bridgest #define BSTP_MESSAGE_AGE_INCR (1 * 256) /* in 256ths of a second */ #define BSTP_TICK_VAL (1 * 256) /* in 256ths of a second */ +#define BSTP_LINK_TIMER (BSTP_TICK_VAL * 15) /* * Because BPDU's do not make nicely aligned structures, two different @@ -916,6 +917,7 @@ bstp_initialization(struct bridge_softc bstp_port_state_selection(sc); bstp_config_bpdu_generation(sc); bstp_timer_start(&sc->sc_hello_timer, 0); + bstp_timer_start(&sc->sc_link_timer, 0); } void @@ -1121,20 +1123,15 @@ bstp_tick(void *arg) BRIDGE_LOCK_ASSERT(sc); -#if 0 - LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { - if ((bif->bif_flags & IFBIF_STP) == 0) - continue; - /* - * XXX This can cause a lag in "link does away" - * XXX and "spanning tree gets updated". We need - * XXX come sort of callback from the link state - * XXX update code to kick spanning tree. - * XXX --thorpej@NetBSD.org - */ - bstp_ifupdstatus(sc, bif); + /* slow timer to catch missed link events */ + if (bstp_timer_expired(&sc->sc_link_timer, BSTP_LINK_TIMER)) { + LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { + if ((bif->bif_flags & IFBIF_STP) == 0) + continue; + bstp_ifupdstatus(sc, bif); + } + bstp_timer_start(&sc->sc_link_timer, 0); } -#endif if (bstp_timer_expired(&sc->sc_hello_timer, sc->sc_hello_time)) bstp_hello_timer_expiry(sc); Index: if_bridgevar.h =================================================================== RCS file: /home/ncvs/src/sys/net/if_bridgevar.h,v retrieving revision 1.10 diff -u -p -r1.10 if_bridgevar.h --- if_bridgevar.h 14 Jan 2006 03:51:30 -0000 1.10 +++ if_bridgevar.h 5 Mar 2006 22:50:50 -0000 @@ -301,6 +301,7 @@ struct bridge_softc { LIST_HEAD(, bridge_rtnode) sc_rtlist; /* list version of above */ uint32_t sc_rthash_key; /* key for hash */ LIST_HEAD(, bridge_iflist) sc_spanlist; /* span ports list */ + struct bridge_timer sc_link_timer; }; #define BRIDGE_LOCK_INIT(_sc) do { \ --1yeeQ81UyVL57Vl7--