summaryrefslogtreecommitdiffstats
path: root/sys/net/if_ethersubr.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* make ether_output with AF_MPLS use a routes gateway address if availabledlg2019-02-201-8/+5
| | | | | | | | | | | | | | | | | | | | | sending an MPLS frame is weird compared to other address families. other families figure out and pass the address on the local link for ether_output to use for resolution, but AF_MPLS basically passes a dummy sockaddr so ether_output can get the ethernet protocol field right. ether_output then has to pull the route apart to figure out which address and family to use for address resolution on the local net. eg, MPLS tagged routes via ip addresess need to pull the route apart and get at the AF_INET sockaddr to pass to arpresolve. that code currently uses the destination address of the route, but if that destination is not on the local network, we'd end up using it for arp requests that don't work. this change uses the rt_gateway sockaddr if RTF_GATEWAY is set. this solves the problem in my testing and doesn't seem to break other uses cases ive tried. reported by adrian close via bugs@ ok deraadt@ claudio@
* get rid of some trailing whitespace.dlg2019-02-181-2/+2
| | | | no functional change
* uncouple AF_MPLS and AF_INETdenis2018-12-261-3/+6
| | | | input and OK mpi@
* add bpe(4) or Backbone Provider Edge interfacesdlg2018-12-201-1/+11
| | | | | | | | Backbone refers to 802.1ah or 802.1Q Provider Backbone Bridges (PBB), or mac-in-mac, which is like vlans except it completely encapsulates the inner packet rather than just add a shim to it. This removes the need for Backbone Core Bridges (ie, switches between bpe instances) to know all the addresses on all the networks.
* allow ethernet interfaces to provide a custom if_output routine.dlg2018-12-121-2/+3
| | | | | | | | | this will be mostly useful for virtual interfaces like vlan and etherip, where they can bypass queueing on an ifq, and instead encapsulate in on multiple cpus concurrently and push the packet onto the next layer directly. ok visa@
* split ether_output into resolution, encapsulation, and output functionsdlg2018-12-111-68/+95
| | | | | | | | | | | | | | | | | | | if if_output can be overridden on ethernet interfaces, it will allow things like vlan to do it's packet encapsulation during output before putting the packet directly on the underlying interface for output. this has two benefits. first, it can avoid having ether_output on pseudo interfaces recurse, which makes profiling of the network stack a lot clearer. secondly, and more importantly, it allows pseudo ethernet interface packet encapsulation to by run concurrently by the stack, rather than having packets unnecessarily serialied by an ifq. this diff just splits ether_output up, it doesnt have any interface take advantage of it yet. tweaks and ok claudio@
* on input, check the unicast address before the multicast handling.dlg2018-03-131-12/+8
| | | | | | | | | | | | if the mac address is not for the interface, it must be multicast or broadcast. this is instead of if the packet is not multicast/broadcast, it must be for the interface. this allows ethernet interfaces to have multicast mac addresses without having to special case it themselves. eg, carp load balancing should become easier with this. ok mpi@
* make kernel compile again without INET6benno2018-02-271-1/+3
| | | | ok mpi@
* In ether_input() use goto dropanyway instead of repeating m_freem()bluhm2018-02-021-14/+8
| | | | | | and return. Change sizeof(etherbroadcastaddr) to ETHER_ADDR_LEN for consistency. from Michele Curti
* shuffle how the protocol family input is done in ether_input.dlg2018-01-101-31/+17
| | | | | | | | the main change is to defer chopping the ethernet header off until the ether_type is looked at. the main advantage of this is pppoe doesn't have to reattach the ether header anymore, which simplifies the code a lot. ok mpi@ visa@ bluhm@
* make mpls_input take a struct ifnet *ifp argument.dlg2018-01-091-2/+2
| | | | | | | | | | | this makes it like all our other protocol family input functions. mpls_input always looks up the interface the mbuf was received on, but it's always called by code that already has a reference to that interface anyway. the result of this is a few less if_get/if_put calls. ok mpi@ bluhm@ visa@ claudio@
* remove support for decapsulating LLC/SNAP frames.dlg2018-01-041-27/+2
| | | | | | | the code was broken and noone noticed. this argues that we don't need it. ok mpi@
* Add support for IPv6 over MPLS pseudowire aka mpw(4)denis2018-01-031-1/+6
| | | | OK claudio@ jca@
* Move IPv4 & IPv6 incoming/forwarding path, PIPEX ppp processing andmpi2017-05-311-5/+1
| | | | | | | | | | | | | | | | | | | | | 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@
* Introduce ipv{4,6}_input(), two wrappers around IP queues.mpi2017-05-301-5/+5
| | | | | | | This will help transitionning to an un-KERNEL_LOCK()ed IP forwarding path. Disucssed with bluhm@, ok claudio@
* Remove all splnet/splx from pipex(4) and pppx(4) and replace some ofyasuoka2017-05-281-4/+5
| | | | | | | them by NET_LOCK/NET_UNLOCK. Also make the timeout for pipex_timer run with a thread context and replace pipex softintr by NETISR_PIPEX. ok mpi
* white space fix. no functional change.dlg2017-05-221-2/+2
|
* A space here, a space there. Soon we're talking real whitespacekrw2017-01-241-3/+3
| | | | rectification.
* Strengthen Ethernet packet length checks on input; ok dlgmikeb2016-10-111-2/+7
|
* ensure prepended ethernet headers are placed on ETHER_ALIGN boundaries,dlg2016-10-101-2/+3
| | | | | | | | | | | | | | | | | | even if m_prepend allocates a new mbuf in front of the current one. this is done by asking M_PREPEND for ETHER_HDR_LEN + ETHER_ALIGN bytes, and then calling m_adj(ETHER_ALIGN) after. in the case M_PREPEND does not allocate a new mbuf and ends up with the same layout as before. in the allocation case, the requested length is provided on a long boundary. an ETHER_HDR_LEN request would therefore be 6 bytes allocated on a long boundary, when we want it to be at ETHER_ALIGN. by asking for ETHER_HDR_LEN plus ETHER_ALIGN, we can m_adj ETHER_ALIGN off to get us to the ETHER_ALIGN offset. ok yasuoka@ mikeb@
* Directly drop packets filtered by bpf(4) instead of going through thempi2016-07-121-5/+4
| | | | | | input handlers. ok dlg@
* Move ND resoluton logic from nd6_output() to nd6_storelladdr() andmpi2016-06-081-3/+3
| | | | | | | | | rename it to nd6_resolve(). This allows us to get rid of non-Ethernet hacks by moving Ethernet specific logic in the appropriate layer. ok sthen@
* Ensure that a valid route entry is passed to ether_output() if L2mpi2016-05-311-2/+6
| | | | | | | | | | | | resolution is required. This will allow us to enforce that no route entry is inserted in the routing table after ether_output(). This is now possible because if_output() is no longer called with a NULL route argument. Tested by Hrvoje Popovski, ok visa@, bluhm@
* Remove some superflous if_get(9)/if_put(9) dances now that ARP inputmpi2016-05-181-3/+3
| | | | | | routines are call directly by ether_input(). ok visa@, dlg@
* Building kernels with PPPOE_SERVER enabled has been broken for at leastjsg2016-04-011-3/+1
| | | | | | | | | eleven years, remove it. Despite what the wildly outdated time(9) claims, there is no longer globally visible "struct timeval mono_time" or "struct timeval time". ok mpi@ sthen@ mikeb@
* enm_ac in ether_multi is set but never used. so we dont need it.dlg2016-03-011-2/+1
|
* Always check destination MAC address of received unicast packets, notsf2016-01-221-5/+5
| | | | | | | | | | only when in promiscuous mode This necessary for NICs like virtio, where the unicast MAC filter is 'best effort' only. ok dlg@ encouragement from mpi@
* Get rid of the arp and revarp input queues.mpi2016-01-081-5/+5
| | | | | | | Packets of types ARP and REVARP are now processed in the softnet task, directly from ether_input() and without holding the KERNEL_LOCK. Tested by many, ok dlg@
* Rework the MPLS handling. Remove the lookup loops since nothing is usingclaudio2015-12-021-2/+2
| | | | | | | | | them and they make everything so much harder with no gain. Remove the ifp argument from mpls_input since it is not needed. On the input side the lookup side is modified a bit when it comes to BOS handling. Tested in a L3VPN setup with ldpd and bgpd. Commiting now so we can move on with cleaning up rt_ifp usage. If this breaks L2VPN I will fix it once reported. OK mpi@
* Introduce if_rtrequest() the successor of ifa_rtrequest().mpi2015-10-251-1/+19
| | | | | | | | | L2 resolution depends on the protocol (encoded in the route entry) and an ``ifp''. Not having to care about an ``ifa'' makes our life easier in our MP effort. Fewer dependencies between data structures implies fewer headaches. Discussed with bluhm@, ok claudio@
* Inspired by satosin(), use inline functions to convert sockaddr dl.bluhm2015-10-221-4/+3
| | | | | | Instead of casts they check wether the incoming object has the expected type. So introduce satosdl() and sdltosa() in the kernel. OK mpi@
* add sizes to some of the simpler free callsderaadt2015-09-291-3/+3
| | | | ok mpi
* Welcome etheranyaddr, cousin of etherbroadcastaddr.stsp2015-09-271-2/+4
| | | | | | Can be used to check if a MAC address is all zeros. Will be used by iwm(4) soon. ok kettenis@
* instead of leaking rarp packets, break from the switch statementdlg2015-09-171-2/+2
| | | | | | so packets can get enqueued for the arp netisr to process. fixes jsgs nfs mountroot problem.
* queue revarps to softnet so we can defer processing to a context withdlg2015-09-131-7/+6
| | | | | | the kernel lock. "do it" claudio@ mpi@
* Introduce if_input_local() a function to feed local traffic back tompi2015-09-121-2/+2
| | | | | | | | | | the protocol queues. It basically does what looutput() was doing but having a generic function will allow us to get rid of the loopback hack overwwritting the rt_ifp field of RTF_LOCAL routes. ok mikeb@, dlg@, claudio@
* pass a cookie argument to interface input handlers that can be usedmikeb2015-09-101-4/+4
| | | | | | | to pass additional context or transient data with the similar life time. ok mpi, suggestions, hand holding and ok from dlg
* move the if input handler list to an SRP list.dlg2015-09-101-11/+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@
* Don't use mpls_input() as input handler anymore and instead call itrzalamena2015-07-291-7/+3
| | | | | | directly. Also protect non mp-safe functions while at it. ok mpi@.
* Kill NETISR_MPLS, from now on we will use interface input handlers to dealrzalamena2015-07-201-3/+7
| | | | | | with MPLS packets. ok mpi@, claudio@
* Packets that make it to ether_input that have M_VLANTAG set must be dropped.claudio2015-07-181-2/+4
| | | | | | vlan(4) clears M_VLANTAG when a tag matches but if the tag is still there it means that the vlan is not configured on the interface. Found with mpi@ and rzalamena@ while discussing various vlan troubles.
* Fix MPLS routing when receiving packet with multiple labels.rzalamena2015-07-171-1/+2
| | | | ok claudio@, phessler@, mpi@
* m_freem() can handle NULL, do not check for this condition beforehands.deraadt2015-07-151-3/+2
| | | | ok stsp mpi
* most of the destinations for mbufs in ether_input are mpsafe except fordlg2015-07-021-1/+4
| | | | | | | pipex and bridge. this puts KERNEL_LOCK/KERNEL_UNLOCK around the pipex chunk till we can give it some mp love. ok yasuoka@ mpi@
* Move back rdomain's check into ether_output() otherwise it triggersmpi2015-07-021-1/+9
| | | | | | | | if a pseudo-interface is on a different rdomain than its parent. Sorry for the inconvenience, I hope you'll fly again with us. Regression reported by and ok semarie@, ok phessler@
* By design if_input_process() needs to hold a reference on the receivingmpi2015-07-021-10/+2
| | | | | | | | | 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@
* Get rid of the undocumented & temporary* m_copy() macro added formpi2015-06-301-2/+2
| | | | | | | | compatibility with 4.3BSD in September 1989. *Pick your own definition for "temporary". ok bluhm@, claudio@, dlg@
* Rename if_output() into if_enqueue() to avoid confusion with commentsmpi2015-06-301-2/+2
| | | | | | talking about (*ifp->if_output)(). ok claudio@, dlg@
* count if_ibytes in if_input like we do for if_ipackets.dlg2015-06-291-3/+1
| | | | tweaks and ok mpi@
* No more NBRIDGE in the Ethernet layer. Fewer layer violation, say yeah!mpi2015-06-251-6/+1
|