summaryrefslogtreecommitdiff
path: root/sys/net/if_bridge.c
AgeCommit message (Collapse)Author
2018-02-07Unbreak carp(4) MAC check in bridge_process().Martin Pieuchot
Introduce bridge_ourether() and move carp(4)-specific SRPL code inside carp_ourether(). ok bluhm@
2018-02-05bcmp -> memcmp; kinda req'd / not-just-kinda ok'd by claudioHenning Brauer
2018-02-05implement an arp filterHenning Brauer
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
2018-01-10get rid of struct carp_if by moving the srpl into struct ifnet if_carp.David Gwynne
currently carp uses a struct carp_if to hold an srp list head, which is accessed by both if_carp in struct ifnet, and via the if input handlers list. this gets rid of some indirection by making if_carp itself the list head, rather than a pointer to the list head via a struct carp_if. it also makes accessing the list consistent by only using if_carp to get to it. ok mpi@
2018-01-09Creating a cloned interface could return ENOMEM due to temporaryAlexander Bluhm
memory shortage. As it is invoked from a system call, it should not fail and wait instead. OK visa@ mpi@
2017-11-20Remove duplicated code working around the fact that ifpromisc() requiredMartin Pieuchot
a DOWN interface. ok visa@
2017-08-17Skip SPD lookups for short packets on IPsec-enabled bridgeMike Belopuhov
When short packets are sent to the bridge with IPsec enabled, an incorrect error path can be taken which leads to a lookup of an SPD entry using an uninitialized SPI. Most of the time this will fail, however there's a chance that an existing SPD entry corresponds to the provided SPI which leads to use of another uninitialized variable used to offset the IP or IPv6 header in order to get to the security protocol header. ESP performs packet length checks and will fail when such packets will reach it, but AH and IPComp don't have similar checks and are affected the most. CID 1452946, 1452957; Severity: Major OK millert, visa, bluhm
2017-05-16Replace remaining splsoftassert(IPL_SOFTNET) by NET_ASSERT_LOCKED().Martin Pieuchot
ok visa@
2017-05-15bridge_ioctl() doesn't need to call splnet().Martin Pieuchot
All interface ioctl()s are executed with the NET_LOCK() held, which protects all soft states of the network stack. IPL_NET is only needed in drivers dealing with hardware and by extension the wireless stack.
2017-05-12Unify duplicate code from address family switch in bridge_ipsec().Alexander Bluhm
Remove an if condition that cannot happen. OK mikeb@
2017-02-05Use percpu counters for ip6statJeremie Courreges-Anglas
Try to follow the existing examples. Some notes: - don't implement counters_dec() yet, which could be used in two similar chunks of code. Let's see if there are more users first. - stop incrementing IPv6-specific mbuf stats, IPv4 has no equivalent. Input from mpi@, ok bluhm@ mpi@
2017-01-24A space here, a space there. Soon we're talking real whitespaceKenneth R Westerback
rectification.
2017-01-23Flag pseudo-interfaces as such in order to call add_net_randomness()Martin Pieuchot
only once per packet. Fix a regression introduced when if_input() started to be called by every pseudo-driver. ok claudio@, dlg@
2017-01-11No need for a splsoftnet()/splx() dance when the KERNEL_LOCK() is whatMartin Pieuchot
serialize access to bridge(4) data structures. ok mikeb@
2016-12-19Assert that IPL_SOFTNET is needed rather than calling splsoftnet()Martin Pieuchot
recursively. ok bluhm@
2016-11-21bridge(4) does not distinguish between routing/forwarding ports, soReyk Floeter
make "addlocal" an alias to "add" on bridge. addlocal is handled differently on switch(4). OK yasuoka@
2016-11-14turn ipstat into a set of percpu counters.David Gwynne
each counter is identified by an enum value which correspond to the original members of the ipstat struct. ipstat_inc(ips_foo) replaces ipstat.ips_foo++ for the actual updates. ipstat_inc is a thin wrapper around counters_inc. counters are still returned to userland via the ipstat struct for now. ok mpi@ mikeb@
2016-10-03Use detach hook to notify bridge(4) about span port removals.Rafael Zalamena
ok mpi@
2016-10-03Use detach hook to notify bridge of interface removal instead of addingRafael Zalamena
code to if.c. ok mpi@
2016-09-29Rename brtag_src/brtag_dst to brtag_peer/brtag_local to avoidReyk Floeter
confusion about the tunnel endpoints when responding to the peer. OK yasuoka@
2016-09-03Add support for a multipoint-to-multipoint mode in vxlan(4). In thisReyk Floeter
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@
2016-09-02Add switch(4) support to ifconfigKazuya Goda
ok deraadt@ yasuoka@ reyk@ henning@
2016-09-01Import switch(4), an in-kernel OpenFlow switch which can work alone.Kazuya Goda
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@
2016-08-31Drop gif(4) support, etherip(4) is what you want now.Martin Pieuchot
ok sthen@, deraadt@, dlg@
2016-06-07Multicast packet are already duplicated in bridge_process() soMartin Pieuchot
no need to loop another copy on the receiving interface. Reported by and ok uebayasi@
2016-05-30Insert a hack to deal with interfaces removing the VLAN header beforeMartin Pieuchot
the packet has been feed to the pseudo-interfaces input handlers. To fix that without introducing a layer violation we should be able to disable HW-vlan on parent when in use with different pseudo-interfaces. In the case of bridge(4) for example it makes no sense to let the interface remove the VLAN header if the kernel has to add it back for every packet. Fix issues reported by sebastia@ and markus@ From dlg@, ok claudio@
2016-04-12Set bridge(4)'s if_output to a dummy function returning EAFNOSUPPORT asMartin Pieuchot
it should not be used to output packets but we have to respect the ifp driver API to some extend. Prevent a panic found the hardway by espie@. ok claudio@, mikeb@, jsg@, krw@
2016-03-30replace bridge_m_dup with m_dup_pkt.David Gwynne
less code for the same effect, which is ETHER_ALIGNed packets. ok mpi@
2016-03-08- bridge_localbroadcast() must call pf_pkt_addr_changed()Alexandr Nedvedicky
(makes KASSERT() in pf_test() to go away) Thanks to Mark and Mattieu for quick testing OK mpi@
2015-12-05remove old lint annotationsTed Unangst
2015-12-04bridge(4) never outputs packets so set its if_output and if_start to NULL.Martin Pieuchot
bridge_output() is used by the stack to duplicate a packet coming from a bridge member to its other ports. Confusion pointed by Momtchil Momtchev on misc@ ok reyk@
2015-12-02Include cleanup.Martin Pieuchot
2015-12-01Split functions in if_bridge.c into if_bridge.c bridgectl.c .Kazuya Goda
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@
2015-12-01Fix bridge to forward broadcast/multicast frames from gif.Kazuya Goda
ok reyk@ mpi@ yasuoka@
2015-11-07Use input handlers for bridge(4).Martin Pieuchot
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@
2015-11-07Don't try to be clever testing if a queue is full before callingMartin Pieuchot
if_enqueue(). As pointed by dlg@, IF_QFULL on works in the priq case. Prompted by a diff from uebayasi@ to export ifi_oqdrops, ok dlg@
2015-10-12Introduce bridge_ifinput() to handle some repeated logic beforeReyk Floeter
if_input() and to have a counterpart for bridge_ifenqueue() that helps to understand the traffic/code flow in bridge better. The bridge currently only puts a single packet on the input mbuf list, and changing will need to undo part of this commit, but it still makes sense to have a well-defined call for the ports receive path. No functional change. OK mpi@
2015-10-05Revert if_oqdrops accounting changes done in kernel, per request from mpi@.Masao Uebayashi
(Especially adding IF_DROP() after IFQ_ENQUEUE() was completely wrong because IFQ_ENQUEUE() already does it. Oops.) After this revert, the situation becomes: - if_snd.ifq_drops is incremented in either IFQ_ENQUEUE() or IF_DROP(), but it is not shown to userland, and - if_data.ifi_oqdrops is shown to userland, but it is not incremented by anyone.
2015-10-05Don't count IF_DROP()'ed packets as if_oerrors too.Masao Uebayashi
mpi@ plans to clean-up IF_DROP()'s, but fix consistent use of it for now. OK dlg@
2015-09-29add sizes to some of the simpler free callsTheo de Raadt
ok mpi
2015-09-10pass a cookie argument to interface input handlers that can be usedMike Belopuhov
to pass additional context or transient data with the similar life time. ok mpi, suggestions, hand holding and ok from dlg
2015-09-10Even the driver that should not be named needs if_put() after if_get().Martin Pieuchot
ok claudio@, dlg@
2015-09-10move the if input handler list to an SRP list.David Gwynne
instead of having every driver that manipulates the ifih list understand SRPLs, this moves that processing into if_ih_insert and if_ih_remove functions. we rely on the kernel lock to serialise the modifications to the list. tested by mpi@ ok mpi@ claudio@ mikeb@
2015-09-09Kill a couple of if_get()s only needed to increment per-ifp IPv6 stats.Martin Pieuchot
We do not export those per-ifp statistics and they will soon all die. "We're putting inet6 on a diet" claudio@ ok dlg@, mikeb@, claudio@
2015-08-26Use the specialized m_copym2() preserving the alignment of the payloadMartin Pieuchot
in bridge_localbroadcast() too. This should fix another alignment issue kettenis@ is seeing. ok dlg@
2015-08-24The bridge list is a relict, delete the remaining LIST_REMOVE.Alexander Bluhm
This fixes a crash during ifconfig bridge0 destroy. OK mpi@
2015-08-18Apply the logic used for "protocol" queues to bridge(4). This allowsMartin Pieuchot
to defer the work currently done in bridge_input() and requiring the KERNEL_LOCK to bridgeintr(). Tested by sthen@ ok rzalamena@, dlg@, bluhm@
2015-07-20Remove splassert(IPL_NET) from if_input().Martin Pieuchot
if_input() has been designed to be able to safely handle a batch of packets from physical drivers to the network stack. Most of these drivers have an interrupt routine executed at IPL_NET and the check made sense during the conversion. However we also want to re-enqueue packets with if_input() from the network stack currently running at IPL_SOFTNET. ok claudio@
2015-07-20Implemented MPLS pseudowire (mpw(4)) to be used with VPLS and VPWS.Rafael Zalamena
ok mpi@, claudio@.
2015-07-17Explicitly do EtherIP encapsulation in bridge_ifenqueue().Martin Pieuchot
The way gif(4) and bridge(4) are plugged together is disgusting but at least this makes the layer violation obvious. Fix a regression introduced by the M_PROTO1 loop prevention cleaning because gif(4) was abusing this flag to figure out if the packet was coming from a bridge(4). Thanks to goda@ for finding this! ok goda@, claudio@