summaryrefslogtreecommitdiff
path: root/sys/net/if_bridge.c
AgeCommit message (Collapse)Author
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@
2015-07-16Kill IP_ROUTETOETHER.Martin Pieuchot
This pseudo-option is a hack to support return-rst on bridge(4). It passes Ethernet information via a "struct route" through ip_output(). "struct route" is slowly dying... ok claudio@, benno@
2015-07-15m_freem() can handle NULL, do not check for this condition beforehands.Theo de Raadt
ok stsp mpi
2015-07-02Unify the check for up & running between all pseudo-drivers.Martin Pieuchot
2015-07-02By design if_input_process() needs to hold a reference on the receivingMartin Pieuchot
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@
2015-06-30Rename if_output() into if_enqueue() to avoid confusion with commentsMartin Pieuchot
talking about (*ifp->if_output)(). ok claudio@, dlg@
2015-06-30Move the specialized m_copym2() preserving the alignment of the payloadMartin Pieuchot
after the Ethernet header in its own function and use it in bridge_input(). This should fix alignment issues kettenis@ is seeing. ok bluhm@, claudio@
2015-06-25Properly deliver broadcast-like packets to the network stack.Martin Pieuchot
In bridge(4) speak, broadcast-like packets are Ethernet Multicast frames or Unicast for which the destination is unknown. It makes sense to not retransmit broadcast-like packets on the interface they were received but they still must be delivered to the network stack. Problem reported by and ok jasper@
2015-06-25Move brige(4)'s output hook outside of ether_output().Martin Pieuchot
This fix some weird bridge(4) configurations involving pseudo-drivers stacked on top of interfaces in a bridge. Also simplifies the loop prevention logic to match bridge's input path. Instead of using a tag per port/bridge simply flag output mbufs to make sure only one copy per bridge go through bridge_output(). ok bluhm@, claudio@
2015-06-24Increment if_ipackets in if_input().Martin Pieuchot
Note that pseudo-drivers not using if_input() are not affected by this conversion. ok mikeb@, kettenis@, claudio@, dlg@
2015-06-23Adapt bridge(4) to the new if_input() framework.Martin Pieuchot
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@
2015-06-16Store a unique ID, an interface index, rather than a pointer to theMartin Pieuchot
receiving interface in the packet header of every mbuf. The interface pointer should now be retrieved when necessary with if_get(). If a NULL pointer is returned by if_get(), the interface has probably been destroy/removed and the mbuf should be freed. Such mechanism will simplify garbage collection of mbufs and limit problems with dangling ifp pointers. Tested by jmatthew@ and krw@, discussed with many. ok mikeb@, bluhm@, dlg@
2015-06-12Remove superfluous splnet() protection.Martin Pieuchot
ok lteo@
2015-06-11Move away from using hzto(9); OK dlgMike Belopuhov
2015-06-08Merge multiple copies of the code doing VLAN tag insertion back intoMartin Pieuchot
vlan_start(). ok sthen@, phessler@
2015-06-02Use if_input() instead of ether_input_mbuf().Martin Pieuchot
ok jasper@, bluhm@
2015-05-18Do not change "rcvif" without goint through if_input() again otherwiseMartin Pieuchot
the handlers on the new interface won't be executed. Tested by < mxb AT alumni.chalmers DOT se> ok dlg@
2015-05-15Introduce if_output(), a function do to the last steps before enqueuingMartin Pieuchot
a packet on the sending queue of an interface. Tested by many, thanks a lot! ok dlg@, claudio@
2015-05-07fix indentationJonathan Gray
ok miod@
2015-05-04Use ether_input() as default input packet handler and do the necessaryMartin Pieuchot
m_adj(9) to keep bridge(4) working while other pseudo-drivers are converted to if_input(). Tested by mxb <mxb AT alumni DOT chalmers DOT se>, thanks! ok henning@
2015-04-17Stubs and support code for NIC-enabled IPsec bite the dust.Mike Belopuhov
No objection from reyk@, OK markus, hshoexer
2015-04-13Move one "#ifdef NVLAN" chunk needed only if you're running bridge(4) onMartin Pieuchot
to of vlan(4) from ether_input() to bridge_input(). One of the goal of the if_input() plumbing is to stop doing all possible pseudo-drivers checks on every packets. There's no reason that even if you're not running a bridge(4) you've to run this code. This change also will also makes it easier to convert vlan(4) to if_input(). Reviewed by Rafael Zalamena and mikeb@, ok markus@
2015-04-07Do not pass an `ifp' argument to interface input handlers since itMartin Pieuchot
might be overwritten by pseudo-drivers. ok dlg@, henning@
2015-02-06earlier rev 1.112 sys/net/if_vlan.c corrects the mapping of 802.1pSebastian Benoit
prio from the vlan header to our pf priority levels. This fixes the mapping in the bridge code. ok henning
2014-12-22convert to using siphashTed Unangst
2014-12-19unifdef INET in net code as a precursor to removing the pretend option.Ted Unangst
long live the one true internet. ok henning mikeb
2014-12-04Repair VLAN tagging in the bridge output pathMike Belopuhov
Since bridge_output/bridge_ifenqueue replace ether_output that does VLAN tagging and call into if_start directly we need to make sure that tag has been set by the bridge. XXX This abuses "if_output == vlan_output" check, but hopefully XXX vlan(4) will use a distinct if_type someday and this code XXX will be improved. Discussed with henning and Rafael Zalamena, ok henning
2014-11-18move arc4random prototype to systm.h. more appropriate for most codeTed Unangst
to include that than rdnvar.h. ok deraadt dlg
2014-09-08remove uneeded route.h includesJonathan Gray
ok miod@ mpi@
2014-07-22Fewer <netinet/in_systm.h> !Martin Pieuchot
2014-07-12add a size argument to free. will be used soon, but for now default to 0.Ted Unangst
after discussions with beck deraadt kettenis.