summaryrefslogtreecommitdiffstats
path: root/sys/net/if_ethersubr.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* use uint64_t ethernet addresses for compares in carp.dlg2021-03-071-2/+2
| | | | | | | | | | pass the uint64_t that ether_input has already converted from a real ethernet address into carp_input so it can use it without having to do its own conversion. tested by hrvoje popovski tested by me on amd64 and sparc64 ok patrick@ jmatthew@
* pass the uint64_t dst ethernet address from ether_input to bridges.dlg2021-03-051-3/+3
| | | | tested on amd64 and sparc64.
* work with 64bit ethernet addresses in ether_input().dlg2021-03-051-9/+10
| | | | | | | | | | | this applies the tricks with addresses from veb and etherbridge code to the normal ethernet input processing. it basically loads the destination address from the packet and the interface ethernet address into uint64_ts for comparison. tested by hrvoje popovski and chris cappuccio tested here on amd64, arm64, and sparc64 ok claudio@ jmatthew@
* add some helpers for working with ethernet addresses as uint64_tdlg2021-02-261-1/+26
| | | | | | | | | | | | | | the main bits are ether_addr_to_e64 and ether_e64_to addr for loading an ethernet address into a uin64_t and visa versa. there's also some macros for testing if an address in a uint64_t is multicast, broadcast, anyaddr, or if it's an 802.1q reserved multicast group address. the reason for this functionality is once you have an ethernet address as a uint64_t, operations like compares, bit tests, and so on are fast and easy. tested on amd64 and sparc64
* Simplex interface sends packet back without hardware checksumbluhm2021-02-061-2/+6
| | | | | | | | offloading. The checksum must be calculated in software. Use the same condition in ether_resolve() to send the broadcast packet back to the stack and in in_ifcap_cksum() to force software checksumming. This fixes regress/sys/kern/sosplice/loop. OK procter@
* Fix whitespace.bluhm2021-02-051-3/+3
|
* Process pppoe(4) packets directly, do not queue through netiskn2021-01-041-3/+3
| | | | | | | | | | Less scheduling, lock contention and queues. Previously, if_netisr() handled the net lock around those calls, now if_input_process() does it before calling ether_input(), so no need to add or remove NET_*LOCK() anywhere. OK mvs claudio
* fix indentationjsg2020-10-011-2/+2
|
* deprecate interface input handler lists, just use one input function.dlg2020-07-221-23/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | the interface input handler lists were originally set up to help us during the intial mpsafe network stack work. at the time not all the virtual ethernet interfaces (vlan, svlan, bridge, trunk, etc) were mpsafe, so we wanted a way to avoid them by default, and only take the kernel lock hit when they were specifically enabled on the interface. since then, they have been fixed up to be mpsafe. i could leave the list in place, but it has some semantic problems. because virtual interfaces filter packets based on the order they were attached to the parent interface, you can get packets taken away in surprising ways, especially when you reboot and netstart does something different to what you did by hand. by hardcoding the order that things like vlan and bridge get to look at packets, we can document the behaviour and get consistency. it also means we can get rid of a use of SRPs which were difficult to replace with SMRs. the interface input handler list is an SRPL, which we would like to deprecate. it turns out that you can sleep during stack processing, which you're not supposed to do with SRPs or SMRs, but SRPs are a lot more forgiving and it worked. lastly, it turns out that this code is faster than the input list handling, so lots of winning all around. special thanks to hrvoje popovski and aaron bieber for testing. this has been in snaps as part of a larger diff for over a week.
* move carp_input into ether_input, instead of via an input handler.dlg2020-07-221-1/+19
| | | | | | | | carp_input is only tried after vlan and bridge handling is done, and after the ethernet packet doesnt match the parent interfaces mac address. this has been in snaps as part of a larger diff for over a week.
* move vlan_input into ether_input, instead of via an input handler.dlg2020-07-221-10/+36
| | | | | | | | | | | | | | this means there's a consistent order of processing of service delimited (vlan and svlan) packets and bridging of packets. vlan and svlan get to look at a packet first. it's only if they decline a packet that a bridge can handle it. this allows operators to slice vlans out for processing separate to the "native" vlan handling if they want. while here, this fixes up a bug in vlan_input if m_pullup needed to prepend an mbuf. this has been in snaps as part of a larger diff for over a week.
* if an iface is a bridge port, pass the packet to the bridge in ether_input.dlg2020-07-221-1/+22
| | | | | | | if the bridge declines the packet, it just returns it to ether_input to allow local deliver to proceed. this has been in snaps as part of a larger diff for over a week.
* add code to coordinate how bridges attach to ethernet interfaces.dlg2020-07-221-1/+54
| | | | | | | | | | | | | | | | | | | | | | | this is the first step in refactoring how ethernet frames are demuxed by virtual interfaces, and also in deprecating interface input list handling. we now have drivers for three types of virtual bridges, bridge(4), switch(4), and tpmr(4), and it doesn't make sense for any of them to be enabled on the same "port" interfaces at the same time. currently you can add a port interface to multiple types of bridge, but which one gets to steal the packets depends on the order in which they were attached. this creates an ether_brport structure that holds an input function for the bridge, and optionally some per port state that the bridge can use. arpcom has a single pointer to one of these structs that will be used during normal ether_input processing to see if a packet should be passed to a bridge, and will be used instead of an if input handler. because it is a single pointer, it will make sure only one bridge of any type is attached to a port at any one time. this has been in snaps as part of a larger diff for over a week.
* Make it possible to call ether_rtrequest with a NULL rt argument.claudio2019-11-241-1/+4
| | | | | | In that case the function can just return. Part of a larger diff to use the if_rtrequest functions for RTM_PROPOSAL info. OK florian@
* Introduce ETHER_IS_BROADCAST/ANYADDR/EQ() and use them where appropriate.mpi2019-07-171-3/+2
| | | | ok dlg@, sthen@, millert@
* 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@