summaryrefslogtreecommitdiffstats
path: root/sys/net/if.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* the pattr argument to IFQ_ENQUEUE is unused, so let's get rid of it.dlg2015-10-121-2/+2
| | | | | | also the comment above IFQ_ENQUEUE that says the pattr argument is unused. ok mpi@
* Unify link state change notification.mpi2015-10-121-41/+21
| | | | ok mikeb@
* protect SIOCSLIFPHYTTL, SIOCSVNETID so only root can call them, anddlg2015-10-121-1/+5
| | | | | | | return EPNOTSUPP for SIOCGLIFPHYTTL and SIOCGVNETID. all so drivers dont have to do these checks themselves. ok mikeb@ mpi@
* Unlock the softnet task.mpi2015-10-081-3/+1
| | | | ok dlg@, kettenis@
* Revert if_oqdrops accounting changes done in kernel, per request from mpi@.uebayasi2015-10-051-4/+1
| | | | | | | | | | | | | (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.
* Count IFQ_ENQUEUE() failure as output drop.uebayasi2015-10-051-1/+2
| | | | | | mpi@ prefers checking IFQ_ENQUEUE() error, and this matches that. OK dlg@
* Accumulate ifq_drops into if_oqdrops if if_start().uebayasi2015-10-051-1/+3
| | | | | | | mpi@ questioned usefulness of if_snd.ifq_drops, but this is what exists now. This area is going to be readily polished. OK dlg@
* sleep until all references to an interface have been released during detach.dlg2015-09-301-13/+7
| | | | | | | this is done by moving to the refcnt api and using refcnt_finalize. tested by Hrjove Popovski ok mpi@
* Add if_setlladdr(), factored out from ifioctl(). Will be used by iwm(4) soon.stsp2015-09-271-6/+14
| | | | | With suggestions from tedu@ and guenther@ ok kettenis@
* Fix double rtfree(9) in non-INET6 kernel.mpi2015-09-131-2/+2
| | | | With and ok claudio@
* There's no point in abstracting ifp->if_output() as long as pf_test()mpi2015-09-131-11/+1
| | | | | | needs to see lo0 in the output path. ok claudio@
* replace hand rolled refcounts and sleep_setup/finish with refcnts anddlg2015-09-131-16/+6
| | | | refcnt_finalize.
* Run the interface watchdog timer routine as a task such that we have processkettenis2015-09-131-3/+21
| | | | | | context. ok mpi@, claudio@
* Stop overwriting the rt_ifp pointer of RTF_LOCAL routes with lo0ifp.mpi2015-09-121-2/+11
| | | | | | | | | Use instead the RTF_LOCAL flag to loop local traffic back to the corresponding protocol queue. With this change rt_ifp is now always the same as rt_ifa->ifa_ifp. ok claudio@
* introduce SRPs to the interface index maps to make if_get() mpsafe.dlg2015-09-121-34/+103
| | | | | | | | | | | | | | | | | each index in the ifidx map is now an SRP that points at each interfaces struct ifnet. because the map needs to be grown at run time as interfaces are added to the system, we now use an SRP to gain access to the map. if_get enters the idx map and follows it to the ifnet pointer. if an interface exists at that index it gets adds a refcount before leaving the ifp SRP. modifications to the map pointer and the interface pointers are serialised by the kernel lock. ok mpi@ claudio@
* Introduce if_input_local() a function to feed local traffic back tompi2015-09-121-1/+57
| | | | | | | | | | 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@
* Introduce rtref(9) use it in rtable_lookup() before returning a routempi2015-09-111-6/+10
| | | | | | entry. ok bluhm@, claudio@
* remove some more trailing whitespacedlg2015-09-111-4/+4
|
* whitespacesmpi2015-09-111-7/+7
|
* iterate over the new half of the if idx map rather than loop on the onedlg2015-09-111-2/+4
| | | | | | | | entry forever. this will fix hangs when you have more than 7 interfaces. ok mpi@
* rework how we store and manage the interface index to ifp map in preparation of using SRPs as a backend for if_get.dlg2015-09-101-69/+146
| | | | | | this also tries to document how things work and what if index 0 is for. ok mpi@ claudio@
* pass a cookie argument to interface input handlers that can be usedmikeb2015-09-101-7/+12
| | | | | | | to pass additional context or transient data with the similar life time. ok mpi, suggestions, hand holding and ok from dlg
* if_put after if_get in if_input_processdlg2015-09-101-2/+6
|
* move the if input handler list to an SRP list.dlg2015-09-101-3/+94
| | | | | | | | | | | | 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@
* only try and reference an ifp in if_get if we actually find one indlg2015-09-101-3/+6
| | | | | | the map. avoids a NULL deref jsg@ found
* introduce reference counts for interfaces (ie, struct ifnet *ifp).dlg2015-09-091-2/+22
| | | | | | | | | | | | | | | | if_get can get a reference to an ifp, but it never releases that reference. this provides an if_put function that can be used to decrement the refcount. we cannot come up with a scheme for letting the network stack run on one (or many) cpus while ioctls are pulling interfaces down on another cpu without refcounts for the interfaces. if_put is going in now so we can go through the stack and put the necessary calls to it in, and then we'll backfill this implementation to actually check the refcounts when the interface detaches. ok mpi@ mikeb@ claudio@
* dont need the kernel lock for mpsafe bpfs (again)dlg2015-09-011-3/+1
|
* Use a global table for domains instead of building a list at run time.mpi2015-08-301-21/+8
| | | | | | | As a side effect there's no need to run if_attachdomain() after the list of domains has been built. ok claudio@, reyk@
* bpf+srp is blowing up, so its being backed out. bpf will need the big lock.dlg2015-08-231-1/+3
|
* Check the error value returned by in6_ifattach().mpi2015-08-181-4/+6
| | | | Prodded by and ok bluhm@
* dont need the biglock to call bpf now.dlg2015-08-161-3/+1
|
* avoid a toctou problem in if_input in the bpf handling.dlg2015-08-161-3/+7
| | | | | | load ifp->if_bpf into a local variable, test that, and pass it to bpf. this is instead of instead of assuming ifp->if_bpf wont change between checking it and passing it to bpf.
* If no handler consumed a mbuf, free it. This also apply if an interfacempi2015-08-131-1/+3
| | | | | | | | does not have any registered handler. Plug a mbuf leak found by sthen@ with gif(4) in a bridge. ok sthen@, claudio@
* Don't use mpls_input() as input handler anymore and instead call itrzalamena2015-07-291-10/+1
| | | | | | directly. Also protect non mp-safe functions while at it. ok mpi@.
* No more AF_LINK addresses on the per-ifp address lists. ok mpi@jca2015-07-211-5/+1
|
* Remove splassert(IPL_NET) from if_input().mpi2015-07-201-3/+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@
* Kill NETISR_MPLS, from now on we will use interface input handlers to dealrzalamena2015-07-201-2/+10
| | | | | | with MPLS packets. ok mpi@, claudio@
* There's no longer a need to force carp(4) interfaces to be the last onesmpi2015-07-181-17/+1
| | | | | | | | | in the &ifnet list of interfaces. carp(4) is slowly becoming less special. Should keep the carp interfaces in the correct order in ifconfig output as reported by Johan Huldtgren. ok florian@, claudio@, benno@
* Abstract the routing table internals behind an rtable_* API.mpi2015-07-181-4/+6
| | | | | | | | | | Code abusing the radix internals for the routing table should now includes <net/rtable.h> and only deal with "struct rtentry". Code using a radix tree for another purpose can still include <net/radix.h>. Inputs from and ok claudio@, mikeb@
* Properly layer Router Solicitation code.mpi2015-07-161-12/+3
| | | | Tweak and ok florian@
* Move back rdomain's check into ether_output() otherwise it triggersmpi2015-07-021-9/+1
| | | | | | | | 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-3/+3
| | | | | | | | | 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@
* count if_ibytes in if_input like we do for if_ipackets.dlg2015-06-291-3/+6
| | | | tweaks and ok mpi@
* Move brige(4)'s output hook outside of ether_output().mpi2015-06-251-1/+7
| | | | | | | | | | | 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-1/+9
| | | | | | | | 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.
* Stop garbgage collecting mbufs from the ARP, IPv4 and IPv6 queues whenmpi2015-06-241-48/+1
| | | | | | | | | an interface is destroyed or removed. Since the introduction of ph_ifidx, as soon as a mbuf with an invalid interface index is dequeued it will be freed. ok claudio@, dlg@
* Increment if_ipackets in if_input().mpi2015-06-241-1/+3
| | | | | | | 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-1/+10
| | | | | | | | | | | | 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-4/+9
| | | | | | | | | | | | | | | 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@