summaryrefslogtreecommitdiffstats
path: root/sys/net/if_tun.c
Commit message (Collapse)AuthorAgeFilesLines
* Add a new interface ioctl, to return "aux status".phk1999-06-191-1/+11
| | | | | | | | | | | | | | | | | | | This is inteded for to allow ifconfig to print various unstructured information from an interface. The data is returned from the kernel in ASCII form, see the comment in if.h for some technicalities. Canonical cut&paste example to be found in if_tun.c Initial use: Now tun* interfaces tell the PID of the process which opened them. Future uses could be (volounteers welcome!): Have ppp/slip interfaces tell which tty they use. Make sync interfaces return their media state: red/yellow/blue alarm, timeslot assignment and so on. Make ethernets warn about missing heartbeats and/or cables
* Simplify cdevsw registration.phk1999-05-311-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The cdevsw_add() function now finds the major number(s) in the struct cdevsw passed to it. cdevsw_add_generic() is no longer needed, cdevsw_add() does the same thing. cdevsw_add() will print an message if the d_maj field looks bogus. Remove nblkdev and nchrdev variables. Most places they were used bogusly. Instead check a dev_t for validity by seeing if devsw() or bdevsw() returns NULL. Move bdevsw() and devsw() functions to kern/kern_conf.c Bump __FreeBSD_version to 400006 This commit removes: 72 bogus makedev() calls 26 bogus SYSINIT functions if_xe.c bogusly accessed cdevsw[], author/maintainer please fix. I4b and vinum not changed. Patches emailed to authors. LINT probably broken until they catch up.
* This commit should be a extensive NO-OP:phk1999-05-301-3/+19
| | | | | | | | | | | | | Reformat and initialize correctly all "struct cdevsw". Initialize the d_maj and d_bmaj fields. The d_reset field was not removed, although it is never used. I used a program to do most of this, so all the files now use the same consistent format. Please keep it that way. Vinum and i4b not modified, patches emailed to respective authors.
* In tunclose():brian1999-05-271-11/+15
| | | | | Delete all routes if IFF_RUNNING is set, irrespective of IFF_UP Unset IFF_RUNNING.
* Add sufficient braces to keep egcs happy about potentially ambiguouspeter1999-05-061-2/+2
| | | | if/else nesting.
* Suser() simplification:phk1999-04-271-1/+1
| | | | | | | | | | | | | | | | | | | 1: s/suser/suser_xxx/ 2: Add new function: suser(struct proc *), prototyped in <sys/proc.h>. 3: s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/ The remaining suser_xxx() calls will be scrutinized and dealt with later. There may be some unneeded #include <sys/cred.h>, but they are left as an exercise for Bruce. More changes to the suser() API will come along with the "jail" code.
* Implement TUNSIFMODE and TUNSLMODE.des1999-03-241-1/+42
| | | | Submitted by: Alfred Perlstein <bright@cygnus.rush.net>
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-271-2/+2
| | | | kernel compile
* Undo #undef KERNEL hack for vnode.h to avoid vnode_if.h.peter1999-01-171-6/+0
| | | | | | | | | XXX It probably makes sense to have a flag for bsd.kern.mk to avoid these rules. XXX IO_NDELAY seems to be the main reason for it, when used in a cdevsw read or write "flag" context. Perhaps a redundant declaration somewhere like sys/conf.h might help remove the need for vnode.h in these device drivers in the first place.
* The "easy" fixes for compiling the kernel -Wunused: remove unreferenced staticarchie1998-12-071-1/+0
| | | | and local variables, goto labels, and functions declared but not defined.
* Installed the second patch attached to kern/7899 with some changes suggestedtruckman1998-11-111-11/+18
| | | | | | | | | | | | | | | | by bde, a few other tweaks to get the patch to apply cleanly again and some improvements to the comments. This change closes some fairly minor security holes associated with F_SETOWN, fixes a few bugs, and removes some limitations that F_SETOWN had on tty devices. For more details, see the description on the PR. Because this patch increases the size of the proc and pgrp structures, it is necessary to re-install the includes and recompile libkvm, the vinum lkm, fstat, gcore, gdb, ipfilter, ps, top, and w. PR: kern/7899 Reviewed by: bde, elvind
* This commit fixes various 64bit portability problems required fordfr1998-06-071-3/+3
| | | | | | | | | | FreeBSD/alpha. The most significant item is to change the command argument to ioctl functions from int to u_long. This change brings us inline with various other BSD versions. Driver writers may like to use (__FreeBSD_version == 300003) to detect this change. The prototype FreeBSD/alpha machdep will follow in a couple of days time.
* Support more than 256 tun devices:brian1998-04-271-9/+13
| | | | | | | | $ ls -l /dev/tun25[4-7] crw------- 1 fax dialer 52, 254 Apr 27 02:27 /dev/tun254 crw------- 1 fax dialer 52, 255 Apr 27 02:27 /dev/tun255 crw------- 1 fax dialer 52, 0x00010000 Apr 27 02:31 /dev/tun256 crw------- 1 fax dialer 52, 0x00010001 Apr 27 02:31 /dev/tun257
* Seventy-odd "its" / "it's" typos in comments fixed as per kern/6108.des1998-04-171-1/+1
|
* Use getmicrotime() for if_lastchange, 10msec is plenty precision.phk1998-04-061-1/+1
|
* Don't depend on "implicit int" or bloat the data section in thebde1998-02-201-1/+1
| | | | declaration of xxx_devsw_installed.
* Revert previous commit. Remove all ifp->if_* = 0 initializations,steve1998-02-011-7/+0
| | | | | | | since pkh made tunctl static in revision 1.17 these are already guaranteed to be zero'd and tunattach will only be called once. Pointed out by: Bruce Evans and Bill Fenner
* Initialize if_ibytes and if_obytes to zero.steve1998-01-251-0/+2
| | | | | PR: 1376 Submitted by: risner@stdio.com
* Make all file-system (MFS, FFS, NFS, LFS, DEVFS) related option new-style.eivind1998-01-241-0/+1
| | | | | | | | This introduce an xxxFS_BOOT for each of the rootable filesystems. (Presently not required, but encouraged to allow a smooth move of option *FS to opt_dontuse.h later.) LFS is temporarily disabled, and will be re-enabled tomorrow.
* Move softc stuff into if_tunvar.hbrian1998-01-111-0/+1
| | | | | | Suggested by: Peter Wemm <peter@netplex.com.au> Hinted at by: Bruce Evans <bde@FreeBSD.org> À³
* Make INET a proper option.eivind1998-01-081-2/+8
| | | | | | | | | | | | This will not make any of object files that LINT create change; there might be differences with INET disabled, but hardly anything compiled before without INET anyway. Now the 'obvious' things will give a proper error if compiled without inet - ipx_ip, ipfw, tcp_debug. The only thing that _should_ work (but can't be made to compile reasonably easily) is sppp :-( This commit move struct arpcom from <netinet/if_ether.h> to <net/if_arp.h>.
* Removed unused #includes.bde1997-11-181-18/+26
| | | | | | Fixed gratuitous ANSIisms. Fixed nonblocking mode. It was per-device instead of per-file.
* Update select -> pollpeter1997-09-141-20/+20
|
* As the Tunnel device has no real inherrent MRU limit,julian1997-06-111-1/+1
| | | | | | | | so don't enforce the MTU as an MRU. Allow bidirectional ppp MTU negotiation, by checking against a differnt figure for MRU. Make it large enough for ATM frames at least. Submitted by: archie@whistle.com (archie cobbs)
* Don't include <sys/ioctl.h> in the kernel. Stage 6: includebde1997-03-241-1/+3
| | | | | | | <sys/filio.h>, <sys/sockio.h> and <sys/ttycom.h> instead of <sys/ioctl.h> in a couple of files. This is still only 1/3 as spammish as <sys/ioctl.h> - 5 or 6 old tty ioctl headers aren't needed.
* Don't #include <sys/fcntl.h> in <sys/file.h> if KERNEL is defined.bde1997-03-231-1/+1
| | | | | Fixed everything that depended on getting fcntl.h stuff from the wrong place. Most things don't depend on file.h stuff at all.
* Don't try to do anything with the `ifr' parameter for SIOCADDMULTIwollman1997-01-171-15/+0
| | | | and SIOCDELMULTI; it is guaranteed to be null in the new system.
* Change default tun MTU back to 1500.fenner1996-12-161-1/+6
| | | | | | | Use the interface MTU instead of the constant when deciding what packets to accept. Allow using the SIOCSIFMTU ioctl (e.g. "ifconfig tun0 mtu XXX") to set the MTU.
* Convert the interface address and IP interface address structureswollman1996-12-131-2/+4
| | | | | | to TAILQs. Fix places which referenced these for no good reason that I can see (the references remain, but were fixed to compile again; they are still questionable).
* 2 small changes:julian1996-12-021-1/+5
| | | | | | | | | | | | | | 1/ increase the tun MTU from 1500 to 1600 to allow it to be used with packets formatted according to RFC1490 and RFC1717 2/ allow the tsleep() when reading, to be interruptable by signals so that one can now do: od -xc </dev/tun0 to dump packets for debugging without getting hung. Passed on by: Archie@whistle.com (archie Cobbs) Nice but not neccessary in 2.2
* Remove an un-necessary call to microtime() to set if_lastchangegpalmer1996-06-231-1/+0
| | | | as it is set in the call to if_down in the line above
* Since the updates to ifnet.if_lastchange are so rare (relativelygpalmer1996-06-121-2/+2
| | | | | | | speaking), go for the extra accuracy and call microtime() to get the current time. Pointed Out By: bde
* Change the use if ifnet.if_lastchange to be more in line withgpalmer1996-06-101-2/+5
| | | | | SNMP requirements. Update description of ifnet.if_lastchange in if.h to indicate this.
* Also count bytes in if_tun. kern/1253phk1996-06-091-0/+2
| | | | | Reviewed by: phk Submitted by: John Capo <jc@irbs.com>
* added missing semicolonscrappy1996-05-261-1/+1
| | | | Submitted by: Jeffrey Hsu <hsu@freefall.freebsd.org>
* If tunnel is busy we return EBUSY, not ENXIO.phk1996-05-261-1/+1
|
* Removed never-used #includes of <machine/cpu.h>. Many were apparentlybde1996-04-071-2/+0
| | | | copied from bad examples.
* Fixed ownerships of callout devices.bde1996-03-271-7/+3
|
* Make tundebug sysctl writable.phk1996-02-091-1/+1
|
* Clean up Ethernet drivers:wollman1996-02-061-5/+5
| | | | | | | | - fill in and use ifp->if_softc - use if_bpf rather than private cookie variables - change bpf interface to take advantage of this - call ether_ifattach() directly from Ethernet drivers - delete kludge in if_attach() that did this indirectly
* Make FIONREAD return the actual that a read() would return, not just thepeter1995-12-111-3/+5
| | | | | | amount of data in the first mbuf. Obtained from: Bob Smart <smart@mel.dit.csiro.au> (for NetBSD & SunOS)
* Restored used variable `name[32]' (used by DEVFS).bde1995-12-101-3/+3
| | | | | Removed an `#ifdef __FreeBSD__'. Hundreds, if not thousands of other FreeBSD-specific things aren't ifdefed.
* Staticize, clean lint.phk1995-12-091-9/+9
|
* Pass 3 of the great devsw changesjulian1995-12-081-53/+38
| | | | | | | | | | | | | | | | | | | | | | | most devsw referenced functions are now static, as they are in the same file as their devsw structure. I've also added DEVFS support for nearly every device in the system, however many of the devices have 'incorrect' names under DEVFS because I couldn't quickly work out the correct naming conventions. (but devfs won't be coming on line for a month or so anyhow so that doesn't matter) If you "OWN" a device which would normally have an entry in /dev then search for the devfs_add_devsw() entries and munge to make them right.. check out similar devices to see what I might have done in them in you can't see what's going on.. for a laugh compare conf.c conf.h defore and after... :) I have not doen DEVFS entries for any DISKSLICE devices yet as that will be a much more complicated job.. (pass 5 :) pass 4 will be to make the devsw tables of type (cdevsw * ) rather than (cdevsw) seems to work here.. complaints to the usual places.. :)
* If you're going to mechanically replicate something in 50 filesjulian1995-11-291-1/+1
| | | | it's best to not have a (compiles cleanly) typo in it! (sigh)
* OK, that's it..julian1995-11-291-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | That's EVERY SINGLE driver that has an entry in conf.c.. my next trick will be to define cdevsw[] and bdevsw[] as empty arrays and remove all those DAMNED defines as well.. Each of these drivers has a SYSINIT linker set entry that comes in very early.. and asks teh driver to add it's own entry to the two devsw[] tables. some slight reworking of the commits from yesterday (added the SYSINIT stuff and some usually wrong but token DEVFS entries to all these devices. BTW does anyone know where the 'ata' entries in conf.c actually reside? seems we don't actually have a 'ataopen() etc... If you want to add a new device in conf.c please make sure I know so I can keep it up to date too.. as before, this is all dependent on #if defined(JREMOD) (and #ifdef DEVFS in parts)
* Replaced bogus macros for dummy devswitch entries by functions.bde1995-11-061-6/+7
| | | | | | | | | | | | | | | | | | These functions went away: enosys (hasn't been used for some time) enxio enodev enoioctl (was used only once, actually for a vop) if_tun.c: Continued cleaning up... conf.h: Probably fixed the type of d_reset_t. It is hard to tell the correct type because there are no non-dummy device reset functions. Removed last vestige of ambiguous sleep message strings.
* Moved prototypes for devswitch functions from conf.c and driver sourcesbde1995-11-041-6/+0
| | | | | | | to <machine/conf.h>. conf.h was mechanically generated by `grep ^d_ conf.c >conf.h'. This accounts for part of its ugliness. The prototypes should be moved back to the driver sources when the functions are staticalized.
* Second batch of cleanup changes.phk1995-10-291-2/+0
| | | | | This time mostly making a lot of things static and some unused variables here and there.
* Add BPF and IP multicast capabilities to the `tun' and `lp' networkwollman1995-09-251-1/+30
| | | | | | interfaces. Submitted by: Bill Fenner <fenner@parc.xerox.com>
OpenPOWER on IntegriCloud