Commit Graph

75 Commits

Author SHA1 Message Date
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
thorpej 71404bb533 Don't include <sys/map.h>. 2002-09-25 22:21:01 +00:00
itojun 6a3e3549fe backout recent changes, for PR 18392.
bpf_mtap() gets called with not-well-initialized mbuf, so we need to go through
it without touching m->m_pkthdr.len and such.  it's part of our bpf_mtap() API
(at least today).
2002-09-24 03:14:43 +00:00
atatat fe89a76e74 Add a missing semi-colon. 2002-09-19 03:04:32 +00:00
darrenr 0a30063654 For the trivial case where the packet is only in one mbuf, call bpf_tap()
(idea from FreeBSD) - alternative to changing bpf_filter() to be aware of
kernel calling convetion where 0 is passed as the length for mbufs.
2002-09-19 01:16:58 +00:00
darrenr 600f9cb660 If M_PKTHDR is set we can use m_pkthdr.len instead of the for loop. 2002-09-19 00:34:00 +00:00
thorpej 2d655f566e In bpf_setdlt(), preserve the promiscuous mode setting of the
descriptor.

From David Young <dyoung@ojctech.com>, slight change by me.
2002-09-15 23:44:12 +00:00
itojun 822449ac65 KNF - return is not a function. 2002-09-11 05:36:26 +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
onoe 5d6bb1fbc3 Define new kernel interface bpfattach2() to register another data link
type for the driver, which will be used for 802.11 drivers.
Also add 2 APIs to get a list of available DLTs and use one for them.
	BIOCGDLTLIST (struct bpf_dltlist)
	BIOCSDLT (u_int)
2002-08-28 09:34:57 +00:00
wrstuden 9e2b945a7b defparam BPF_BUFSIZE 2002-06-06 23:54:47 +00:00
darrenr 726f1074d8 If someone is poll'ing to write to bpf, assume that it can always be done
and include POLLOUT and POLLWRNORM in the returned events flag set.
Derived from FreeBSD.
2002-03-23 15:55:21 +00:00
lukem 34d65a3414 add RCSIDs 2001-11-12 23:49:33 +00:00
bjh21 52b3d56b11 Add MI Econet support. This is lacking any interfaces to higher-layer
protocols, and lacking any timeouts, but it basically works, doing four-way
handshakes in both directions and incoming Machine Peek operations.

Oh, and Econet is Acorn's ancient, proprietary 500kbit/s networking
technology.
2001-09-10 23:11:05 +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 d2bbed89e7 Fix non-blocking BPF reads, from Guy Harris, kern/11836. 2000-12-29 01:55:49 +00:00
thorpej bfaf37d464 Use <net/dlt.h> to get the DLT_* constants. Also change bpfattach()
and bpf_change_type() to take just a pointer to the ifnet, rather than
a pointer to the ifnet and a pointer to a member of the ifnet (the bpf
pointer).

We'll let this ride on the Dec 12 1.5N version bump.
2000-12-12 17:55:21 +00:00
thorpej 445487c8f3 Move ifpromimsc() to if.c 2000-07-04 18:46:49 +00:00
jhawk 8a49d6bd31 Ensure that all callers of pfind() can deal with pfind(0) returning
a real procp* rather than NULL.
2000-05-28 18:17:07 +00:00
matt 5108d90ce5 Fix bpf output on fddi to actually work. Make it compatible with ULTRIX
and Tru64.
2000-05-28 02:49:35 +00:00
jonathan c35d2c43a6 Make BPF_BUFSIZE overridable: 8192 is smaller than MTU of some devices.
TODO: defopt, or make sysctl'able (c.f. FreeBSD).
2000-05-12 05:58:01 +00:00
chs b9c0393d3f remove support for sunos and ancient BSDs. 2000-04-12 04:20:47 +00:00
augustss c1ebd1929a Kill some more register declarations. 2000-03-30 09:45:33 +00:00
soren 95054da1a1 Fix doubled 'the's in comments. 2000-03-13 23:52:25 +00:00
enami 9cb8699ba1 Revoke bpf device on detach. 2000-02-02 09:03:41 +00:00
enami 983b6de129 Since we are allowed to wait, no need to check the return value. 2000-02-02 08:36:02 +00:00
enami 19bff8f913 Remove duplicated forward declarations. 2000-02-02 07:45:13 +00:00
thorpej 891a2a9719 Implement bpfdetach(). 2000-01-31 23:06:12 +00:00
thorpej c806cc5a47 * Add the ability to change the data link type on the fly.
* Define two more data link types: NetBSD PPP-over-serial and NetBSD
PPP-over-Ethernet.  (Different PPP encaps have different header formats!)
1999-05-11 02:11:08 +00:00
bouyer 433c02431e Init the decriptors at boot time rather than at interface attach time.
Now that we have pcmcia hot-plug, it's not the same. Fixes kern/3189.
1998-12-04 11:04:37 +00:00
jonathan fb020850a0 Increase compiled-in default bpf buffer size from 4096 to 8192.
(the libpcap API provides no way to resize the inkernel buffe,r and
4096 is too small to capture maximum-sized FDDI frames.)
1998-11-05 22:50:15 +00:00
thorpej 7cc905f5c8 Add some braces to make egcs happy (ambiguous else warning). 1998-08-18 06:27:01 +00:00
perry b84f472652 Sigh. "consts in prototypes can be quite a drag..."
fix last two fixes one more time, this time dealing with ugly
prototype issues, including the fact that the bcopy returns nothing,
but memcpy returns a void *. Never mind that we don't use it...
1998-08-06 04:37:57 +00:00
perry 9f63941cfa Fix botched prototype decl in last fix. 1998-08-06 04:25:55 +00:00
perry df410f33db Convert bcopy,bzero to memcpy,memset
This was semi-nontrivial, since a function pointer to bcopy gets used
in this file.
Note #1: The catchpacket routine, which takes a function pointer to
         bpf_mcpy or memcpy, should probably be converted to take a
         flag that just says which is used, so memcpy can be inlined.
Note #2: The code is heavily #ifdef'ed to run on older operating
         systems. We probably want to clean that cruft out, unless
         someone is planning a new release of the code at LBL (doubtful.)
1998-08-06 04:24:25 +00:00
thorpej 27dba7b8e8 Implement two new BPF ioctls: BPFGHDRCMPLT and BPFSHDRCMPLT, to get/set
the "header already complete" flag.  This allows BPF writers to spoof
layer 2 source addresses (providing the layer 2 in use supports it) in
applications where this is necessary.  From Greg Smith <greg@nas.nasa.gov>.
1998-04-30 00:08:19 +00:00
fvdl e5bc90f40c Merge with Lite2 + local changes 1998-03-01 02:20:01 +00:00
mycroft 4666f77376 Do *not* free the mbuf chain we just created. 1997-10-12 16:35:10 +00:00
christos 6155bdd332 GC bd_sig 1997-10-09 18:58:08 +00:00
christos 3108a74999 Sync with bpf-1.2a1
- whitespace
	- add rcsid; our sccsid is newer than the one on 1.2a1.
	- change prototype to add mtu
	- change size_t to u_int for consistency.
	- add alignment stuff in bpf_movein
	- add more consistency checks bpf_movein
	- use one uiomove and then bcopy the data in bpf_movein
	- update the comment for the panic when ifpromisc fails.
	- separate the case when we have non blocking I/O and
	  no data and return EWOULDBLOCK
	- check for other errors and return them
	- pass the mtu to bpf_movein
	- Add the BPF_KERN_FILTER junk, just so that we keep up with the code
	- remove BIOCSRSIG, BIOCGRSIG; SIGIO does this well.
	- don't add the SIOCGIFADDR stuff (it is bogus)
	- Check for malloc return for consistency.
	- comment should say poll
	- change formatting to match the current code.
	- save and restore the pcount and flags in case we fail to set the
	  interface into promiscuous mode.
	- fix spelling typo.
1997-10-09 18:17:19 +00:00
scottr 4cf4807ab0 if_arc.h is in net, not netinet. 1997-03-17 06:45:20 +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
thorpej 60449c1840 Don't let the read timeout get inadvertently rounded down to 0.
From John Hawkinson <jhawk@mit.edu>, PR #2531.
1997-02-21 23:59:35 +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
cgd d73abf41aa avoid unnecessary checks of m_get/MGET/etc.'s return values. When
they're called with M_WAIT, they are defined to never return NULL.
1996-06-14 22:21:12 +00:00
mycroft 2a94215734 Remove duplicate definition of bpf_setif(). 1996-05-22 13:41:54 +00:00
thorpej 527565ac15 Kill a couple of unnecessary calls to strlen(). 1996-05-07 05:26:02 +00:00
thorpej 4edabe2501 Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit.  Updated interface to (*if_watchdog)() and (*if_reset)()
to take a struct ifnet *, rather than a unit number.
1996-05-07 02:40:22 +00:00