summaryrefslogtreecommitdiffstats
path: root/sys/net/bridgestp.c
diff options
context:
space:
mode:
authorsyrinx <syrinx@FreeBSD.org>2006-12-04 14:45:02 +0000
committersyrinx <syrinx@FreeBSD.org>2006-12-04 14:45:02 +0000
commitb5c537984bd463a59efd5ae8b00db2da6b4b2a79 (patch)
treeb6129512c425358a54eb42903a4969d60cea72df /sys/net/bridgestp.c
parente472c8dd9a63a668edf18369765bbcf1dce3a47d (diff)
downloadFreeBSD-src-b5c537984bd463a59efd5ae8b00db2da6b4b2a79.zip
FreeBSD-src-b5c537984bd463a59efd5ae8b00db2da6b4b2a79.tar.gz
Add two new flags to if_bridge(4) indicating whether the edge flag
of the bridge port and path cost have been administratively set or calculated automatically by RSTP. Make sure to transition from non-edge to edge when the port goes down and the edge flag was manually set before. This is needed to comply with the condition ((!portEnabled && AdminEdge) || ....) in the Bridge Detection State Machine (IEE802.1D-2004, p. 171). Reviewed by: thompsa Approved by: bz (mentor)
Diffstat (limited to 'sys/net/bridgestp.c')
-rw-r--r--sys/net/bridgestp.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c
index d255de0..dfc59b5 100644
--- a/sys/net/bridgestp.c
+++ b/sys/net/bridgestp.c
@@ -1637,7 +1637,10 @@ bstp_set_edge(struct bstp_port *bp, int set)
struct bstp_state *bs = bp->bp_bs;
BSTP_LOCK(bs);
- bp->bp_operedge = set;
+ if ((bp->bp_operedge = set) == 0)
+ bp->bp_flags &= ~BSTP_PORT_ADMEDGE;
+ else
+ bp->bp_flags |= BSTP_PORT_ADMEDGE;
BSTP_UNLOCK(bs);
return (0);
}
@@ -1809,8 +1812,12 @@ bstp_ifupdstatus(struct bstp_state *bs, struct bstp_port *bp)
if (bp->bp_role == BSTP_ROLE_DISABLED)
bstp_enable_port(bs, bp);
} else {
- if (bp->bp_role != BSTP_ROLE_DISABLED)
+ if (bp->bp_role != BSTP_ROLE_DISABLED) {
bstp_disable_port(bs, bp);
+ if ((bp->bp_flags & BSTP_PORT_ADMEDGE) &&
+ bp->bp_protover == BSTP_PROTO_RSTP)
+ bp->bp_operedge = 1;
+ }
}
return;
}
OpenPOWER on IntegriCloud