summaryrefslogtreecommitdiffstats
path: root/sys/net/bridgestp.c
Commit message (Collapse)AuthorAgeFilesLines
* replace IFQ_ENQUEUE + if_start with if_transmitkmacy2009-04-271-14/+2
|
* For all files including net/vnet.h directly include opt_route.h andbz2009-02-271-0/+3
| | | | | | | | | | | | | | net/route.h. Remove the hidden include of opt_route.h and net/route.h from net/vnet.h. We need to make sure that both opt_route.h and net/route.h are included before net/vnet.h because of the way MRT figures out the number of FIBs from the kernel option. If we do not, we end up with the default number of 1 when including net/vnet.h and array sizes are wrong. This does not change the list of files which depend on opt_route.h but we can identify them now more easily.
* Rather than using hidden includes (with cicular dependencies),bz2008-12-021-0/+1
| | | | | | | | | | | directly include only the header files needed. This reduces the unneeded spamming of various headers into lots of files. For now, this leaves us with very few modules including vnet.h and thus needing to depend on opt_route.h. Reviewed by: brooks, gnn, des, zec, imp Sponsored by: The FreeBSD Foundation
* Step 1.5 of importing the network stack virtualization infrastructurezec2008-10-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from the vimage project, as per plan established at devsummit 08/08: http://wiki.freebsd.org/Image/Notes200808DevSummit Introduce INIT_VNET_*() initializer macros, VNET_FOREACH() iterator macros, and CURVNET_SET() context setting macros, all currently resolving to NOPs. Prepare for virtualization of selected SYSCTL objects by introducing a family of SYSCTL_V_*() macros, currently resolving to their global counterparts, i.e. SYSCTL_V_INT() == SYSCTL_INT(). Move selected #defines from sys/sys/vimage.h to newly introduced header files specific to virtualized subsystems (sys/net/vnet.h, sys/netinet/vinet.h etc.). All the changes are verified to have zero functional impact at this point in time by doing MD5 comparision between pre- and post-change object files(*). (*) netipsec/keysock.c did not validate depending on compile time options. Implemented by: julian, bz, brooks, zec Reviewed by: julian, bz, brooks, kris, rwatson, ... Approved by: julian (mentor) Obtained from: //depot/projects/vimage-commit2/... X-MFC after: never Sponsored by: NLnet Foundation, The FreeBSD Foundation
* Commit step 1 of the vimage project, (network stack)bz2008-08-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | virtualization work done by Marko Zec (zec@). This is the first in a series of commits over the course of the next few weeks. Mark all uses of global variables to be virtualized with a V_ prefix. Use macros to map them back to their global names for now, so this is a NOP change only. We hope to have caught at least 85-90% of what is needed so we do not invalidate a lot of outstanding patches again. Obtained from: //depot/projects/vimage-commit2/... Reviewed by: brooks, des, ed, mav, julian, jamie, kris, rwatson, zec, ... (various people I forgot, different versions) md5 (with a bit of help) Sponsored by: NLnet Foundation, The FreeBSD Foundation X-MFC after: never V_Commit_Message_Reviewed_By: more people than the patch
* Fix spelling.thompsa2007-12-091-7/+7
| | | | Obtained from: OpenBSD
* If the STP state machine is stopped then clear the bridge-id and root-id.thompsa2007-08-181-8/+13
| | | | Approved by: re (kensmith)
* - Ensure the path cost does not exceed 65535 in legacy STP mode.thompsa2007-08-041-2/+30
| | | | | | | | | - 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)
* Check the correct port to see if synced is true.thompsa2007-06-221-2/+2
| | | | | | | PR: misc/113958 Submitted by: Aaron Needles Approved by: re (bmah) MFC after: 1 week
* Properly move the setting of bstp_linkstate_p to the bridgestp module.thompsa2007-03-141-0/+1
|
* Change the passing of callbacks to a struct in case this needs to be ↵thompsa2007-03-091-4/+3
| | | | extended in the future.
* Set topology change propagation on all ports _except_ the caller.thompsa2007-01-181-1/+1
|
* These days P2P means peer-2-peer (also well known from serveral filesharingthompsa2006-12-111-10/+10
| | | | | | | protocols) while PointToPoint has been PtP links. Change the variables accordingly while the code is still fresh and undocumented. Requested by: bz
* Add two new flags to if_bridge(4) indicating whether the edge flagsyrinx2006-12-041-2/+9
| | | | | | | | | | | | | | 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)
* Sync with the OpenBSD port of RSTPthompsa2006-11-271-3/+33
| | | | | | | | | - 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>
* Initialize the port info, this shouldnt have been removed in r1.28thompsa2006-11-261-0/+1
|
* Remove redundant setting of port state.thompsa2006-11-261-1/+0
|
* use two stage creation of stp ports, this means that the stp variables can bethompsa2006-11-261-17/+24
| | | | set before the port is marked STP and they will no longer be overwrittten
* Do not call bstp_stop() internally as it clears the running flag which causesthompsa2006-11-191-11/+3
| | | | | | the timer to never be restarted. Reported by: bz
* MFp4thompsa2006-11-091-20/+43
| | | | | | | | | | | | - 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.
* Defer sending the bpdu from bstp_update_info as all code paths will test thisthompsa2006-11-031-1/+1
| | | | flag anyway.
* Do not test all the conditions if the port is already forwarding. Also print athompsa2006-11-021-3/+7
| | | | | debug message if the port is agreed as it is an important condition of the protocol.
* Fix a resource leak when the mbuf pointer changes.thompsa2006-11-021-15/+13
| | | | | CID: 1564, 1565 Found by: Coverity Prevent (tm)
* If the port is agreed or edge then allow it go go straight to forwarding ratherthompsa2006-11-021-7/+8
| | | | than waiting another tick (1s) for the states to be checked again.
* Bring in support for the Rapid Spanning Tree Protocol (802.1w).thompsa2006-11-011-788/+1646
| | | | | | | | | | 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
* Remove licence clauses 3 & 4thompsa2006-10-011-5/+0
| | | | OKed by: Jason L. Wright
* Add the module version to fix the loading with if_bridge.thompsa2006-08-121-0/+1
| | | | | Reported by: keramida Tested by: keramida
* Fix style in the last commit, the variable declaration goes at the top of thethompsa2006-08-021-1/+2
| | | | function.
* Add a callback so we can notify the parent bridge that a port state change hasthompsa2006-08-021-3/+34
| | | | | occured, we need to do this from a taskqueue to avoid a LOR with the if_bridge mutex.
* Be sure to disable the port when removing it from STP.thompsa2006-08-021-0/+2
|
* Add some statistics that are needed to support RFC4188 as part of the SoC2006thompsa2006-07-311-0/+10
| | | | | | work on a bridge monitoring module for BSNMP. Submitted by: shteryana (SoC 2006)
* /tmp/cvsuusTrcthompsa2006-07-261-561/+631
|
* If we miss the LINK_UP event from the network interface then the bridge portthompsa2006-03-061-13/+10
| | | | | | | | | will remain in the disabled state until another link event happens in the future (if at all). Add a timer to periodically check the interface state and recover. Reported by: Nik Lam <freebsdnik j2d.lam.net.au> MFC after: 3 days
* Fix up the Bridge Identifier field in the BPDU packet.thompsa2006-02-281-15/+30
| | | | | | | | | | - use the cu_bridge_id rather than the cu_rootid for the bridge address [1] - the memcmp return value is not signed so the wrong interface may have been selected - fix up the calculation of sc_bridge_id PR: kern/93909 [1] MFC after: 3 days
* Minor whitespace cleanup.thompsa2005-12-171-1/+1
|
* Change most of the bridge and stp funtions to static. This has highlightedthompsa2005-10-141-99/+112
| | | | | | | | | | | that the following funtions are not used, wrap in '#ifdef noused' for the moment. bstp_enable_change_detection bstp_disable_change_detection bstp_set_bridge_priority bstp_set_port_priority bstp_set_path_cost
* Further clean up the bridge hooks in if_ethersubr.c and ng_ether.cthompsa2005-10-141-1/+0
| | | | | | - move the function pointer definitions to if_bridgevar.h - move most of the logic to the new BRIDGE_INPUT and BRIDGE_OUTPUT macros - remove unneeded functions from if_bridgevar.h and sort a little.
* Do not unconditionally set a spanning tree port to forwarding as the link may bethompsa2005-10-111-1/+1
| | | | | | down when we attach. We wont get updated until a linkstate change happens. Go via bstp_ifupdstatus() which checks the media status first.
* Mark the callouts as MPSAFE as if_bridge has been giant-free since day 1.thompsa2005-08-181-3/+1
| | | | | | | Use the SMP friendly callout_init_mtx() while we are here. Approved by: mlaier (mentor) MFC after: 3 days
* Ensure that we are holding the lock when initialising the bridge interface. Wethompsa2005-08-151-0/+2
| | | | | | | | | | | | could initialise while unlocked if the bridge is not up when setting the inet address, ether_ioctl() would call bridge_init. Change it so bridge_init is always called unlocked and then locks before calling bstp_initialization(). Reported by: Michal Mertl Approved by: mlaier (mentor) MFC after: 3 days
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andrwatson2005-08-091-3/+3
| | | | | | | | | | | | | | IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to ifnet.if_drv_flags. Device drivers are now responsible for synchronizing access to these flags, as they are in if_drv_flags. This helps prevent races between the network stack and device driver in maintaining the interface flags field. Many __FreeBSD__ and __FreeBSD_version checks maintained and continued; some less so. Reviewed by: pjd, bz MFC after: 7 days
* - Previously when broadcasting to N number of interfaces we would run pfilthompsa2005-07-061-2/+2
| | | | | | | | | | | | | | | | | | | hooks for each outgoing interface but also run pfil hooks _N times_ on the bridge interface. This is changed so pfil hooks are run once for the bridge interface (bridge0) and then only on the outgoing interfaces in the broadcast loop. - Simplify bridge_enqueue() by moving bridge_pfil() to the callers. - Check (inet6_pfil_hook.ph_busy_count >= 0), it may be possible to have a packet filter hooked for only ipv6 but we were only checking if ipv4 hooks were busy. - Minor optimisation for null mbuf check after bridge_pfil(), move it into the if-block as it couldnt possibly be null outside. Prodded by: mlaier Approved by: re (scottl), mlaier (mentor)
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-101-3/+1
| | | | | | | | | | | | | | | | | | | | struct ifnet or the layer 2 common structure it was embedded in have been replaced with a struct ifnet pointer to be filled by a call to the new function, if_alloc(). The layer 2 common structure is also allocated via if_alloc() based on the interface type. It is hung off the new struct ifnet member, if_l2com. This change removes the size of these structures from the kernel ABI and will allow us to better manage them as interfaces come and go. Other changes of note: - Struct arpcom is no longer referenced in normal interface code. Instead the Ethernet address is accessed via the IFP2ENADDR() macro. To enforce this ac_enaddr has been renamed to _ac_enaddr. - The second argument to ether_ifattach is now always the mac address from driver private storage rather than sometimes being ac_enaddr. Reviewed by: sobomax, sam
* Add if_bridge, which provides more advanced Ethernet bridging and 802.1dthompsa2005-06-051-0/+1174
spanning tree support. Based on Jason Wright's bridge driver from OpenBSD, and modified by Jason R. Thorpe in NetBSD. Reviewed by: mlaier, bms, green Silence from: -net Approved by: mlaier (mentor) Obtained from: NetBSD
OpenPOWER on IntegriCloud