summaryrefslogtreecommitdiffstats
path: root/sys/net/if_bridge.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Introduce bridge_ifinput() to handle some repeated logic beforereyk2015-10-121-18/+19
| | | | | | | | | | | 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@
* Revert if_oqdrops accounting changes done in kernel, per request from mpi@.uebayasi2015-10-051-1/+4
| | | | | | | | | | | | | (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.
* Don't count IF_DROP()'ed packets as if_oerrors too.uebayasi2015-10-051-4/+1
| | | | | | mpi@ plans to clean-up IF_DROP()'s, but fix consistent use of it for now. OK dlg@
* add sizes to some of the simpler free callsderaadt2015-09-291-13/+13
| | | | ok mpi
* pass a cookie argument to interface input handlers that can be usedmikeb2015-09-101-3/+3
| | | | | | | to pass additional context or transient data with the similar life time. ok mpi, suggestions, hand holding and ok from dlg
* Even the driver that should not be named needs if_put() after if_get().mpi2015-09-101-12/+16
| | | | ok claudio@, dlg@
* move the if input handler list to an SRP list.dlg2015-09-101-17/+4
| | | | | | | | | | | | 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@
* Kill a couple of if_get()s only needed to increment per-ifp IPv6 stats.mpi2015-09-091-5/+1
| | | | | | | | 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@
* Use the specialized m_copym2() preserving the alignment of the payloadmpi2015-08-261-2/+2
| | | | | | | | in bridge_localbroadcast() too. This should fix another alignment issue kettenis@ is seeing. ok dlg@
* The bridge list is a relict, delete the remaining LIST_REMOVE.bluhm2015-08-241-6/+1
| | | | | This fixes a crash during ifconfig bridge0 destroy. OK mpi@
* Apply the logic used for "protocol" queues to bridge(4). This allowsmpi2015-08-181-80/+57
| | | | | | | | | to defer the work currently done in bridge_input() and requiring the KERNEL_LOCK to bridgeintr(). Tested by sthen@ ok rzalamena@, dlg@, bluhm@
* Remove splassert(IPL_NET) from if_input().mpi2015-07-201-4/+1
| | | | | | | | | | | 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@
* Implemented MPLS pseudowire (mpw(4)) to be used with VPLS and VPWS.rzalamena2015-07-201-3/+25
| | | | ok mpi@, claudio@.
* Explicitly do EtherIP encapsulation in bridge_ifenqueue().mpi2015-07-171-2/+12
| | | | | | | | | | | | | 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@
* Kill IP_ROUTETOETHER.mpi2015-07-161-5/+4
| | | | | | | | | 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@
* m_freem() can handle NULL, do not check for this condition beforehands.deraadt2015-07-151-5/+3
| | | | ok stsp mpi
* Unify the check for up & running between all pseudo-drivers.mpi2015-07-021-2/+2
|
* By design if_input_process() needs to hold a reference on the receivingmpi2015-07-021-8/+5
| | | | | | | | | 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@
* Rename if_output() into if_enqueue() to avoid confusion with commentsmpi2015-06-301-2/+2
| | | | | | talking about (*ifp->if_output)(). ok claudio@, dlg@
* Move the specialized m_copym2() preserving the alignment of the payloadmpi2015-06-301-62/+44
| | | | | | | | 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@
* Properly deliver broadcast-like packets to the network stack.mpi2015-06-251-15/+16
| | | | | | | | | | 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@
* Move brige(4)'s output hook outside of ether_output().mpi2015-06-251-2/+4
| | | | | | | | | | | 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@
* Increment if_ipackets in if_input().mpi2015-06-241-4/+1
| | | | | | | Note that pseudo-drivers not using if_input() are not affected by this conversion. ok mikeb@, kettenis@, claudio@, dlg@
* Adapt bridge(4) to the new if_input() framework.mpi2015-06-231-49/+20
| | | | | | | | | | | | 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@
* Store a unique ID, an interface index, rather than a pointer to thempi2015-06-161-3/+10
| | | | | | | | | | | | | | | 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@
* Remove superfluous splnet() protection.mpi2015-06-121-21/+6
| | | | ok lteo@
* Move away from using hzto(9); OK dlgmikeb2015-06-111-27/+5
|
* Merge multiple copies of the code doing VLAN tag insertion back intompi2015-06-081-45/+1
| | | | | | vlan_start(). ok sthen@, phessler@
* Use if_input() instead of ether_input_mbuf().mpi2015-06-021-38/+17
| | | | ok jasper@, bluhm@
* Do not change "rcvif" without goint through if_input() again otherwisempi2015-05-181-7/+4
| | | | | | | | the handlers on the new interface won't be executed. Tested by < mxb AT alumni.chalmers DOT se> ok dlg@
* Introduce if_output(), a function do to the last steps before enqueuingmpi2015-05-151-8/+4
| | | | | | | | a packet on the sending queue of an interface. Tested by many, thanks a lot! ok dlg@, claudio@
* fix indentationjsg2015-05-071-6/+6
| | | | ok miod@
* Use ether_input() as default input packet handler and do the necessarympi2015-05-041-42/+52
| | | | | | | | | 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@
* Stubs and support code for NIC-enabled IPsec bite the dust.mikeb2015-04-171-17/+1
| | | | No objection from reyk@, OK markus, hshoexer
* Move one "#ifdef NVLAN" chunk needed only if you're running bridge(4) onmpi2015-04-131-5/+32
| | | | | | | | | | | | 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@
* Do not pass an `ifp' argument to interface input handlers since itmpi2015-04-071-4/+4
| | | | | | might be overwritten by pseudo-drivers. ok dlg@, henning@
* earlier rev 1.112 sys/net/if_vlan.c corrects the mapping of 802.1pbenno2015-02-061-3/+8
| | | | | | prio from the vlan header to our pf priority levels. This fixes the mapping in the bridge code. ok henning
* convert to using siphashtedu2014-12-221-32/+6
|
* unifdef INET in net code as a precursor to removing the pretend option.tedu2014-12-191-19/+1
| | | | | long live the one true internet. ok henning mikeb
* Repair VLAN tagging in the bridge output pathmikeb2014-12-041-16/+32
| | | | | | | | | | | | 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
* move arc4random prototype to systm.h. more appropriate for most codetedu2014-11-181-4/+1
| | | | to include that than rdnvar.h. ok deraadt dlg
* remove uneeded route.h includesjsg2014-09-081-2/+1
| | | | ok miod@ mpi@
* Fewer <netinet/in_systm.h> !mpi2014-07-221-2/+1
|
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-13/+13
| | | | after discussions with beck deraadt kettenis.
* bpf code surgery / shuffling / simplification.henning2014-07-091-6/+4
| | | | | | | | | | | | | | | the various bpf_mtap_* are very similiar, they differ in what (and to some extent how) they prepend something, and what copy function they pass to bpf_catchpacket. use an internal _bpf_mtap as "backend" for bpf_mtap and friends. extend bpf_mtap_hdr so that it covers all common cases: if dlen is 0, nothing gets prepended. copy function can be given, if NULL the default bpf_mcopy is used. adjust the existing bpf_mtap_hdr users to pass a NULL ptr for the copy fn. re-implement bpf_mtap_af as simple wrapper for bpf_mtap_hdr. re-implement bpf_mtap_ether using bpf_map_hdr re-implement bpf_mtap_pflog as trivial bpf_mtap_hdr wrapper ok bluhm benno
* kill altq bits here as wellhenning2014-04-191-10/+1
|
* "struct pkthdr" holds a routing table ID, not a routing domain one.mpi2014-04-141-4/+4
| | | | | | | | | | | | | | Avoid the confusion by using an appropriate name for the variable. Note that since routing domain IDs are a subset of the set of routing table IDs, the following idiom is correct: rtableid = rdomain But to get the routing domain ID corresponding to a given routing table ID, you must call rtable_l2(9). claudio@ likes it, ok mikeb@
* clearing the _CSUM_IN_OK flags is now utterly pointless, was only done forhenning2014-01-241-4/+2
| | | | statistics sideeffects before. ok lteo naddy
* since the cksum rewrite the counters for hardware checksummed packetshenning2014-01-231-8/+8
| | | | | | | | | | are are lie, since the software engine emulates hardware offloading and that is later indistinguishable. so kill the hw cksummed counters. introduce software checksummed packet counters instead. tcp/udp handles ip & ipvshit, ip cksum covered, 6 has no ip layer cksum. as before we still have a miscounting bug for inbound with pf on, to be fixed in the next step. found by, prodding & ok naddy
* Do not use the multicast macro IFP_TO_IA() to check if an interface hasmpi2013-10-281-5/+7
| | | | | | a configured IPv4 address but iterates on its private list instead. ok deraadt@