FreeBSD Bugzilla – Attachment 121402 Details for
Bug 164369
[if_bridge] [patch] two STP bridges have the same id
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
bridge-stpmac2.diff
bridge-stpmac2.diff (text/x-patch; charset=US-ASCII), 2.78 KB, created by
Andrew Thompson
on 2012-02-23 00:43:28 UTC
(
hide
)
Description:
bridge-stpmac2.diff
Filename:
MIME Type:
Creator:
Andrew Thompson
Created:
2012-02-23 00:43:28 UTC
Size:
2.78 KB
patch
obsolete
>Index: bridgestp.c >=================================================================== >--- bridgestp.c (revision 232004) >+++ bridgestp.c (working copy) >@@ -2012,24 +2012,33 @@ bstp_reinit(struct bstp_state *bs) > struct bstp_port *bp; > struct ifnet *ifp, *mif; > u_char *e_addr; >+ void *bridgeptr; > static const u_char llzero[ETHER_ADDR_LEN]; /* 00:00:00:00:00:00 */ > > BSTP_LOCK_ASSERT(bs); > >+ if (LIST_EMPTY(&bs->bs_bplist)) >+ goto disablestp; >+ > mif = NULL; >+ bridgeptr = LIST_FIRST(&bs->bs_bplist)->bp_ifp->if_bridge; >+ KASSERT(bridgeptr != NULL, ("Invalid bridge pointer")); > /* > * 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; >+ continue; /* Not Ethernet */ > >+ if (ifp->if_bridge != bridgeptr) >+ continue; /* Not part of our bridge */ >+ > if (bstp_addr_cmp(IF_LLADDR(ifp), llzero) == 0) >- continue; >+ continue; /* No mac address set */ > > if (mif == NULL) { > mif = ifp; >@@ -2041,22 +2050,9 @@ bstp_reinit(struct bstp_state *bs) > } > } > IFNET_RUNLOCK_NOSLEEP(); >+ if (mif == NULL) >+ goto disablestp; > >- if (LIST_EMPTY(&bs->bs_bplist) || mif == NULL) { >- /* Set the bridge and root id (lower bits) to zero */ >- bs->bs_bridge_pv.pv_dbridge_id = >- ((uint64_t)bs->bs_bridge_priority) << 48; >- bs->bs_bridge_pv.pv_root_id = bs->bs_bridge_pv.pv_dbridge_id; >- bs->bs_root_pv = bs->bs_bridge_pv; >- /* Disable any remaining ports, they will have no MAC address */ >- LIST_FOREACH(bp, &bs->bs_bplist, bp_next) { >- bp->bp_infois = BSTP_INFO_DISABLED; >- bstp_set_port_role(bp, BSTP_ROLE_DISABLED); >- } >- callout_stop(&bs->bs_bstpcallout); >- return; >- } >- > e_addr = IF_LLADDR(mif); > bs->bs_bridge_pv.pv_dbridge_id = > (((uint64_t)bs->bs_bridge_priority) << 48) | >@@ -2083,6 +2079,20 @@ bstp_reinit(struct bstp_state *bs) > > bstp_assign_roles(bs); > bstp_timer_start(&bs->bs_link_timer, BSTP_LINK_TIMER); >+ return; >+ >+disablestp: >+ /* Set the bridge and root id (lower bits) to zero */ >+ bs->bs_bridge_pv.pv_dbridge_id = >+ ((uint64_t)bs->bs_bridge_priority) << 48; >+ bs->bs_bridge_pv.pv_root_id = bs->bs_bridge_pv.pv_dbridge_id; >+ bs->bs_root_pv = bs->bs_bridge_pv; >+ /* Disable any remaining ports, they will have no MAC address */ >+ LIST_FOREACH(bp, &bs->bs_bplist, bp_next) { >+ bp->bp_infois = BSTP_INFO_DISABLED; >+ bstp_set_port_role(bp, BSTP_ROLE_DISABLED); >+ } >+ callout_stop(&bs->bs_bstpcallout); > } > > static int
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 164369
:
121401
| 121402