summaryrefslogtreecommitdiff
path: root/sys/net/if_tun.c
AgeCommit message (Collapse)Author
2008-10-02First step towards cleaning up the Ethernet driver ioctl handling.Brad Smith
Move calling ether_ioctl() from the top of the ioctl function, which at the moment does absolutely nothing, to the default switch case. Thus allowing drivers to define their own ioctl handlers and then falling back on ether_ioctl(). The only functional change this results in at the moment is having all Ethernet drivers returning the proper errno of ENOTTY instead of EINVAL/ENXIO when encountering unknown ioctl's. Shrinks the i386 kernels by.. RAMDISK - 1024 bytes RAMDISKB - 1120 bytes RAMDISKC - 832 bytes Tested by martin@/jsing@/todd@/brad@ Build tested on almost all archs by todd@/brad@ ok jsing@
2008-08-04do not count ethernet header twice in if_obytes stats.Damien Bergamini
do not count address family field twice in tun's if_obytes stats. ok henning@ reyk@ deraadt@ for the ethernet bits. ok deraadt@ for the tun bits.
2008-05-07Prevent virtual interfaces from adding to the random pool.Marco Pfatschbacher
Also move the sampling into ether_input() where it can happen at the interrupt and not within splnet() processing, which might be less random. Discussed with mickey. OK markus@, mcbride@
2008-05-06M_PREPEND can set its first parameter to NULL, and all other codeKenneth R Westerback
using M_PREPEND checks for NULL after the invocation. So check here too and return ENOBUFS if NULL is detected. ok henning@
2007-12-20return with ENOTTY instead of EINVAL for unknown ioctl requests.Brad Smith
ok claudio@ krw@ jason@ dlg@
2007-09-15malloc sweep:Henning Brauer
-remove useless casts -MALLOC/FREE -> malloc/free -use M_ZERO where appropriate instead of seperate bzero feedback & ok krw, hshoexer
2007-06-06remove remaining IPX hooks. all inside #ifdef IPX, so no actual changeHenning Brauer
2007-05-26one extern seems to be better than 20 for ifqmaxlen; ok krwJason Wright
2007-05-26More comment typos from Diego Casati. Including winners like funtion, allmost,Kenneth R Westerback
oustside, seqencer, toghether, nessissary, etc.
2007-05-03Use if_flags instead of ifr_flags.Marco Pfatschbacher
It shouldn't make a difference, but some ioctl-callers don't initialize the ifreq properly. Fixes a panic w/ tun(4) on trunk(4). OK reyk@, claudio@
2007-02-21For TUNSIFMODE protect the if_flags similar to the TUNSIFINFO case.Claudio Jeker
Don't allow the userland to fiddle with flags reserved by the driver. Noticed by Ingo Schwarze.
2007-02-16Unbreak ppp(8) over tun(4) by restriciting the flags that can be changedClaudio Jeker
via TUNSIFINFO. ppp(8) was happily clearing the RUNNING flag and so all incomming packets where dropped. Issue reported by irix <at> ukr <dot> net. While there check that the mtu is in a valid range -- stolen from SIOCSIFMTU case.
2007-02-06Change the behaviour of tun(4) on close.Claudio Jeker
- if the interface was auto-created by opening a /dev/tun* device it will auto-destroy on close. This is comparable to ifconfig tun0 destroy and will remove all routes and addresses associated with the interface. - if the interface was created by ifconfig(8) or hostname.if(5) the interface is persistent -- it is just marked as not running. Especially routes are no longer removed when the interface is closed. This is useful for static setups like the server side of a ssh vpn or static qemu session. This behaviour is more logic then the half done cleanup that is currently done. OK mpf@
2007-01-26When switching mode inherit the TUN_NBIO and TUN_ASYNC flags and clearClaudio Jeker
these flags on close. OK mpf@
2006-11-10Fix an mbuf leak in an error path. OK brad@Claudio Jeker
2006-11-01poll errors should be POLLERR, not some random E valueTed Unangst
from alexandre ratchov. ok claudio
2006-03-25allow bpf(4) to ignore packets based on their direction (inbound orDamien Miller
outbound), using a new BIOCSDIRFILT ioctl; guidance, feedback and ok canacar@
2006-03-20introduce rt_if_remove which takes care of routing table updates for anHenning Brauer
interface that is removed. use that from if.c and if_tun.c instead of re-implementing in the latter case. ok claudio
2006-03-16Switch tun(4) from encapsualting packets into a long mbuf chain over to useClaudio Jeker
mbuf clusters if the packet is big enough. This should speed up tun(4) and may help in other cases where long mbuf chains hurt. Additionally switch the default tun(4) MTU to a more sane 1500 bytes. TUNMTU is kept because it is used in userland. Input and OK from brad@ and djm@
2006-03-05change the interface type from IFF_POINTOPOINT to the more correctBrad Smith
type of IFF_TUNNEL (Encapsulation interface). ok djm@
2006-03-04With the exception of two other small uncommited diffs this movesBrad Smith
the remainder of the network stack from splimp to splnet. ok miod@
2006-01-11Do not use m_adj() on empty mbufs (m->m_len is uninitialised), instead bumpClaudio Jeker
m->m_data directly. This fixes the tun(4) / bridge(4) crash reported in PR4963. OK djm@ mpf@ markus@
2005-11-29something in the eurobsdcon route-a-thon broke my simple home networkJolan Luff
router so back out the routing stuff to pre-eurobsdcon where my machine doesn't crash immediately. i am happy to test diffs and report success/failures but i am not happy to have instantaneous crashes when i reboot with a new kernel that was compiled from pristine sources. if you are going to be an elitist asshole then you could at least make sure your code works. ok and "be crass towards them" deraadt@
2005-11-25move the code to delete routes having a specific interface as outputHenning Brauer
when the interface is deleted to a function in route.c, and replace the copies of that code by calls to that function from basel almost-hackathon
2005-11-21Move contents of sys/select.h to sys/selinfo.h in preparation for aTodd C. Miller
userland-visible sys/select.h. Consistent with what Net and Free do. OK deraadt@, tested with full ports build by naddy@.
2005-11-17tun devices get created (cloned) automagically when the device is opened.Henning Brauer
the code took a shortcut which results in the new device not beeing added to its interface class group as it should. call the regular if_clone_create() instead of taking shortcuts, and all is fine. ok markus, tested Mike Belopuhov <mkb@crypt.org.ru>
2005-11-16small doses of KNFHenning Brauer
2005-06-08huch, more netns shitzHenning Brauer
2005-06-08no more netns handling for the various tunnel devices and loopbackHenning Brauer
2005-05-04set RUNNING on open; from Alexey E. Suslikov; ok henning, claudioMarkus Friedl
2005-05-03typo, automaticaly -> automaticallyBrad Smith
2004-11-11Check IFF_UP at tun_output().Marco Pfatschbacher
ok henning, markus.
2004-11-09big KNF spanking, no change in object file, ecstatic ok from claudioHenning Brauer
2004-11-09use NULL instead of 0 for poiter comparisions,Henning Brauer
from "Alexey E. Suslikov" <cruel@texnika.com.ua> with a little help from itojun
2004-07-16remove netiso shitz, millert okHenning Brauer
2004-06-25Add tap aka layer 2 tunneling support to tun(4). It can be enabled by settingClaudio Jeker
the link0 flag via ifconfig(8). OK markus@, canacar@ also tested by ish@
2004-04-25check for input queue congestion on those as well and call if_congestion whenHenning Brauer
needed; these are slightly different so that we cannot use the new IF_INPUT_ENQUEUE macro deraadt ok
2004-03-02don't leak mbuf if uiomove fails; from netbsd;Markus Friedl
ok henning, cedric, claudio, deraadt
2004-01-12use klist_invalidate to permit destroy while kqueued. ok mpf@Ted Unangst
2004-01-05stop ifc_destroy() if there are still knotes registered.Marco Pfatschbacher
ok mcbride@ markus@
2003-12-16return error in ifc_destroy; ok deraadt, itojun, cedric, hshoexerMarkus Friedl
2003-12-10de-register. deraadt okJun-ichiro itojun Hagino
2003-12-06support destroy; ok henningMarkus Friedl
2003-12-03add support for ifconfig clone/destroy; ok henning deraadtMarkus Friedl
2003-12-02add kq support from wayne@epipe.com.au and cmaxwell@themanor.net (now that ↵Michael Shalayeff
regress test is there too)
2003-09-23Replace select backends with poll backends. selscan() and pollscan()Todd C. Miller
now call the poll backend. With this change we implement greater poll(2) functionality instead of emulating it via the select backend. Adapted from NetBSD and including some changes from FreeBSD. Tested by many, deraadt@ OK
2003-08-15change arguments to suser. suser now takes the process, and a flagsTed Unangst
argument. old cred only calls user suser_ucred. this will allow future work to more flexibly implement the idea of a root process. looks like something i saw in freebsd, but a little different. use of suser_ucred vs suser in file system code should be looked at again, for the moment semantics remain unchanged. review and input from art@ testing and further review miod@
2003-06-12in FIONREAD and FREAD, use IFQ_POLL instead of looking at if_snd.ifq_len /Henning Brauer
ifq_head, to make altq work. prevents programs from spinning in non-blocking select()/read() loops in case of queues hitting their limits. This makes queueing on tun interfaces work. while it is still advised to assign packets to queues on tunX and queue on the physical interface in generic, this doesn't work in the PPPoE case with the userland pppoe process, there the mbuf tags with the queue IDs don't survive obviously. based on diff from Trevor Talbot, tested successfully by a lot of people on the pf@benzedrine.cx list. ok pb@ kjc@
2003-05-03string fixes; tedu okTheo de Raadt
2003-04-18Add code to set the TUN_* flags for INET6 addresses too. This allows aJason Wright
tun with ipv6 only to actually send/recv packets. itojun "looks ok to me" (after helping correct several iterations =)