From 2efdffee15747937be970f5b7d6da101a2e8415f Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Thu, 2 Nov 2006 08:44:19 +0000 Subject: [PATCH] Do not test all the conditions if the port is already forwarding. Also print a debug message if the port is agreed as it is an important condition of the protocol. --- sys/net/bridgestp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index fad42abd4e90..2f63bb3ed34d 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -988,10 +988,11 @@ bstp_update_roles(struct bstp_state *bs, struct bstp_port *bp) DPRINTF("%s -> ROOT_PROPOSED\n", bp->bp_ifp->if_xname); } - if (bp->bp_forward_delay_timer.active == 0 || + if (bp->bp_state != BSTP_IFSTATE_FORWARDING && + (bp->bp_forward_delay_timer.active == 0 || (bstp_rerooted(bs, bp) && bp->bp_recent_backup_timer.active == 0 && - bp->bp_protover == BSTP_PROTO_RSTP)) { + bp->bp_protover == BSTP_PROTO_RSTP))) { switch (bp->bp_state) { case BSTP_IFSTATE_DISCARDING: bstp_set_port_state(bp, BSTP_IFSTATE_LEARNING); @@ -1039,10 +1040,13 @@ bstp_update_roles(struct bstp_state *bs, struct bstp_port *bp) bp->bp_ifp->if_xname); } - if ((bp->bp_forward_delay_timer.active == 0 || bp->bp_agreed || + if (bp->bp_state != BSTP_IFSTATE_FORWARDING && + (bp->bp_forward_delay_timer.active == 0 || bp->bp_agreed || bp->bp_operedge) && (bp->bp_recent_root_timer.active == 0 || !bp->bp_reroot) && !bp->bp_sync) { + if (bp->bp_agreed) + DPRINTF("%s -> AGREED\n", bp->bp_ifp->if_xname); /* * If agreed|operedge then go straight to forwarding, * otherwise follow discard -> learn -> forward.