diff options
author | syrinx <syrinx@FreeBSD.org> | 2006-12-04 14:45:02 +0000 |
---|---|---|
committer | syrinx <syrinx@FreeBSD.org> | 2006-12-04 14:45:02 +0000 |
commit | b5c537984bd463a59efd5ae8b00db2da6b4b2a79 (patch) | |
tree | b6129512c425358a54eb42903a4969d60cea72df /sys | |
parent | e472c8dd9a63a668edf18369765bbcf1dce3a47d (diff) | |
download | FreeBSD-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')
-rw-r--r-- | sys/net/bridgestp.c | 11 | ||||
-rw-r--r-- | sys/net/bridgestp.h | 1 | ||||
-rw-r--r-- | sys/net/if_bridge.c | 4 | ||||
-rw-r--r-- | sys/net/if_bridgevar.h | 5 |
4 files changed, 18 insertions, 3 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; } diff --git a/sys/net/bridgestp.h b/sys/net/bridgestp.h index b9717ce..025b8f4 100644 --- a/sys/net/bridgestp.h +++ b/sys/net/bridgestp.h @@ -109,6 +109,7 @@ #define BSTP_PORT_ADMCOST 0x0008 #define BSTP_PORT_AUTOEDGE 0x0010 #define BSTP_PORT_AUTOP2P 0x0020 +#define BSTP_PORT_ADMEDGE 0x0040 /* BPDU priority */ #define BSTP_PDU_SUPERIOR 1 diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 7118b2e..28d4561 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1024,6 +1024,10 @@ bridge_ioctl_gifflags(struct bridge_softc *sc, void *arg) req->ifbr_ifsflags |= IFBIF_BSTP_P2P; if (bp->bp_flags & BSTP_PORT_AUTOP2P) req->ifbr_ifsflags |= IFBIF_BSTP_AUTOP2P; + if (bp->bp_flags & BSTP_PORT_ADMEDGE) + req->ifbr_ifsflags |= IFBIF_BSTP_ADMEDGE; + if (bp->bp_flags & BSTP_PORT_ADMCOST) + req->ifbr_ifsflags |= IFBIF_BSTP_ADMCOST; return (0); } diff --git a/sys/net/if_bridgevar.h b/sys/net/if_bridgevar.h index 6a470fe..2096eaa 100644 --- a/sys/net/if_bridgevar.h +++ b/sys/net/if_bridgevar.h @@ -140,11 +140,14 @@ struct ifbreq { #define IFBIF_BSTP_AUTOEDGE 0x0040 /* member stp autoedge enabled */ #define IFBIF_BSTP_P2P 0x0080 /* member stp p2p */ #define IFBIF_BSTP_AUTOP2P 0x0100 /* member stp autop2p enabled */ +#define IFBIF_BSTP_ADMEDGE 0x0200 /* member stp admin edge enabled */ +#define IFBIF_BSTP_ADMCOST 0x0400 /* member stp admin path cost */ #define IFBIFBITS "\020\001LEARNING\002DISCOVER\003STP\004SPAN" \ "\005STICKY\006EDGE\007AUTOEDGE\010P2P\011AUTOP2P" #define IFBIFMASK ~(IFBIF_BSTP_EDGE|IFBIF_BSTP_AUTOEDGE|IFBIF_BSTP_P2P| \ - IFBIF_BSTP_AUTOP2P) /* not saved */ + IFBIF_BSTP_AUTOP2P|IFBIF_BSTP_ADMEDGE| \ + IFBIF_BSTP_ADMCOST) /* not saved */ /* BRDGFLUSH */ #define IFBF_FLUSHDYN 0x00 /* flush learned addresses only */ |