summaryrefslogtreecommitdiffstats
path: root/sys/net/if_tun.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* dont leak an ifp reference if tun isnt ready to read.dlg2015-09-101-1/+2
| | | | found by jsg@
* if_put after if_get.dlg2015-09-091-2/+5
| | | | | | | this is a bit funky cos we give up the ref while sleeping in tunread, and have to get a new ref on wakeup. ok claudio@
* Replace sockaddr casts with the proper satosin(), ... calls.bluhm2015-09-011-7/+7
| | | | From David Hill; OK mpi@; tested kspillner@; tweaks bluhm@
* Fix compiling a kernel without NBPFILTER > 0.reyk2015-08-281-2/+5
| | | | OK mikeb@
* Remove splassert(IPL_NET) from if_input().mpi2015-07-201-4/+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@
* m_freem() can handle NULL, do not check for this condition beforehands.deraadt2015-07-151-3/+2
| | | | ok stsp mpi
* MFREE(9) is dead, long live m_freem(9)!mpi2015-07-081-2/+2
| | | | 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@
* Increment if_ipackets in if_input().mpi2015-06-241-2/+1
| | | | | | | Note that pseudo-drivers not using if_input() are not affected by this conversion. ok mikeb@, kettenis@, claudio@, dlg@
* Store a unique ID, an interface index, rather than a pointer to thempi2015-06-161-2/+2
| | | | | | | | | | | | | | | 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@
* Convert tun(4) to if_input().mpi2015-06-011-12/+14
| | | | | | Tested by Norman Golisz and <mxb AT alumni DOT chalmers DOT se>, thanks! ok bluhm@
* move add_net_randomness from ether_input to the if_input task.dlg2015-05-261-4/+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@
* Do not increment if_opackets in if_output(). It might make sense to dompi2015-05-201-1/+2
| | | | | | that later but all drivers should be adapated. Should fix a double output packet accounting, reported by Hrvoje Popovski.
* splx should also be called in the error case, fix a regressionmpi2015-05-191-3/+3
| | | | | | introduced during the if_output() conversion. Found by jsg@
* Remove useless comments mentioning ether_output().mpi2015-05-151-6/+1
|
* Introduce if_output(), a function do to the last steps before enqueuingmpi2015-05-151-7/+4
| | | | | | | | a packet on the sending queue of an interface. Tested by many, thanks a lot! ok dlg@, claudio@
* Do not free & reallocate a new chunk of memory for the interfacempi2015-04-301-42/+52
| | | | | | | | | descriptor during SIOCSIFFLAGS. This prevent a use after free, triggered by the pool/malloc damage finder being currently cooked by dlg@ and deraadt@. ok deraadt@
* Use if_get() after every tsleep(), in case the bottom half of the driverderaadt2015-04-291-2/+13
| | | | | has destroyed or damaged the interface clone. with mpi
* Fix a typo introduced in the niq_enqueue() conversion.mpi2015-04-151-2/+2
| | | | | | Should fix a panic reported by many on bugs@ and misc@. ok dlg@
* replace the use of ifqueues for most input queues serviced by netisrdlg2015-04-101-14/+5
| | | | | | | | | | | | | | | | | 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@
* Kill useless comments talking about ether_input().mpi2015-04-011-2/+2
|
* remove the congestion handling from struct ifqueue.dlg2015-03-181-3/+2
| | | | | | | | | | | | | | | | | its only used for the ip and ip6 network stack input queues, so it seems unfair that every instance of ifqueue has to carry a pointer around for this specific use case. this moves the congestion marker to a kernel global. if we detect that we're congested, we assume the whole system is busy and punish all input queues. marking a system as congested is done by setting the global to the current value of ticks. as the system moves away from that value, it moves away from being congested until the comparison fails. written at s2k15 ok henning@ beck@ bluhm@ claudio@
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* First step towards making uiomove() take a size_t size argument:miod2015-02-101-3/+3
| | | | | | | - rename uiomove() to uiomovei() and update all its users. - introduce uiomove(), which is similar to uiomovei() but with a size_t. - rewrite uiomovei() as an uiomove() wrapper. ok kettenis@
* Delete option COMPAT_43: support for pre-sa_len binaries has been obsoleteguenther2015-01-211-2/+1
| | | | | | | | for a couple decades. Keep the OSIOCGIFCONF ioctl to support COMPAT_LINUX but move the rest of the Linux-specific ioctl() handling into linux_socket.c This lets struct osockaddr finally move from sys/socket.h to protocols/talkd.h ok krw@ deraadt@ mpi@
* unifdef INET in net code as a precursor to removing the pretend option.tedu2014-12-191-9/+1
| | | | | long live the one true internet. ok henning mikeb
* tun(4) has a pipex session which is used for multicast internally, ityasuoka2014-10-211-2/+2
| | | | | | wasn't freeed when the interface is destroyed. Free it properly. ok dlg
* remove uneeded route.h includesjsg2014-09-081-2/+1
| | | | ok miod@ mpi@
* Fewer <netinet/in_systm.h> !mpi2014-07-221-2/+1
|
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-3/+3
| | | | after discussions with beck deraadt kettenis.
* Use a custom ifa_rtrequest function for point-to-point interfacesmpi2014-05-051-4/+8
| | | | | | | | | | instead of relying on hacks in nd6_rtrequest() to add a route to loopback for each address configured on such interfaces. While here document that abusing lo0 for local traffic is not safe for interfaces in a non-default rdomain. Tested by claudio@, jca@ and sthen@, ok sthen@
* Remove some altq tentacles.mpi2014-04-221-4/+1
| | | | ok pelikan@, henning@
* reaching into altq outside #ifdef ALTQ is bad, mmkay? ok claudiohenning2014-04-181-6/+1
|
* "struct pkthdr" holds a routing table ID, not a routing domain one.mpi2014-04-141-2/+2
| | | | | | | | | | | | | | 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@
* Eliminates struct pcred by moving the real and saved ugids intoguenther2014-03-301-2/+2
| | | | | | | | | struct ucred; struct process then directly links to the ucred Based on a discussion at c2k10 or so before noting that FreeBSD and NetBSD did this too. ok matthew@
* Remove the number of in6_var.h inclusions by moving some functions andmpi2013-10-241-5/+1
| | | | | | global variables to in6.h. ok deraadt@
* Remove the number of in_var.h inclusions by moving some functions andmpi2013-10-231-2/+1
| | | | | | global variables to in.h. ok mikeb@, deraadt@
* Uniformize drivers doing nothing with their multicast filters to makempi2013-10-191-37/+2
| | | | | | them ignore the SIOC{ADD,DEL}MULTI ioctls. ok reyk@, claudio@
* The header file netinet/in_var.h included netinet6/in6_var.h. Thisbluhm2013-10-171-1/+5
| | | | | | | 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@
* SIOCSIFBRDADDR is not passed to the per-driver ioctl function, so itmpi2013-10-041-5/+1
| | | | | | makes no sense to let tun(4) handle it. ok claudio@, haesbaert@
* set the IFF_RUNNNING flag when recreating an interface after themikeb2013-05-251-1/+2
| | | | IFF_LINK0 flag has been added; from form, ok deraadt claudio
* do not include machine/cpu.h from a .c file; it is the responsibility ofderaadt2013-03-281-2/+1
| | | | | .h files to pull it in, if needed ok tedu
* Remove various read-only *maxlen variables and use IFQ_MAXLEN directly.mpi2013-03-261-2/+2
| | | | ok beck@, mikeb@
* begone, fucking rotten appletalk shit. ok roomhenning2011-07-091-12/+1
|
* use IF_LEN/IFQ_LEN to access and ifqueue's length field. ryan okhenning2011-07-071-4/+4
| | | | | with this nothing in the tree fiddles if ifqueue internals any more, of course except if.c and if.h (and some altq)
* kqueue attach functions should return an errno or 0, not a plain 1. Fixnicm2011-07-021-2/+2
| | | | | | the obvious cases to return EINVAL and ENXIO. ok tedu deraadt
* If tunread() fails, we should increment if_oerrors, not if_ierrors.matthew2010-09-231-2/+2
| | | | "yup" deraadt@
* Don't bother calling suser() in tunopen().matthew2010-09-221-4/+1
| | | | "Sure" deraadt@
* pipex didn't work on output. Fixed following problems:yasuoka2010-07-081-6/+3
| | | | | | | - pipex failed to lookup the radix tree because address and netmask were not initialized. - pipex used wrong place as a ip header because it didn't adjust 32bit address family header that are added at tun_output.
* Remove the incorrect if_media code. It is no longer needed to show and trackclaudio2010-05-061-37/+3
| | | | | | link states. Additionally do not up the interface when opening the device. Resulting in the same behaviour as on real ethernet interfaces. OK sthen