Commit Graph

76 Commits

Author SHA1 Message Date
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
augustss c1ebd1929a Kill some more register declarations. 2000-03-30 09:45:33 +00:00
itojun 118d2b1d4f IPv6 kernel code, based on KAME/NetBSD 1.4, SNAP kit 19990628.
(Sorry for a big commit, I can't separate this into several pieces...)
Pls check sys/netinet6/TODO and sys/netinet6/IMPLEMENTATION for details.

- sys/kern: do not assume single mbuf, accept chained mbuf on passing
  data from userland to kernel (or other way round).
- "midway" ATM card: ATM PVC pseudo device support, like those done in ALTQ
  package (ftp://ftp.csl.sony.co.jp/pub/kjc/).
- sys/netinet/tcp*: IPv4/v6 dual stack tcp support.
- sys/netinet/{ip6,icmp6}.h, sys/net/pfkeyv2.h: IETF document assumes those
  file to be there so we patch it up.
- sys/netinet: IPsec additions are here and there.
- sys/netinet6/*: most of IPv6 code sits here.
- sys/netkey: IPsec key management code
- dev/pci/pcidevs: regen

In my understanding no code here is subject to export control so it
should be safe.
1999-07-01 08:12:45 +00:00
mjacob d7e48cb804 adjust format args for compiler changes 1999-03-04 02:38:31 +00:00
sommerfe 14dc6ddfe6 Fix PR6473: allow sends to tun* devices using bpf. 1998-11-30 21:43:11 +00:00
veego ff2c3adddc Add some braces to stop the new egcs warnings. 1998-08-20 19:55:06 +00:00
jonathan 011f2bda08 defopt NS, NSIP. 1998-07-05 06:49:00 +00:00
jonathan 3751946b97 defopt INET, NETATALK. 1998-07-05 00:51:04 +00:00
matt fe94e79c57 Add SIOC{ADD|DEL}MULTI ioctl to support (for IFF_MULTICAST). 1997-09-25 13:11:58 +00:00
matt 27b993ed37 Add support of SIOCIFMTU to vary mtu of interface. Also allow IFF_MULTICAST
on TUNSIFMODE (sometimes you'd like to do IP multicast on tunnel devices).
1997-09-24 19:45:11 +00:00
is 07b064e02e New ARP system, supports IPv4 over any hardware link.
Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
1997-03-15 18:09:08 +00:00
christos a1dcf4b026 backout previous kprintf change 1996-10-13 02:10:01 +00:00
christos 10191279fb - printf -> kprintf, sprintf -> ksprintf 1996-10-10 22:59:41 +00:00
mycroft 2bc736661a Implement poll(2). 1996-09-07 12:40:22 +00:00