summaryrefslogtreecommitdiffstats
path: root/sys/net/if_bridge.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* We have this sequence in bridge(4) ioctl(2) path:mvs2021-01-251-1/+3
| | | | | | | | | | | | | | | | | | | | ifs = ifunit(req->ifbr_ifsname); if (ifs == NULL) { error = ENOENT; break; } if (ifs->if_bridgeidx != ifp->if_index) { error = ESRCH; break; } bif = bridge_getbif(ifs); This sequence repeats 8 times. Also we don't check value returned by bridge_getbig() before use. Newly introduced bridge_getbig() function replaces this sequence. This not only reduces duplicated code but also makes `bif' dereference safe. ok bluhm@
* `struct bstp_state' stores pointer to parent `ifnet' as `bs_ifp'.mvs2020-07-301-4/+5
| | | | | | | Replace this pointer by interface index. This allow us to avoid some use after free issues caused by ifioctl() races. ok sashan@
* Interface index is unsigned integer. Fix the places where it referencedmvs2020-07-291-2/+2
| | | | | | as signed. u_int used within pipex(4) for consistency with other code. ok dlg@ mpi@
* Use interface index instead of pointer to `ifnet' in `struct bstp_port'.mvs2020-07-221-2/+2
| | | | ok yasuoka@
* turn the linkstate hooks into a task list, like the detach hooks.dlg2019-11-071-2/+2
| | | | | | | | | | | | | | | this is largely mechanical, except for carp. this moves the addition of the carp link state hook after we're committed to using the new interface as a carpdev. because the add can't fail, we avoid a complicated unwind dance. also, this tweaks the carp linkstate hook so it only updates the relevant carp interface, not all of the carpdevs on the parent. hrvoje popovski has tested an early version of this diff and it's generally ok, but there's some splasserts that this diff fires that i'll fix in an upcoming diff. ok claudio@
* replace the hooks used with if_detachhooks with a task list.dlg2019-11-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | the main semantic change is that things registering detach hooks have to allocate and set a task structure that then gets added to the list. this means if the task is allocated up front (eg, as part of carps softc or bridges port structure), it avoids the possibility that adding a hook can fail. a lot of drivers weren't checking for failure, and unwinding state in the event of failure in other parts was error prone. while doing this i discovered that the list operations have to be in a particular order, but drivers weren't doing that consistently either. this diff wraps the list ops up so you have to seriously go out of your way to screw them up. ive also sprinkled some NET_ASSERT_LOCKED around the list operations so we can make sure there's no potential for the list to be corrupted, especially while it's being run. hrvoje popovski has tested this a bit, and some issues he discovered have been fixed. ok sashan@
* Switch the list of span interfaces and interfaces to SMR.mpi2019-05-121-12/+16
| | | | | | | | | | | | This removes the KERNEL_LOCK() around the list iteration in bridge_enqueue(). Since the NET_LOCK() isn't protecting any data structure, release it early in all the code paths coming from the Network Stack to prevent possible deadlock situations with smr_barrier(). bridge_input() is still KERNEL_LOCK()ed as well as bridge_filterrule(). ok visa@
* Removes the KERNEL_LOCK() from bridge(4)'s output fast-path.mpi2019-04-281-12/+9
| | | | | | | | This redefines the ifp <-> bridge relationship. No lock can be currently used across the multiples contexts where the bridge has tentacles to protect a pointer, use an interface index. Tested by various, ok dlg@, visa@
* Move the tag mechanism outside of net/if_bridge.c.mpi2019-03-081-3/+3
| | | | | | This will help for future (un)locking. ok visa@
* Protect the hash table with a mutex.mpi2019-02-201-5/+14
| | | | inputs & ok visa@
* Make bridge_rtupdate() return an error value instead of a pointer.mpi2019-02-171-2/+2
|
* Plumbing to simplify upcoming locking.mpi2019-01-291-1/+2
| | | | | | | | | | - Do checks that do not access shared data structures first, they don't need locking and save us some dances. - Use the common !ETHER_IS_MULTICAST() idiom and move some code that won't be executed if the bridge(4) is down. ok bluhm@, visa@
* Convert interface lists from TAILQ to SLIST in preparation for finempi2019-01-171-4/+4
| | | | | | grained locking. ok visa@, florian@
* Stop passing `sc' when it isn't needed and use `ifp' where it's goodmpi2018-12-071-8/+3
| | | | | | enough. ok sthen@, visa@
* Add a new '-protected' option for bridge members.mpi2018-02-081-1/+3
| | | | | | | | | | | Bridge members that are part of the same protected domain, refered by a number between 1 and 31, cannot talk to each others. This is useful to isolate VMs or untrusted networks at layer 2. Members can be part of multiple protected domain making it possible to create complex protected setups. ok ccardenas@, claudio@, dlg@, henning@
* implement an arp filterhenning2018-02-051-1/+18
| | | | | | | | allows arp (and rarp) requests and replies to be matched, including matching based on the source and target host and protocol adresses, and thus control over arp traffic and learning. written for medical x-ray machines, but useful in many spread out L2 networks ok claudio benno
* Stop using pfsockaddr_union outside of pf so that we can remove its usageclaudio2017-01-201-3/+14
| | | | | | inside pf later on. pfsync can use the one from ip_ipsp.h and bridge can have its own version for now. OK mpi@ phessler@
* No need for a splsoftnet()/splx() dance when the KERNEL_LOCK() is whatmpi2017-01-111-2/+2
| | | | | | serialize access to bridge(4) data structures. ok mikeb@
* Use detach hook to notify bridge of interface removal instead of addingrzalamena2016-10-031-2/+2
| | | | | | code to if.c. ok mpi@
* Rename brtag_src/brtag_dst to brtag_peer/brtag_local to avoidreyk2016-09-291-3/+3
| | | | | | confusion about the tunnel endpoints when responding to the peer. OK yasuoka@
* Add support for a multipoint-to-multipoint mode in vxlan(4). In thisreyk2016-09-031-6/+16
| | | | | | | | | | | | mode, vxlan(4) must be configured to accept any virtual network identifier with "vnetid any" and added to a bridge(4) or switch(4). This way the driver will dynamically learn the tunnel endpoints and their vnetids for the responses and can be used to dynamically bridge between VXLANs. It is also being used in combination with switch(4) and the OpenFlow tunnel classifiers. With input from yasuoka@ goda@ OK deraadt@ dlg@
* Add switch(4) support to ifconfiggoda2016-09-021-4/+14
| | | | ok deraadt@ yasuoka@ reyk@ henning@
* Import switch(4), an in-kernel OpenFlow switch which can work alone.goda2016-09-011-1/+3
| | | | | | | | | switch(4) currently supports OpenFlow 1.3.5. Currently, it's disabled by the kernel config. With help from yasuoka@ reyk@ jsg@. ok deraadt@ yasuoka@ reyk@ henning@
* Split functions in if_bridge.c into if_bridge.c bridgectl.c .goda2015-12-011-1/+18
| | | | | | | Splitting functions in if_bridge.c into if_bridge.c for the forwarding part and bridgectl.c for the control part. It shouldn't have any functional change. ok reyk@ mpi@ yasuoka@
* Delete sc_root_port which became unused when RSTP is merged.yasuoka2015-11-281-2/+1
| | | | ok reyk mpi
* Use input handlers for bridge(4).mpi2015-11-071-2/+1
| | | | | | | | This allows more flexible configurations with vlan(4) and bridge(4) on top of the same physical interface. In particular it allows to not feed VLAN tagget packets into a bridge(4). Fix regression reported by Armin Wolfermann on bugs@, ok dlg@
* The bridge list is a relict, delete the remaining LIST_REMOVE.bluhm2015-08-241-2/+1
| | | | | This fixes a crash during ifconfig bridge0 destroy. OK mpi@
* By design if_input_process() needs to hold a reference on the receivingmpi2015-07-021-2/+2
| | | | | | | | | ifp in order to access its ifih handlers. So get rid of if_get() in the various ifih handlers we know the ifp is live at this point. ok dlg@
* Adapt bridge(4) to the new if_input() framework.mpi2015-06-231-3/+2
| | | | | | | | | | | | Move bridge_input() outside of ether_input() in order to duplicate packets flowing through a bridge port before applying any transformation on mbufs. This saves a various m_adj(9)/M_PREPEND(9) dances and remove the bridge(4) hack from vlan(4). Tested by mxb <mxb AT alumni DOT chalmers DOT se> and kettenis@ ok bluhm@
* dont rely on hfsc.h via pfvar.h to include sys/timeout.h.dlg2015-04-121-1/+2
|
* Userland (base & ports) was adapted to always include <netinet/in.h>deraadt2015-01-241-2/+2
| | | | | | before <net/pfvar.h> or <net/if_pflog.h>. The kernel files can be cleaned up next. Some sockaddr_union steps make it into here as well. ok naddy
* convert to using siphashtedu2014-12-221-2/+2
|
* Just use sockaddr_union instead of a handcrafted version and renamereyk2013-10-131-10/+2
| | | | | bridge_tunnelupdate to a more generic name bridge_copyaddr. No functional change.
* Import vxlan(4), the virtual extensible local area network tunnelreyk2013-10-131-1/+14
| | | | | | | | | interface. VXLAN is a UDP-based tunnelling protocol for overlaying virtualized layer 2 networks over layer 3 networks. The implementation is based on draft-mahalingam-dutt-dcops-vxlan-04 and has been tested with other implementations in the wild. put it in deraadt@
* Change interface and span interface lists from LIST to TAILQ.camield2013-01-231-4/+4
| | | | | | | | | | | | | This way the configuration order is preserved. Order matters because MAC address are not unique: vlan interfaces can have the same MAC as their parent. Frames destined for the bridge itself are now delivered to the first-configured interface that matches the MAC instead of the last-configured. This means that the bridge behavior does not suddenly change anymore when adding a vlan interface. ok henning reyk (a while ago)
* Point an interface directly to its bridgeport configuration, insteadcamield2012-10-051-1/+6
| | | | | | | | | | of to the bridge itself. This is ok, since an interface can only be part of one bridge, and the parent bridge is easy to find from the bridgeport. This way we can get rid of a lot of list walks, improving performance and shortening the code. ok henning stsp sthen reyk
* Don't filter spanning tree BPDUs. Either process, or forward them.mpf2012-09-201-2/+2
| | | | | | Even though this violates IEEE 802.1D, we'd rather avoid bridging loops by not getting in the way of STP. OK henning, camield, reyk
* remove bs_list occurrences. fixes panic on destroy.fgsch2010-11-201-2/+1
| | | | ok from the m guild: mikeb@ miod@ mpf@
* Remove unused bstp_list and bstp_attach.mpf2010-10-311-2/+1
| | | | OK blambert, claudio.
* A function that only returns NULL should return void.claudio2010-10-281-2/+2
| | | | | bstp_input() always consumes the packet so remove the mbuf handling dance around it.
* refer to the RSTP point to point option as "PTP" instead of "P2P".reyk2006-12-111-5/+5
| | | | | | | | | | | P2P is commonly used in relation to peer to peer networks, PTP is used in various protocols for layer 2 point to point links (ie., full duplex ethernet links). note that the newly added brconfig commands [-]p2p and [-]autop2p will change to [-]ptp and [-]autoptp. suggested by Andrew Thompson (thompsa@freebsd.org)
* Add Rapid Spanning Tree Protocol support (802.1d-2004) based on workreyk2006-12-031-49/+217
| | | | | | | | | | by Andrew Thompson (thompsa@freebsd.org). The local changes include adoption to our bridge code, reduced stack usage and many other bits. If stp is enabled, RSTP will now be used by default. Thanks for help from Andrew. This code has been in snaps for while now, commit encouraged by deraadt@
* fix a whitespace error causing confusionhenning2006-05-281-2/+2
|
* if the wireless hostap interface belongs to a bridge, learn the node'sreyk2005-10-091-1/+2
| | | | | | | address dynamically on this interface after successful association. this could speed wireless roaming to openbsd accesspoints. ok jason@, jsg@ can't see anything obectionable
* Simplify hashtable (de)allocation by moving it into the clone functions.camield2004-12-231-2/+7
| | | | ok mickey@ henning@, "looks good" markus@ jason@
* add support for ifconfig clone/destroy; ok henning deraadtmarkus2003-12-031-1/+2
|
* no named args in prototypesjason2003-07-151-2/+2
|
* add a pf_tagname field to ifbrlreq and a pf_tag field to ifbrlnode.henning2003-06-251-1/+5
| | | | | | | | on bridge rule load translate tagnames to pf tags using pf_tagname2tag etc if packets match a bridge filter rule tag them using pf_tag_packet() with the given tag help dhartmei@ ok deraadt@ jason@ dhartmei@
* nuke clause 3 & 4jason2003-06-021-6/+1
|
* KNF & ANSI, jason agreeshenning2003-05-301-2/+2
|