summaryrefslogtreecommitdiffstats
path: root/sys/net/bridgestp.c
Commit message (Collapse)AuthorAgeFilesLines
* Use m_get/m_gethdr instead of compat macros.glebius2013-03-151-2/+2
| | | | Sponsored by: Nginx, Inc.
* Mechanically substitute flags from historic mbuf allocator withglebius2012-12-051-2/+2
| | | | | | | | | malloc(9) flags within sys. Exceptions: - sys/contrib not touched - sys/mbuf.h edited manually
* Revert previous commit...kevlo2012-10-101-1/+1
| | | | Pointyhat to: kevlo (myself)
* Prefer NULL over 0 for pointerskevlo2012-10-091-1/+1
|
* Move the interface media check to a taskqueue, some interfaces (usb) sleepthompsa2012-04-201-21/+43
| | | | during SIOCGIFMEDIA and we were holding locks.
* Add linkstate to bridge(4), set the link to up when at least one underlyingthompsa2012-04-201-21/+7
| | | | | | | | | 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
* Only look for a usable MAC address for the bridge ID from ports within ourthompsa2012-02-241-20/+30
| | | | | | | | | bridge, this allows us to have more than one independent bridge in the same STP domain. PR: kern/164369 Submitted by: Nikos Vassiliadis (earlier version) MFC after: 2 weeks
* Indicate this function decrements the timer as well as testing for expiry.thompsa2012-02-231-11/+11
|
* Now that network interfaces advertise if they support linkstate notificationsthompsa2012-02-231-3/+5
| | | | we do not need to perform a media ioctl every 15 seconds.
* bstp_input() always consumes the packet so remove the mbuf handling dancethompsa2012-02-231-3/+2
| | | | | | around it. Obtained from: OpenBSD (r1.37)
* Set curvnet context in a callout-trigerred code path.zec2011-06-071-0/+5
| | | | MFC after: 3 days
* Rework global locks for interface list and index management, correctingrwatson2009-08-231-2/+2
| | | | | | | | | | | | | | several critical bugs, including race conditions and lock order issues: Replace the single rwlock, ifnet_lock, with two locks, an rwlock and an sxlock. Either can be held to stablize the lists and indexes, but both are required to write. This allows the list to be held stable in both network interrupt contexts and sleepable user threads across sleeping memory allocations or device driver interactions. As before, writes to the interface list must occur from sleepable contexts. Reviewed by: bz, julian MFC after: 3 days
* Merge the remainder of kern_vimage.c and vimage.h into vnet.c andrwatson2009-08-011-1/+0
| | | | | | | | | | vnet.h, we now use jails (rather than vimages) as the abstraction for virtualization management, and what remained was specific to virtual network stacks. Minor cleanups are done in the process, and comments updated to reflect these changes. Reviewed by: bz Approved by: re (vimage blanket)
* Build on Jeff Roberson's linker-set based dynamic per-CPU allocatorrwatson2009-07-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (DPCPU), as suggested by Peter Wemm, and implement a new per-virtual network stack memory allocator. Modify vnet to use the allocator instead of monolithic global container structures (vinet, ...). This change solves many binary compatibility problems associated with VIMAGE, and restores ELF symbols for virtualized global variables. Each virtualized global variable exists as a "reference copy", and also once per virtual network stack. Virtualized global variables are tagged at compile-time, placing the in a special linker set, which is loaded into a contiguous region of kernel memory. Virtualized global variables in the base kernel are linked as normal, but those in modules are copied and relocated to a reserved portion of the kernel's vnet region with the help of a the kernel linker. Virtualized global variables exist in per-vnet memory set up when the network stack instance is created, and are initialized statically from the reference copy. Run-time access occurs via an accessor macro, which converts from the current vnet and requested symbol to a per-vnet address. When "options VIMAGE" is not compiled into the kernel, normal global ELF symbols will be used instead and indirection is avoided. This change restores static initialization for network stack global variables, restores support for non-global symbols and types, eliminates the need for many subsystem constructors, eliminates large per-subsystem structures that caused many binary compatibility issues both for monitoring applications (netstat) and kernel modules, removes the per-function INIT_VNET_*() macros throughout the stack, eliminates the need for vnet_symmap ksym(2) munging, and eliminates duplicate definitions of virtualized globals under VIMAGE_GLOBALS. Bump __FreeBSD_version and update UPDATING. Portions submitted by: bz Reviewed by: bz, zec Discussed with: gnn, jamie, jeff, jhb, julian, sam Suggested by: peter Approved by: re (kensmith)
* After cleaning up rt_tables from vnet.h and cleaning up opt_route.hbz2009-06-231-1/+0
| | | | | a lot of files no longer need route.h either. Garbage collect them. While here remove now unneeded vnet.h #includes as well.
* In non-debugging mode make this define (void)0 instead of nothing. Thisrdivacky2009-06-211-1/+1
| | | | | | | | | | helps to catch bugs like the below with clang. if (cond); <--- note the trailing ; something(); Approved by: ed (mentor) Discussed on: current@
* After r193232 rt_tables in vnet.h are no longer indirectly dependent onbz2009-06-081-2/+0
| | | | | | | | | the ROUTETABLES kernel option thus there is no need to include opt_route.h anymore in all consumers of vnet.h and no longer depend on it for module builds. Remove the hidden include in flowtable.h as well and leave the two explicit #includes in ip_input.c and ip_output.c.
* 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
OpenPOWER on IntegriCloud