Commit Graph

18 Commits

Author SHA1 Message Date
Andrew Thompson
2885c19ebd Move the interface media check to a taskqueue, some interfaces (usb) sleep
during SIOCGIFMEDIA and we were holding locks.
2012-04-20 10:06:28 +00:00
Andrew Thompson
7702d4013b Add linkstate to bridge(4), set the link to up when at least one underlying
interface is up, otherwise the link is down.

This, among other things, allows carp to work on a bridge.

Prodded by:	glebius
Tested by:	Alexander Lunev
2012-04-20 09:55:50 +00:00
Andrew Thompson
4661f8627c bstp_input() always consumes the packet so remove the mbuf handling dance
around it.

Obtained from:	OpenBSD (r1.37)
2012-02-23 00:59:21 +00:00
Marko Zec
2fe7ca2ca6 Set curvnet context in a callout-trigerred code path.
MFC after:	3 days
2011-06-07 20:46:03 +00:00
Andrew Thompson
9ddd3624d9 Fix spelling.
Obtained from:	OpenBSD
2007-12-09 20:47:12 +00:00
Andrew Thompson
dd04013007 - Ensure the path cost does not exceed 65535 in legacy STP mode.
- If the path cost is calculated when the link is down, set a pending flag so
  it is calculated again when it comes back up.
- To not use 00:00:00:00:00:00 as the bridge id, all interfaces are scanned and
  the lowest number wins. All zeros is too low.

Approved by:	re (rwatson)
2007-08-04 21:09:04 +00:00
Andrew Thompson
e5bda9fb3a Change the passing of callbacks to a struct in case this needs to be extended in the future. 2007-03-09 19:34:55 +00:00
Andrew Thompson
787096051b These days P2P means peer-2-peer (also well known from serveral filesharing
protocols) while PointToPoint has been PtP links. Change the variables
accordingly while the code is still fresh and undocumented.

Requested by:	bz
2006-12-11 23:46:40 +00:00
Shteryana Shopova
daacddcac8 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)
2006-12-04 14:45:02 +00:00
Warner Losh
48f395a6c2 fix typo in last commit 2006-12-01 18:25:18 +00:00
Warner Losh
a0858e10ac Use FreeBDS standard __packed as opposed to the gcc centric
__attribute__(__packed__).
2006-12-01 18:18:35 +00:00
Andrew Thompson
6c32e05ca3 Sync with the OpenBSD port of RSTP
- use flags rather than sperate ioctls for edge, p2p
 - implement p2p and autop2p flags
 - define large pathcost constant as ULL
 - show bridgeid and rootid in ifconfig

Obtained from:	Reyk Floeter <reyk@openbsd.org>
2006-11-27 00:35:40 +00:00
Andrew Thompson
071fff62be use two stage creation of stp ports, this means that the stp variables can be
set before the port is marked STP and they will no longer be overwrittten
2006-11-26 18:43:48 +00:00
Andrew Thompson
c25789cc22 MFp4
- Each stp port is added sequentially so it was possible for our bridgeid to
   change every time because the new port has a lower MAC address.  Instead
   just find the lowest MAC address from all Ethernet adapters in the machine
   as the value only needs to be unique, this stops a lot of churn on the
   protocol.
 - Update the states after enabling or disabling a port.
 - Keep tabs if we have been stopped or started by our parent bridge.
 - The callout only needs to be drained before destroying the mutex, move it to
   bstp_detach.
2006-11-09 22:50:49 +00:00
Andrew Thompson
3fab76690c Bring in support for the Rapid Spanning Tree Protocol (802.1w).
RSTP provides faster spanning tree convergence, the protocol will exchange
information with neighboring switches to quickly transition to forwarding
without creating loops. The code will default to RSTP mode but will downgrade
any port connected to a legacy STP network so is fully backward compatible.

Reviewed by:	syrinx
Tested by:	syrinx
2006-11-01 09:07:47 +00:00
Andrew Thompson
6f2abce0b3 Add a callback so we can notify the parent bridge that a port state change has
occured, we need to do this from a taskqueue to avoid a LOR with the if_bridge
mutex.
2006-08-02 02:47:27 +00:00
Andrew Thompson
51383c37cd Add some statistics that are needed to support RFC4188 as part of the SoC2006
work on a bridge monitoring module for BSNMP.

Submitted by:	shteryana (SoC 2006)
2006-07-31 20:24:46 +00:00
Andrew Thompson
96e47153ea /tmp/cvsuusTrc 2006-07-26 10:43:02 +00:00