aboutsummaryrefslogtreecommitdiff
path: root/sys/net/if_bridgevar.h
Commit message (Collapse)AuthorAgeFilesLines
* bridge: Move locking defines into if_bridge.cKristof Provost2020-02-261-38/+0
| | | | | | | | | | | | | The locking defines for if_bridge used to live in if_bridgevar.h, but they're only ever used by the bridge implementation itself (in if_bridge.c). Moving them into the .c file. Reported by: philip, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23808 Notes: svn path=/head/; revision=358325
* Allow different bridge types to coexistMatt Macy2018-05-111-8/+5
| | | | | | | | | | | | | | if_bridge has a lot of limitations that make it scale poorly to higher data rates. In my projects/VPC branch I leverage the bridge interface between layers for my high speed soft switch as well as for purposes of stacking in general. Reviewed by: sbruno@ Approved by: sbruno@ Differential Revision: https://reviews.freebsd.org/D15344 Notes: svn path=/head/; revision=333481
* sys: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326272
* bridge: Release the bridge lock when calling bridge_set_ifcap()Kristof Provost2017-01-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | This calls ioctl() handlers for the different interfaces in the bridge. These handlers expect to get called in an ioctl context where it's safe for them to sleep. We may not sleep with the bridge lock held. However, we still need to protect the interface list, to ensure it doesn't get changed while we iterate over it. Use BRIDGE_XLOCK(), which prevents bridge members from being removed. Adding bridge members is safe, because it uses LIST_INSERT_HEAD(). This caused panics when adding xen interfaces to a bridge. PR: 216304 Reviewed by: ae MFC after: 1 week Sponsored by: RootBSD Differential Revision: https://reviews.freebsd.org/D9290 Notes: svn path=/head/; revision=312782
* Add an option to limit the number of source MACs that can be behind a bridgeAndrew Thompson2007-11-041-0/+5
| | | | | | | | | | | interface. Once the limit is reached packets with unknown source addresses are dropped until an existing host cache entry expires or is removed. Useful to use with the STICKY cache option. Sponsored by: miniSuperHappyDevHouse NZ Notes: svn path=/head/; revision=173320
* Add a bridge interface flag called PRIVATE where any private port can notAndrew Thompson2007-08-011-1/+3
| | | | | | | | | | | | | | | | | | communicate with another private port. All unicast/broadcast/multicast layer2 traffic is blocked so it works much the same way as using firewall rules but scales better and is generally easier as firewall packages usually do not allow ARP blocking. An example usage would be having a number of customers on separate vlans bridged with a server network. All the vlans are marked private, they can all communicate with the server network unhindered, but can not exchange any traffic whatsoever with each other. Approved by: re (rwatson) Notes: svn path=/head/; revision=171678
* Avoid holding the softc lock when using copyout().Andrew Thompson2007-07-261-1/+0
| | | | | | | | Reported by: dfr Approved by: re (rwatson) Notes: svn path=/head/; revision=171603
* Add the vlan tag to the bridge route table. This allows a vlan trunk to beAndrew Thompson2007-06-131-0/+1
| | | | | | | | | | bridged, previously legitimate traffic was not passed as the bridge could not tell that it was on a different Ethernet segment. All non-tagged traffic is treated as vlan1 as per IEEE 802.1Q-2003 Notes: svn path=/head/; revision=170681
* These days P2P means peer-2-peer (also well known from serveral filesharingAndrew Thompson2006-12-111-5/+5
| | | | | | | | | | protocols) while PointToPoint has been PtP links. Change the variables accordingly while the code is still fresh and undocumented. Requested by: bz Notes: svn path=/head/; revision=165105
* Add two new flags to if_bridge(4) indicating whether the edge flagShteryana Shopova2006-12-041-1/+4
| | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=164880
* Sync with the OpenBSD port of RSTPAndrew Thompson2006-11-271-11/+15
| | | | | | | | | | | | - 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> Notes: svn path=/head/; revision=164653
* Add a new address cache type called sticky. On an interface marked sticky anyAndrew Thompson2006-11-091-2/+4
| | | | | | | | | | | address learned by the bridge is made permanent, the address will not age out and most importantly will not migrate to another interface. This can be used to stop mac address poisoning or clients roaming in much the same way as static entries without the hassle of preloading the table. Notes: svn path=/head/; revision=164112
* Bring in support for the Rapid Spanning Tree Protocol (802.1w).Andrew Thompson2006-11-011-3/+18
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=163863
* Add some statistics that are needed to support RFC4188 as part of the SoC2006Andrew Thompson2006-07-311-0/+43
| | | | | | | | | work on a bridge monitoring module for BSNMP. Submitted by: shteryana (SoC 2006) Notes: svn path=/head/; revision=160867
* Remove the dependency of bridgestp.h on if_bridgevar.h by moving a couple ofAndrew Thompson2006-07-271-48/+0
| | | | | | | private structures to if_bridge.c. Notes: svn path=/head/; revision=160769
* /tmp/cvsuusTrcAndrew Thompson2006-07-261-76/+2
| | | | Notes: svn path=/head/; revision=160703
* If we miss the LINK_UP event from the network interface then the bridge portAndrew Thompson2006-03-061-0/+1
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=156328
* Add code that clears certain capabilities from the member interface, these areAndrew Thompson2006-01-141-0/+1
| | | | | | | | | | | | | | | | restored when its removed from the bridge. At the moment we only clear IFCAP_TXCSUM. Since a locally generated packet on the bridge may be sent out any one or more interfaces it cant be assumed that every card does hardware csums. Most bridges don't generate a lot of traffic themselves so turning off offloading won't hurt, bridged packets are unaffected. Tested by: Bruce Walker (bmw borderware.com) MFC after: 5 days Notes: svn path=/head/; revision=154336
* Minor whitespace cleanup.Andrew Thompson2006-01-021-1/+1
| | | | Notes: svn path=/head/; revision=153967
* Change from a callback in if_ethersubr to using EVENTHANDLER in order to detachAndrew Thompson2005-12-171-1/+1
| | | | | | | | | | span ports when they disappear. The span port does not have a pointer to the softc so revert r1.31 and bring back the softc linked-list. MFC after: 2 weeks Notes: svn path=/head/; revision=153494
* Add support for creating span ports so that one can snoop bridged trafficAndrew Thompson2005-12-141-1/+5
| | | | | | | | | | from another interface/machine/network. Obtained from: OpenBSD MFC after: 2 weeks Notes: svn path=/head/; revision=153408
* Move the cloned interface list management in to if_clone. For some drivers theAndrew Thompson2005-11-081-1/+0
| | | | | | | | | | | | | softc lists and associated mutex are now unused so these have been removed. Calling if_clone_detach() will now destroy all the cloned interfaces for the driver and in most cases is all thats needed to unload. Idea by: brooks Reviewed by: brooks Notes: svn path=/head/; revision=152209
* Further clean up the bridge hooks in if_ethersubr.c and ng_ether.cAndrew Thompson2005-10-141-8/+22
| | | | | | | | | - 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. Notes: svn path=/head/; revision=151305
* - Previously when broadcasting to N number of interfaces we would run pfilAndrew Thompson2005-07-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=147786
* Stop embedding struct ifnet at the top of driver softcs. Instead theBrooks Davis2005-06-101-1/+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 Notes: svn path=/head/; revision=147256
* Add dummynet(4) support to if_bridge, this code is largely based on bridge.c.Andrew Thompson2005-06-101-0/+1
| | | | | | | | | | This is the final piece to match bridge.c in functionality, we can now be a drop-in replacement. Approved by: mlaier (mentor) Notes: svn path=/head/; revision=147205
* Add if_bridge, which provides more advanced Ethernet bridging and 802.1dAndrew Thompson2005-06-051-0/+357
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 Notes: svn path=/head/; revision=146985