summaryrefslogtreecommitdiffstats
path: root/sys/net/if_tun.c
Commit message (Collapse)AuthorAgeFilesLines
* o eliminate widespread on-stack mbuf use for bpf by introducingsam2003-12-281-47/+3
| | | | | | | | | | | | | a new bpf_mtap2 routine that does the right thing for an mbuf and a variable-length chunk of data that should be prepended. o while we're sweeping the drivers, use u_int32_t uniformly when when prepending the address family (several places were assuming sizeof(int) was 4) o return M_ASSERTVALID to BPF_MTAP* now that all stack-allocated mbufs have been eliminated; this may better be moved to the bpf routines Reviewed by: arch@ and several others
* - Implement selwakeuppri() which allows raising the priority of atanimura2003-11-091-2/+2
| | | | | | | | | | | | | thread being waken up. The thread waken up can run at a priority as high as after tsleep(). - Replace selwakeup()s with selwakeuppri()s and pass appropriate priorities. - Add cv_broadcastpri() which raises the priority of the broadcast threads. Used by selwakeuppri() if collision occurs. Not objected in: -arch, -current
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-6/+5
| | | | | | | | | | | | | if_xname, if_dname, and if_dunit. if_xname is the name of the interface and if_dname/unit are the driver name and instance. This change paves the way for interface renaming and enhanced pseudo device creation and configuration symantics. Approved By: re (in principle) Reviewed By: njl, imp Tested On: i386, amd64, sparc64 Obtained From: NetBSD (if_xname)
* Make TUNDEBUG use if_printf instead of printf.brooks2003-10-311-24/+17
|
* Use IF_MAXUNIT instead of rolling our own identical TUN_MAXUNIT.brooks2003-10-231-4/+3
|
* Correctly name r_unit member tun_unit.phk2003-09-271-3/+3
| | | | Remove unused tun_wsel member.
* Revert last change and insure the driver can support other address families.jlemon2003-03-081-0/+18
| | | | Pointed out by: ume, matusita
* The tun driver is INET only. Don't pretend to support other address families.jlemon2003-03-081-25/+0
| | | | Sponsored by: DARPA, NAI Labs
* Finish driving a stake through the heart of netns and the associatedpeter2003-03-051-5/+0
| | | | | | ifdefs scattered around the place - its dead Jim! The SMB stuff had stolen AF_NS, make it official.
* Update netisr handling; Each SWI now registers its queue, and all queuejlemon2003-03-041-3/+48
| | | | | | | | | | drain routines are done by swi_net, which allows for better queue control at some future point. Packets may also be directly dispatched to a netisr instead of queued, this may be of interest at some installations, but currently defaults to off. Reviewed by: hsu, silby, jayanth, sam Sponsored by: DARPA, NAI Labs
* Gigacommit to improve device-driver source compatibility betweenphk2003-03-031-13/+8
| | | | | | | | | | | | | branches: Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values. This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386. Approved by: re(scottl)
* More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9).des2003-03-021-2/+2
|
* Clean up whitespace, s/register //, refrain from strong urge to ANSIfy.des2003-03-021-31/+31
|
* uiomove-related caddr_t -> void * (just the low-hanging fruit)des2003-03-021-2/+2
|
* NODEVFS cleanup: remove calls to cdevsw_remove()phk2003-02-261-2/+0
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-5/+5
| | | | Approved by: trb
* NODEVFS cleanup: unifdefphk2003-01-301-10/+0
|
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-5/+5
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Originally when DEVFS was added, a global variable "devfs_present"phk2003-01-191-8/+9
| | | | | | | | | | | | was used to control code which were conditional on DEVFS' precense since this avoided the need for large-scale source pollution with #include "opt_geom.h" Now that we approach making DEVFS standard, replace these tests with an #ifdef to facilitate mechanical removal once DEVFS becomes non-optional. No functional change by this commit.
* network interface and link layer changes:sam2002-11-151-3/+3
| | | | | | | | | | | | o on input don't strip the Ethernet header from packets o input packet handling is now done with if_input o track changes to ether_ifattach/ether_ifdetach API o track changes to bpf tapping o call ether_ioctl for default handling of ioctl's o use constants from net/ethernet.h where possible Reviewed by: many Approved by: re
* Don't check IFF_RUNNING in previous change.simokawa2002-10-251-2/+2
| | | | | The flag is sometimes unset if the interface has IPv6 link-local address only.
* Don't send/recieve packets when the interface is down.simokawa2002-10-231-0/+9
|
* Don't us an array[1], it just hides where '&' isn't used right.phk2002-10-201-11/+11
| | | | | | Be consistent about functions being static. Verified by: md5 hash of generated .o file.
* In an SMP environment post-Giant it is no longer safe to blindlytruckman2002-10-031-2/+2
| | | | | | | | | dereference the struct sigio pointer without any locking. Change fgetown() to take a reference to the pointer instead of a copy of the pointer and call SIGIO_LOCK() before copying the pointer and dereferencing it. Reviewed by: rwatson
* Introduce support for Mandatory Access Control and extensiblerwatson2002-07-311-0/+16
| | | | | | | | | | | | | | | | | kernel access control. Label mbufs received via kernel tunnel device interfaces by invoking appropriate MAC framework entry points. Perform access control checks on out-going mbufs delivered via tunnel interfaces by invoking appropriate MAC entry points: NOTE: Currently the label for a tunnel interface is not derived from the label of the process that opened the tunnel interface. It probably should be. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Make funsetown() take a 'struct sigio **' so that the locking canalfred2002-05-061-1/+1
| | | | | | | | | | | | | | | | be done internally. Ensure that no one can fsetown() to a dying process/pgrp. We need to check the process for P_WEXIT to see if it's exiting. Process groups are already safe because there is no such thing as a pgrp zombie, therefore the proctree lock completely protects the pgrp from having sigio structures associated with it after it runs funsetownlst. Add sigio lock to witness list under proctree and allproc, but over proc and pgrp. Seigo Tanimura helped with this.
* Redo the sigio locking.alfred2002-05-011-1/+1
| | | | | | | | | | | Turn the sigio sx into a mutex. Sigio lock is really only needed to protect interrupts from dereferencing the sigio pointer in an object when the sigio itself is being destroyed. In order to do this in the most unintrusive manner change pgsigio's sigio * argument into a **, that way we can lock internally to the function.
* Replace (deprecated ?) FREE() macro with direct calls to free()luigi2002-04-041-1/+1
|
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-04-011-1/+1
| | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@
* minor style(9) fix: return (foo); The file was mostly style(9) before.imp2002-02-261-16/+16
|
* Get rid of the twisted MFREE() macro entirely.dillon2002-02-051-11/+10
| | | | | Reviewed by: dg, bmilekic MFC after: 3 days
* Use the passed in thread to selrecord() instead of curthread.jhb2001-09-211-1/+1
|
* KSE Milestone 2julian2001-09-121-8/+9
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* TUNSIFINFO now expects IFF_MULTICAST to be OR'd with either IFF_POINTOPOINTbrian2001-08-251-6/+4
| | | | | | or IFF_BROADCAST. If it's not, the IFF_MULTICAST is removed. This is in line with how NetBSD & OpenBSD do it.
* Don't terminate the uiomove() loop on a zero-length mbuf. It's notfenner2001-08-031-4/+3
| | | | | | | particularly nice that IPSEC inserts a zero-length mbuf into the chain, and that bug should be fixed too, but interfaces should be robust to bad input. Print the interface name when TUNDEBUG()ing about dropping an mbuf.
* Close a race where we were releasing the unit resource at the startbrian2001-06-201-2/+4
| | | | | | | | | | | | of tunclose() rather than the end, and tunopen() grabbed that unit before tunclose() finished (one process is allocating it while another is freeing it!). It may be worth hanging some sort of rw mutex around all specinfo calls where d_close and the detach handler get a write lock and all other functions get a read lock. This would guarantee certain levels of ``atomicity'' (is that a word?) that people may expect (I believe Solaris does something like this).
* Remove the SI_CHEAPCLONE flag when hanging resources off the dev_tbrian2001-06-181-0/+2
|
* Support /dev/tun cloning. Ansify if_tun.c while I'm there.brian2001-06-011-92/+129
| | | | | | | | | | | | | | Only tun0 -> tun32767 may now be opened as struct ifnet's if_unit is a short. It's now possible to open /dev/tun and get a handle back for an available tun device (use devname to find out what you got). The implementation uses rman by popular demand (and against my judgement) to track opened devices and uses the new dev_depends() to ensure that all make_dev()d devices go away before the module is unloaded. Reviewed by: phk
* Make if_tun's clone create SI_CHEAPCLONE devices.phk2001-05-251-0/+1
|
* Dont (ab)use drv2 to know if (si_flags & SI_NAMED) (pointed out by dd)brian2001-04-171-5/+3
| | | | Call cdevsw_remove when we unload.
* Allow MOD_UNLOADs of if_tun, and handle event handler registrationbrian2001-04-031-10/+42
| | | | | | | | failures in MOD_LOAD. Dodge duplicate make_dev() calls by (ab)using dev->si_drv2 to remember if we created the device node via a dev_clone callback before the d_open call.
* Return 0 and do nothing when we get a SIOCSIFFLAGS.brian2001-04-021-0/+1
| | | | | | | Without this, ifpromisc() always fails (after setting the IFF_PROMISC bit in ifp->if_flags) and bpf never bothers to turn promiscuous mode off. PR: 20188
* Send the remains (such as I have located) of "block major numbers" tophk2001-03-261-1/+0
| | | | the bit-bucket.
* Another round of the <sys/queue.h> FOREACH transmogriffer.phk2001-02-041-2/+1
| | | | | Created with: sed(1) Reviewed by: md5(1)
* Use <sys/queue.h> macro api rather than fondle its implementation detals.phk2001-02-031-4/+4
| | | | | Created with: /usr/bin/sed Reviewed by: /sbin/md5
* o Allow non-root users to open /dev/tun* (remove suser()brian2001-02-031-8/+5
| | | | | | | | | | | | | in tunopen()) o Change the default device permissions to 0600 root:wheel (were uucp:dialer) o Only let root (suser()) change the MTU This makes it possible for an administrator to open up the permissions on /dev/tun*, letting non-root programs service a tun interface. Co-operation is still required with a priviledged program that will configure the interface side of things.
* Pass the minor number rather than the unit number to make_dev()brian2001-02-021-2/+1
| | | | from the clone handler.
* Exterminate the use of PSEUDO_SET() with extreme prejudice.peter2001-01-311-11/+23
|
* Convert more malloc+bzero to malloc+M_ZERO.dwmalone2000-12-081-2/+1
| | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net>
* Move the wakeup/signaling of the reader side of the tun device intojlemon2000-12-051-9/+18
| | | | | | a tunstart function, which is called when a packet is sucessfully placed on the queue. This allows us to properly do output byte accounting within the handoff routine.
OpenPOWER on IntegriCloud