dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

117 Commits

Author SHA1 Message Date
guy 2d1ac3b4d5 From Peter Fales <peter@fales-lorenz.net>: support for Linux ARCNET,
which supplies different headers from BSD ARCNET, and fixes to the
ARCNET code generator (the protocol ID field is 1 byte, so the values
for it shouldn't be byte-swapped).

Whitespace cleanups.

The "NetBSD-style" ARCNET headers are used in other BSDs as well, so
just call them "BSD-style".
2003-01-23 07:24:51 +00:00
guy 5b474ef2bb Move the freeing of "p->dlt_list" to the proper place. 2003-01-16 07:44:27 +00:00
guy 3150af88f7 Squelch compiler warnings from Sun C. 2003-01-03 08:34:46 +00:00
guy 482fa426bc NetBSD support for multiple data link types on an interface, from David
Young <dyoung@ojctech.com>, with some minor changes by Jason R.  Thorpe
<thorpej@netbsd.org>, and further changes by me to support it on BPF
systems lacking BIOCGDLTLIST and other platforms lacking an equivalent
feature.

Update Jason Thorpe's e-mail address (Zembu is going away, if it hasn't
done so already).

Add APIs to map DLT names to DLT values and vice versa.
2002-12-19 09:05:45 +00:00
guy 309e386870 Use <pcap-stdinc.h> only on Windows; on UNIX, selectively include, in
each source file, only the headers that file needs, and all the headers
it needs in order to compile on various platforms and not to get any
avoidable compiler warnings on those platforms (as well as any
incomplete structure definitions needed to avoid those warnings).

That also means that <pcap.h> doesn't include <pcap-stdinc.h> on UNIX;
we don't want it to include <pcap-stdinc.h>, at least on UNIX, as doing
so

	1) would mean we'd have to install that, so that programs can
	   build with libpcap

and

	2) would mean that programs including <pcap.h> would drag in a
	   bunch of header files that they don't need.

Put a newline at the end of "inet.c" - the Sun C compiler doesn't like
it if the last line doesn't end with a newline.
2002-08-02 03:44:19 +00:00
risso 6831542ec7 Added support for Win32, based on WinPcap. 2002-08-01 08:33:01 +00:00
itojun 5918c491c1 whitespace cleanup 2002-06-11 17:04:44 +00:00
guy 99f5637e53 Have "pcap_setnonblock()" just return 0 on success, not the new value of
the file descriptor flags; there's no guarantee that it will actually
*affect* the file descriptor flags (consider a memory-mapped capture
mechanism such as the Linux 2.4 mechanism, where all "non-blocking mode"
means is "don't do a 'select()' or 'poll()' if there aren't any new
packets in the memory-mapped buffer") or, in fact, that there are file
descriptor flags to affect (consider WinPcap).
2001-12-29 21:55:32 +00:00
guy a82f1618b8 Add APIs to put a "pcap_t" into or out of non-blocking mode, and to get
the current state of non-blocking mode; this allows us to implement, for
example, memory-mapped capture devices, where "pcap_read()" uses
"select()" or "poll()" to wait for packets to arrive, and hide that
implementation detail from applications using this API
("pcap_setnonblock()" would set or clear a non-blocking mode flag in the
"pcap_t", and the "select()" or "poll()" would not be done if the
"pcap_t" is in non-blocking mode).
2001-12-09 05:10:02 +00:00
guy c9452a7666 Clean up promiscuous mode, when using SOCK_PACKET, as best we can;
remember which pcap_t's were opened (with SOCK_PACKET) in promiscuous
mode on interfaces not already in promiscuous mode, turn promiscuous
mode off when closing such a pcap_t, and arrange that, when the program
exits, all pcap_t's of that sort not already closed have their
interfaces taken out of promiscuous mode.  (It's not sufficient to do
this on exit - applications may close a pcap_t without exiting, e.g.
Ethereal.)

This won't always work right (if somebody else requests promiscuous mode
after it's opened by libpcap, we'll turn promiscuous mode off when we
close the pcap_t, and if the program doesn't exit cleanly, it won't
clean up the interfaces), but neither of those problems are fixable -
the only way to get things to work correctly is to use PF_PACKET
sockets, which requires a 2.2 or later kernel.

On a 2.0[.x] kernel, when doing a "recvfrom()" on a SOCK_PACKET socket
to read a captured packet, don't pass a byte count value based on the
snapshot length - "recvfrom()" won't return the actual packet length if
you do that.  (2.2 and later kernels will return the actual packet
length if MSG_TRUNC is passed in.)
2000-12-16 10:43:26 +00:00
guy 82547471f7 When attaching a "bpf_program" to a "pcap_t" to use as a userland
filter, always attach a copy, as "pcap-linux.c" does; that way, after a
program uses "pcap_setfilter()", it can safely use "pcap_freecode()" to
free up the BPF instructions allocated by "pcap_compile()".  Also,
always free it up when the "pcap_t" is closed.

Get rid of the "pcap_t *" argument to "pcap_freecode()", as it's not
necessary.

Document "pcap_freecode()", for the benefit of programs that might
repeatedly compile filter programs and attach them, so that they can
free them up after attaching them and avoid leaking memory for them.
2000-10-28 00:01:26 +00:00
guy c900791477 The Linux "pcap_setfilter()" makes a copy of the filter it's handed, and
installs that copy; when closing a pcap_t on Linux, free that copy.
2000-10-25 06:59:09 +00:00
torsten 6bc711849d Stopped pcap_close from closing stdin. I don't see why somebody would
want to close that file apart from becoming a daemon. Thanks to
Don Talsma for pointing this out.
2000-08-13 10:33:14 +00:00
assar 0e2f8c8892 add config.h, remove gnuc.h. remove __dead 2000-07-11 00:37:04 +00:00
assar d514a1aa6f (pcap_open_dead): add function for just creating a pcap_t that be
later used when calling other functions.
From Darren Reed <darrenr@reed.wattle.id.au>
2000-06-26 04:58:04 +00:00
itojun 20d9e08cde do not use sprintf(). always use snprintf().
from NetBSD/OpenBSD src/lib/libpcap.

use freeifaddrs() if exists.
2000-04-27 09:11:11 +00:00
mcr b11ddf8a9b Initial revision 1999-10-07 23:46:40 +00:00