summaryrefslogtreecommitdiff
path: root/sys/net/if_bridge.c
AgeCommit message (Collapse)Author
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.
2014-07-09bpf code surgery / shuffling / simplification.Henning Brauer
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
2014-04-19kill altq bits here as wellHenning Brauer
2014-04-14"struct pkthdr" holds a routing table ID, not a routing domain one.Martin Pieuchot
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@
2014-01-24clearing the _CSUM_IN_OK flags is now utterly pointless, was only done forHenning Brauer
statistics sideeffects before. ok lteo naddy
2014-01-23since the cksum rewrite the counters for hardware checksummed packetsHenning Brauer
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
2013-10-28Do not use the multicast macro IFP_TO_IA() to check if an interface hasMartin Pieuchot
a configured IPv4 address but iterates on its private list instead. ok deraadt@
2013-10-17The header file netinet/in_var.h included netinet6/in6_var.h. ThisAlexander Bluhm
created a bunch of useless dependencies. Remove this implicit inclusion and do an explicit #include <netinet6/in6_var.h> when it is needed. OK mpi@ henning@
2013-10-13Just use sockaddr_union instead of a handcrafted version and renameReyk Floeter
bridge_tunnelupdate to a more generic name bridge_copyaddr. No functional change.
2013-10-13Import vxlan(4), the virtual extensible local area network tunnelReyk Floeter
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@
2013-10-12give tagname2tag and its siblings an extra "create" parameter. if 1, itHenning Brauer
behaves like before and creates the mapping if needed. if 0, lookup only. looked over by many, ok phessler sthen
2013-08-21No need to include if_vlan_var.h twice.Martin Pieuchot
2013-08-05sync the bridge_broadcast comment with realityMike Belopuhov
2013-07-31Move bridge_broadcast and subsequently all IPsec SPD lookup code outMike Belopuhov
of the IPL_NET. pf_test should be no longer called under IPL_NET as well. The problem became evident after the related issue was brought up by David Hill <dhill at mindcry ! org>. With input from and OK mpi. Tested by David and me.
2013-06-26put the cksum diff back, of course with the bug fixed where we couldHenning Brauer
under some circumstances repair broken checksums on the way. ok ryan naddy mikeb . redo most of the protocol (tcp/udp/...) checksum handling -assume we have hardware checksum offloading. stop mucking with the checksum in most of the stack -stop checksum mucking in pf, just set a "needs checksumming" flag if needed -in all output pathes, very late, if we figure out the outbound interface doesn't have hw cksum offloading, do the cksum in software. this especially makes the bridge path behave like a regular output path -little special casing for bridge still required until the broadcast path loses its disgusting shortcut hacks, but at least it's in one place now and not all over the stack in6_proto_cksum_out mostly written by krw@ started at k2k11 in iceland more than 1.5 years ago - yes it took that long, this stuff is everything but easy. this happens to fix the infamous pf rdr bug that made us turn off proto cksum offloading on almost all interface drivers.
2013-03-28code that calls timeout functions should include timeout.hTed Unangst
slipped by on i386, but the zaurus doesn't automagically pick it up. spotted by patrick
2013-03-28do not include machine/cpu.h from a .c file; it is the responsibility ofTheo de Raadt
.h files to pull it in, if needed ok tedu
2013-03-28no need for a lot of code to include proc.hTed Unangst
2013-03-26Remove various read-only *maxlen variables and use IFQ_MAXLEN directly.Martin Pieuchot
ok beck@, mikeb@
2013-03-15change LIST_END to literal NULL for clarity.Ted Unangst
ok claudio mpi
2013-01-23Change interface and span interface lists from LIST to TAILQ.Camiel Dobbelaar
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)