summaryrefslogtreecommitdiffstats
path: root/sys/net/if_switch.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* pass the uint64_t dst ethernet address from ether_input to bridges.dlg2021-03-051-3/+3
| | | | tested on amd64 and sparc64.
* we don't have to cast to caddr_t when calling m_copydata anymore.dlg2021-02-251-4/+4
| | | | | | | | | | | | | | | | the first cut of this diff was made with coccinelle using this spatch: @rule@ type caddr_t; expression m, off, len, cp; @@ -m_copydata(m, off, len, (caddr_t)cp) +m_copydata(m, off, len, cp) i had fix it's opinionated idea of formatting by hand though, so i'm not sure it was worth it. ok deraadt@ bluhm@
* Wrap by netlock the whole foreach loop which calls switch_port_detach() inmvs2021-02-231-1/+3
| | | | | | | | | switch_clone_destroy(). This fixes netlock assertion within underlay ifpromisc(). The problem was reported by hrvoje@ [1]. "why not" by deraadt@ 1. https://marc.info/?l=openbsd-bugs&m=161338077403538&w=2
* switch(4): convert ifunit to if_unit(9)mvs2021-01-191-17/+29
| | | | ok dlg@
* Don't call if_deactivate() in switch_clone_destroy(). Followingmvs2021-01-021-2/+1
| | | | | | if_detach() will do this. ok kn@
* Add missing #if's to fix build without bpf(4).mvs2020-08-281-1/+5
| | | | ok deraadt@
* `struct bstp_state' stores pointer to parent `ifnet' as `bs_ifp'.mvs2020-07-301-6/+14
| | | | | | | Replace this pointer by interface index. This allow us to avoid some use after free issues caused by ifioctl() races. ok sashan@
* Add missing `IFXF_CLONED' flag to clone interfaces.mvs2020-07-281-1/+2
| | | | ok mpi@
* Return total size if SIOCBRDGIFS passes in ifbic_len set to zerokn2020-07-281-2/+4
| | | | | | In accordance to bridge(4) which behaves correctly as per the manual. OK dlg
* Use interface index instead of pointer to `ifnet' in `struct bstp_port'.mvs2020-07-221-2/+2
| | | | ok yasuoka@
* register as a bridge port, not an input handler, on member ifaces.dlg2020-07-221-11/+21
| | | | | | | | this is a step toward making all types of bridges coordinate their use of port interfaces, and is a step toward deprecating the interface input handler lists. this has been in snaps as part of a larger diff for over a week.
* let's be explicit about only supporting Ethernet ports as members.dlg2020-07-131-7/+7
| | | | | | | the packet parsing code expects Ethernet packets, so only allow Ethernet interfaces to be added. ok sthen@
* Change users of IFQ_DEQUEUE(), IFQ_ENQUEUE() and IFQ_LEN() to use thepatrick2020-07-101-2/+2
| | | | | | "new" API. ok dlg@ tobhe@
* replace the hooks used with if_detachhooks with a task list.dlg2019-11-061-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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@
* remove the "copy function" argument to bpf_mtap_hdr.dlg2019-09-301-2/+2
| | | | | | | | it was previously (ab)used by pflog, which has since been fixed. apart from that nothing else used it, so we can trim the cruft. ok kn@ claudio@ visa@ visa@ also made sure i fixed ipw(4) so i386 won't break.
* Unused switch_port variable.akoshibe2019-05-121-4/+1
|
* Add port protection support to switch(4). The behavior copies that ofakoshibe2019-05-101-2/+16
| | | | | | | | | | | | | bridge(4), where the SIOCBRDGSIFPROT ioctl can be used to add a port to up to 31 protected domains. This allows configuration by specifying a list of IDs to the 'protected' option in ifconfig(8): # ifconfig switch0 protected pair1 1,2,.. Domain membership is checked for unicast, flooded (broadcast), and local (host-network-bound, e.g. trunk) traffic. OK benno@
* Removes the KERNEL_LOCK() from bridge(4)'s output fast-path.mpi2019-04-281-2/+2
| | | | | | | | 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@
* Fix mbuf releated crashes in switch(4). They have been found bybluhm2018-12-281-7/+10
| | | | | | | | | | | | | | syzkaller as pool corruption panic. It is unclear which bug caused what, but it should be better now. - Check M_PKTHDR with assertion before accessing m_pkthdr. - Do not access oh_length without m_pullup(). - After checking if there is space at the end of the mbuf, don't overwrite the data at the beginning. Append the new content. - Do not set m_len and m_pkthdr.len when it is unclear whether the ofp_error header fits at all. Use m_makespace() to adjust the mbuf. Reported-by: syzbot+6efc0a9d5b700b54392e@syzkaller.appspotmail.com test akoshibe@; OK claudio@
* Stop passing `sc' when it isn't needed and use `ifp' where it's goodmpi2018-12-071-3/+2
| | | | | | enough. ok sthen@, visa@
* Remove almost unused `flags' argument of suser().mpi2018-02-191-4/+4
| | | | | | | The account flag `ASU' will no longer be set but that makes suser() mpsafe since it no longer mess with a per-process field. No objection from millert@, ok tedu@, bluhm@
* Creating a cloned interface could return ENOMEM due to temporarybluhm2018-01-091-3/+1
| | | | | | memory shortage. As it is invoked from a system call, it should not fail and wait instead. OK visa@ mpi@
* Remove duplicated code working around the fact that ifpromisc() requiredmpi2017-11-201-28/+3
| | | | | | a DOWN interface. ok visa@
* Move IPv4 & IPv6 incoming/forwarding path, PIPEX ppp processing andmpi2017-05-311-4/+2
| | | | | | | | | | | | | | | | | | | | | IPv4 & IPv6 dispatch functions outside the KERNEL_LOCK(). We currently rely on the NET_LOCK() serializing access to most global data structures for that. IP input queues are no longer used in the forwarding case. They still exist as boundary between the network and transport layers because TCP/UDP & friends still need the KERNEL_LOCK(). Since we do not want to grab the NET_LOCK() for every packet, the softnet thread will do it once before processing a batch. That means the L2 processing path, which is currently running without lock, will now run with the NET_LOCK(). IPsec isn't ready to run without KERNEL_LOCK(), so the softnet thread will grab the KERNEL_LOCK() as soon as ``ipsec_in_use'' is set. Tested by Hrvoje Popovski. ok visa@, bluhm@, henning@
* Make a kernel with switch(4) but without INET6 compile again.bluhm2017-05-121-1/+7
| | | | | | Sprinkle some #ifdef INET6 and do not use in6addr_any from the netinet6 code. test and OK rzalamena@
* Clean-up switch(4) device by removing excess prototypes, verbose debugsrzalamena2017-01-171-36/+3
| | | | | | and unused functions. ok reyk@
* Validate the OFP header to make sure it always have a sane size, alsorzalamena2016-12-221-1/+8
| | | | | | | make sure to not accept anything else outside of the header size boundaries. ok reyk@
* Rename "flowmax" to "maxflow" and give each switch(4) ioctl areyk2016-11-281-2/+2
| | | | | | dedicated number. Both changes for consistency. OK rzalamena@
* Fix panic on detach hook when interfaces get destroyed.rzalamena2016-11-221-2/+3
| | | | ok reyk@
* Extend the DLT_OPENFLOW header to include the switch datapath id.reyk2016-11-201-4/+9
| | | | OK rzalamena@
* Add new DLT_OPENFLOW link-type to allow using tcpdump to debug switch(4),reyk2016-11-161-3/+10
| | | | | | | | eg. tcpdump -y openflow -i switch0 Includes a minor bump for libpcap. Feedback and OK rzalamena@
* Add support for partial writes in switchwrite so we can use multiplerzalamena2016-11-101-1/+30
| | | | | | | write() to write one packet. With this we also get support for writing multiple ofp packets with a single write. ok mikeb@
* Remove unused function, the code is already inlined in action_outputrzalamena2016-10-281-22/+1
| | | | | | function. ok reyk@
* When doing pktout we must run the classifier again, because some action(s)rzalamena2016-10-281-4/+1
| | | | | | | might want to use it. For buffered packets we probably need to save that somehow else, but we don't support it now. ok reyk@
* Add missing if_put() in the switch(4) destroy path.rzalamena2016-10-081-3/+4
| | | | ok mikeb@
* Use detach hook to notify switch(4) about interface removals instead ofrzalamena2016-10-071-12/+10
| | | | | | adding code to if.c. ok mpi@
* Rename brtag_src/brtag_dst to brtag_peer/brtag_local to avoidreyk2016-09-291-8/+8
| | | | | | confusion about the tunnel endpoints when responding to the peer. OK yasuoka@
* Fix a kernel panic that happened when destroying interfaces attached torzalamena2016-09-281-8/+19
| | | | | | the switch(4) without prior removal. ok reyk@, goda@
* Fixed uninitialized variable in switch_process()goda2016-09-041-2/+2
|
* Make per-packet allocated memory use pool in switch(4)goda2016-09-041-3/+4
| | | | ok yasuoka@ reyk@
* Add support for a multipoint-to-multipoint mode in vxlan(4). In thisreyk2016-09-031-2/+39
| | | | | | | | | | | | 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-3/+134
| | | | ok deraadt@ yasuoka@ reyk@ henning@
* Import switch(4), an in-kernel OpenFlow switch which can work alone.goda2016-09-011-0/+1374
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@