summaryrefslogtreecommitdiffstats
path: root/sys/net/if_ethersubr.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
|
* Move brige(4)'s output hook outside of ether_output().mpi2015-06-251-42/+1
| | | | | | | | | | | 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@
* Check for correct rdomain in if_output() rather than in ether_output().mpi2015-06-251-10/+1
| | | | | | | | Not all drivers make use of ether_output() and there's no real reason to call it when no ARP resolution is needed. But in this case we still want to make sure we're sending packets in the correct rdomain. ok bluhm@, claudio@ as part of a larger diff.
* Pass a "struct ifnet *" instead of a "struct arpcom *" to arpresolve().mpi2015-06-231-3/+3
| | | | | | | | Most of the ARP layer already take an ifp pointer and this makes clear wich chunks of code are messing with ac_enaddr. Note that our Ethernet code assume that these pointer are interchangeable since the first element of the "struct arpcom" is a "struct ifnet".
* Adapt bridge(4) to the new if_input() framework.mpi2015-06-231-23/+1
| | | | | | | | | | | | 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/+5
| | | | | | | | | | | | | | | 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@
* Merge multiple copies of the code doing VLAN tag insertion back intompi2015-06-081-73/+9
| | | | | | vlan_start(). ok sthen@, phessler@
* Move carp-related logic from ether_output() into carp_start().mpi2015-06-081-32/+5
| | | | ok sthen@, phessler@
* Take carp(4) out of ether_input().mpi2015-06-021-13/+1
| | | | | | Tested by <mxb AT alumni DOT chalmers DOT se>, thanks! ok bluhm@, dlg@
* Now that the Ethernet header is always passed as part of the mbuf, killmpi2015-05-261-12/+7
| | | | | | the second (unused) argument of the input packet handlers. ok dlg@
* move add_net_randomness from ether_input to the if_input task.dlg2015-05-261-8/+1
| | | | | | | | change it from feeding the ethertype of the packet (which is almost certainly an ip packet or vlan packet, so not that variable) to the number of packets about to be processed. ok deraadt@ mpi@
* Take vlan(4) out of ether_input().mpi2015-05-191-10/+4
| | | | | | | | | | | To keep the list of input handlers short, multiple vlans share the same ifih. if_input_process() now looks if the interface of a mbuf changed to make sure the corresponding handlers are executed. This is a hack and will be improved later. ok dlg@
* Introduce if_output(), a function do to the last steps before enqueuingmpi2015-05-151-22/+6
| | | | | | | | a packet on the sending queue of an interface. Tested by many, thanks a lot! ok dlg@, claudio@
* Get rid of the last "#if NTRUNK" by overwriting trunk ports' outputmpi2015-05-131-15/+1
| | | | | | function. ok claudio@, reyk@
* Take trunk(4) out of ether_input().mpi2015-05-111-27/+1
| | | | | | | | | Each physical interface of a trunk now gets a specific ifih (interface input handler) that runs before ether_input(). Tested by sthen@, dlg@, Theo Buehler and <mxb AT alumni.chalmers DOT se> ok sthen@, dlg@
* Use ether_input() as default input packet handler and do the necessarympi2015-05-041-1/+2
| | | | | | | | | 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@
* Move one "#ifdef NVLAN" chunk needed only if you're running bridge(4) onmpi2015-04-131-11/+1
| | | | | | | | | | | | 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@
* replace the use of ifqueues for most input queues serviced by netisrdlg2015-04-101-29/+14
| | | | | | | | | | | | | | | | | with niqueues. this change is so big because there's a lot of code that takes pointers to different input queues (eg, ether_input picks between ipv4, ipv6, pppoe, arp, and mpls input queues) and falls through to code to enqueue packets against the pointer. if i changed only one of the input queues id have to add sepearate code paths, one for ifqueues and one for niqueues in each of these places by flipping all these input queues at once i can keep the currently common code common. testing by mpi@ sthen@ and rafael zalamena ok mpi@ sthen@ claudio@ henning@
* Run detach hook and similar before cleaning up any other resource whenmpi2015-04-101-1/+4
| | | | | | | | | | an interface is destroyed/removed. This way we can ensure pseudo-driver changes done after attaching an interface are undone before detaching it. Note: it is safe to call if_deactivate() multiple times as the interface should not have any attached pseudo-interface after the first call. ok deraadt@, dlg@
* Do not pass an `ifp' argument to interface input handlers since itmpi2015-04-071-3/+5
| | | | | | might be overwritten by pseudo-drivers. ok dlg@, henning@
* Merge two "#ifdef NCARP" chunks.mpi2015-03-171-6/+4
| | | | "Look safe" henning@, ok florian@
* avoid double vlan-header or vlan-header for non-vlan(4) interfacesmarkus2015-02-161-1/+11
| | | | (will panic) in bridge context; ok henning@
* move the init of the if_input from ether_ifattach to if_attach.dlg2015-02-091-2/+1
| | | | ok mpi@
* Introduce if_input() a function to pass packets dequeued from ampi2015-02-081-16/+33
| | | | | | | | | | recieving ring to the stack. if_input() is at the moment a drop-in replacement for ether_input_mbuf() but will let us stack pseudo-driver in a nice way in order to no longer call ether_input() recursively. ok pelikan@, reyk@, blambert@, 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 on the ouput path. ok henning
* Factorize various duplicated chunks of (old and horrible) code, checkingmpi2015-01-081-36/+11
| | | | | | | | | | | | | | | | | | | | | | | | | for the validity of a given outgoing route entry into a single function. This change is inspired from FreeBSD r111767. The function introduced here, rt_checkgate(), should hopefully die in a near future. Why should it die? Well, it is way too late to do such validity checks: if your kernel can ends up in ether_output() with an invalid route, please do not let it try to find a new one that might do the job. Go read this function if you're wondering why you're getting messages like: "arpresolve: X.X.X.X: route without link local address" Since this horrible logic has survived 20 years of copy & past and small modifications for workarounds without a single clear commit message, let's assume it is full of dragons and try to play safe. This factorization is not intended to change any behavior. With much inputs from bluhm@, tested by weerd@ and florian@ on setups with p2p IPv6 interfaces. ok bluhm@, benno@, florian@
* unifdef INET in net code as a precursor to removing the pretend option.tedu2014-12-191-11/+1
| | | | | long live the one true internet. ok henning mikeb
* There's no good reason to keep into "struct ifnet" a pointer that's onlympi2014-12-081-6/+1
| | | | | | used by enc(4) devices to attach their routes. ok sthen@, mikeb@
* use siphash for trunk loadbalancing. ok deraadttedu2014-12-041-1/+2
|
* reconvert (rereconvert?) to memcpy except in the one case where memmovetedu2014-12-011-15/+20
| | | | is needed. more thoroughly reviewed. ok deraadt
* restore the "hot" memcpy that existed before recent conversion flipfloptedu2014-11-291-5/+5
|
* Yet more #include de-duplication.krw2014-11-201-4/+1
| | | | ok deraadt@ tedu@
* bulk convert memcpy to memmove. at least one bcopy conversion was wrong,tedu2014-11-191-20/+20
| | | | | so use the safer function. can be converted back to memcpy if necessary, but later and only after more careful inspection.
* fix mac address selection with unnumbered carpdevshenning2014-11-061-2/+3
| | | | | | | | | | | IP-traffic over a carp interface with the underlaying carpdev being unnumbered (in the numbered case usually the ifp is the carpdev to begin with) went out with the carpdev's mac address istead of the carp interface's one due to a carp hack in ether_output exchanging the carp ifp for its carpdev ones one. move the source mac selection to before that. fixes unnumbered carp use in environments with strict mac address regimes like some exchange points. issue found by your's truly the hard way. ok mpi dlg
* Rename rtalloc1() into rtalloc(9) and convert its flags to only enablempi2014-11-011-4/+4
| | | | | | functionnality instead of a mix of enable/disable. ok bluhm@, jca@
* remove preliminary AOE (ata over ethernet) support. not finished aftertedu2014-10-071-10/+1
| | | | | many years and wide spread demand for support never materialized. time to pack it in.