Commit Graph

89 Commits

Author SHA1 Message Date
elad
874fef3711 integrate kauth. 2006-05-14 21:19:33 +00:00
rpaulo
994567415c Fix another typo... I must be on drugs... 2006-04-18 19:30:49 +00:00
rpaulo
58e5792e6a IFHEAD and PREPADDR are mutually exclusive. From FreeBSD. 2006-04-08 12:14:42 +00:00
rpaulo
b5d1102290 Add another bit from FreeBSD that I forgot: in tun_output, don't try to send
an AF_INET packet if TUN_IFHEAD is not set.
From FreeBSD and spotted (again) by DEGROOTE Arnaud.
2006-04-04 15:43:23 +00:00
rpaulo
ca98b087a8 Fix a if-clause botched in a previous revision now that we have TUN_IFHEAD.
Spotted by DEGROOTE Arnaud <degroote@enseirb.fr>.
2006-04-04 11:33:15 +00:00
rpaulo
0dcbc9b794 Implement TUN_IFHEAD, the missing piece that was breaking old applications. 2006-04-03 23:29:39 +00:00
rpaulo
782e550804 Add missing break tunwrite() which was causing EAFNOSUPPORT to be
returned, thus making IPv6 support broken.
!@#$%^...
2006-03-29 19:29:00 +00:00
rpaulo
d5648da4c6 Some minor KNF. 2006-03-03 19:57:37 +00:00
rpaulo
ece0242b47 Fix typo in comment. 2006-03-03 19:46:35 +00:00
rpaulo
a0814a3043 Add full support for IPv6 tunnels. From DEGROOTE Arnaud in PR 32944.
The PR submitter and the PR handler were unable to test this code
using Teredo userland clients such as Miredo. However, the PR handler
dumped and analyzed some of the packets produced by Miredo and they
seemed fine.
(On a side note: I was unable to setup Teredo in Windows XP and the
problem seemed similar to what I currently see in NetBSD: lack of
replies from the Teredo relay).
2006-02-28 00:38:35 +00:00
rpaulo
be72809857 Add preliminary/not tested support for IPv6. 2006-02-05 16:44:55 +00:00
thorpej
63eac52bac ANSI function decls and application of static. 2005-12-11 23:05:24 +00:00
christos
95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
matt
027c11539b Add IFNET_FOREACH and IFADDR_FOREACH macros and start using them. 2005-01-24 21:25:09 +00:00
christos
64573a67d7 Sprinkle #ifdef INET to make a GENERIC kernel compile with INET undefined. 2004-12-06 02:59:23 +00:00
peter
e3ceb08f8d Remove redundant conditional; NTUN is always 1 when this file is compiled.
Also remove tun.h include, since it's no longer needed.
2004-12-04 23:22:58 +00:00
peter
b9c49ebff1 Change ifc_destroy to return an int instead of void, so that it
can pass back errors to ifconfig.
2004-12-04 18:31:43 +00:00
christos
0f7d471853 Factor out the hand-crafting of mbufs from the interface files. Reviewed by
gimpy. XXX: I could have used bpf_mtap2 on some of the new functions, but I
chose not to, because I just wanted to do what amounts to a code move.
2004-08-19 20:58:23 +00:00
dyoung
eaa20d476a Use bpf_mtap2 in tun(4). 2004-06-06 04:36:29 +00:00
pk
454a5a1188 Fix locking issues noticed by Tom Ivar Helbekkmo on tech-net:
* always acquire the device instance lock at splnet()
	* missing unlocks in various places

Also, since this driver allows its device instances manipulated by two
independent subsystems (character device & interface clone create/destroy),
be careful not to rip away instance data in a clone destroy request if the
instance is still opened as a character device.
2004-05-14 13:23:12 +00:00
tron
edadbda9d6 Initialize interface type to IFT_TUNNEL as suggested by Erik Änggård
in PR kern/25555.
2004-05-13 11:31:09 +00:00
tron
a188d6072b Don't leak memory if a copyin fails. 2004-03-01 13:54:02 +00:00
cl
c49d4a7e55 pass signo to fownsignal #ifdef ALTQ 2003-09-22 20:49:39 +00:00
christos
6edc0e184e - pass signo to fownsignal [ok by jd]
- make urg signal handling use fownsignal
- remove out of band detection in sowakeup
2003-09-22 12:59:55 +00:00
jdolecek
1fda9a87e7 kill unused variable in #ifdef ALTQ part, to make this compile
with ALTQ configured in
2003-09-22 03:29:34 +00:00
jdolecek
7cea8a1389 cleanup & uniform descriptor owner handling:
* introduce fsetown(), fgetown(), fownsignal() - this sets/retrieves/signals
  the owner of descriptor, according to appropriate sematics
  of TIOCSPGRP/FIOSETOWN/SIOCSPGRP/TIOCGPGRP/FIOGETOWN/SIOCGPGRP ioctl; use
  these routines instead of custom code where appropriate
* make every place handling TIOCSPGRP/TIOCGPGRP handle also FIOSETOWN/FIOGETOWN
  properly, and remove the translation of FIO[SG]OWN to TIOC[SG]PGRP
  in sys_ioctl() & sys_fcntl()
* also remove the socket-specific hack in sys_ioctl()/sys_fcntl() and
  pass the ioctls down to soo_ioctl() as any other ioctl

change discussed on tech-kern@
2003-09-21 19:16:48 +00:00
fvdl
d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
darrenr
960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
itojun
860a851ea8 KNF 2003-05-02 03:15:23 +00:00
itojun
5576ac2656 bpf_mtap() does not care about M_PKTHDR at the top. M_COPY_PKTHDR has some
consequences, so avoid it.  if we need to attach dummy headers, we should
use M_PREPEND instead.
2003-05-01 07:52:58 +00:00
dsl
30630417a8 Validate pgid arg to TIOCSPGRP 2003-03-13 10:24:38 +00:00
jdolecek
6973160773 count input/output bytes for tun device
Problem reported and patch provided in PR kern/19554 by Michael van Elst
2002-12-25 08:40:20 +00:00
christos
f5ff34bbc6 si_ -> sel_ 2002-11-26 18:51:18 +00:00
jdolecek
e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
simonb
4e3613273b Remove breaks after returns, unreachable returns and returns after
returns(!).
2002-09-23 05:51:10 +00:00
simonb
f8a2d422d1 uio_resid is a size_t (ie, unsigned), so don't check if it's less than 0. 2002-09-23 04:26:17 +00:00
gehenna
77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
atatat
6675196afb Make tun interfaces perform auto-creation. This means that if a
program opens /dev/tun# and tun# has not been SIOCIFCREATE'd already,
it will be SIOCIFCREATE'd automatically.  FreeBSD's tun interfaces
behave in a somewhat similar fashion.
2002-07-29 16:53:30 +00:00
itojun
496665ab2c suppress -Wunused if !INET6 2002-03-13 06:43:18 +00:00
itojun
ac36f7cb2c bring in latest ALTQ from kjc. ALTQify some of the drivers. 2002-03-05 04:12:57 +00:00
lukem
64a432d965 remove unnecessary #if NFOO > 0 .... #endif wrappers 2001-11-13 00:49:35 +00:00
lukem
34d65a3414 add RCSIDs 2001-11-12 23:49:33 +00:00
matt
b5e785f38d Switch to using queue access macros instead of refering to the member
fields explicitly.
2001-11-05 18:02:15 +00:00
atatat
6e885d365a Turn the tun device/network interface into a cloning device. 2001-10-31 20:08:17 +00:00
itojun
43383b1e36 simplify previous fix (0-length mbuf in mbuf chain). from freebsd 2001-08-03 21:11:57 +00:00
itojun
47133068ba do not break from loop even if m_len == 0. it's valid to have
mbuf with m_len == 0 in mbuf chain.
2001-08-02 13:37:51 +00:00
thorpej
bf2dcec4f5 Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
2001-04-13 23:29:55 +00:00
thorpej
fc5dafc79b Fix a rather annoying problem where the sockaddr_dl which holds
the link level name for the interface (ifp->if_sadl) is allocated
before ifp->if_addrlen is initialized, which could lead to allocating
too little space for the link level address.

Do this by splitting allocation of the link level name out of
if_attach() and into if_alloc_sadl(), which is normally called
by functions like ether_ifattach().  Network interfaces which
don't have a link-specific attach routine must call if_alloc_sadl()
themselves (example: gif).

Link level names are freed by if_free_sadl(), which can be called
from e.g. ether_ifdetach().  Drivers never need call if_free_sadl()
themselves as if_detach() will do it if it is not already done.

While here, add the ability to pass an AF_LINK address to
SIOCSIFADDR in ether_ioctl() (this is what caused me to notice
the problem that the above fixes).
2001-01-17 00:30:49 +00:00
thorpej
ed7695a765 Fill in if_dlt. 2000-12-18 19:44:33 +00:00
thorpej
c5293456da Adapt to bpfattach() changes, and further centralize the bpfattach()
and bpfdetach() calls into link-type subroutines where possible.
2000-12-12 18:00:22 +00:00