dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

1072 Commits

Author SHA1 Message Date
guy 56741e253c Get rid of trailing blanks and tabs. 2008-01-29 10:12:55 +00:00
guy 198bb69e6d Get rid of a no-longer-necessary #include (we no longer check
no_optimize - we check, instead, whether the kernel rejected the
program).

Move the initialization of the bpf_dltlist structure right before its
first use.
2008-01-29 10:00:32 +00:00
guy c0b1d4703d map_packet_type_to_sll_type() isn't used - and won't compile - if you
don't have PF_PACKET support; #ifdef it out.

Move the code to compute the buffer size into live_open_new() and
live_open_old(), as it's dependent on the mechanism being used; there's
little code shared between the two variants.
2008-01-24 20:20:08 +00:00
guy 9f8edc61fa Move the late Jun-ichiro itojun Hagino to a "Past maintainers" section. 2008-01-07 00:09:54 +00:00
guy b7f2a2ee77 Fix a typo; this fixes bug 1854436. 2008-01-06 21:25:54 +00:00
guy c558b285f5 From Joerg Mayer: add a new man page for the filter syntax, copied from
the tcpdump manual page, so that documentation for other applications
using libpcap can refer to it.

Update pcap(3) to refer to it - and not to suggest sending patches to
patches@tcpdump.org, which is a spam magnet that's no longer read by
anybody.
2008-01-06 21:14:16 +00:00
guy f57d847d09 The SITA code in pcap-linux.c shares very little with the Linux code;
move it into pcap-sita.c, and make --with-sita set the pcap type to
"sita", so we build pcap-sita.c instead of, rather than in addition to,
pcap-linux.c.

Use "bpf_u_int32" rather than "ulong" in the SITA code, as it's intended
to be 32 bits long (the "l" in "htonl()" and "ntohl()" is historical -
they work on 32-bit quantities, and the "l" dates back to the days when
32-bit processors were a bit newer and 16-bit Unix was more common).

Those changes also, at least in theory, makes the SITA support work on
other Unix-compatible platforms; note that in README.sita.

Clean up pcap-sita.c, making routines no longer called outside it
static, folding trivial wrappers, and fixing various warnings.

Put the routines used by fad-sita.c and defined by pcap-sita.c into
pcap-sita.h.  Remove from pcap-sita.h the files that are now static to
pcap-sita.c.  Include pcap-sita.h in both fad-sita.c and pcap-sita.c, so
that we do cross-file prototype checking.
2008-01-06 20:23:17 +00:00
guy 92c5d33d7a From Paolo Abeni: support for a memory-mapped capture buffer. 2008-01-05 22:32:31 +00:00
guy 0446821e49 Make some arguments const pointers if that makes sense.
Add some additional checks to bpf_validate(), from OpenBSD.

Use bpf_validate() in install_bpf_program(), so we validate programs
even when they're being processed by userland filters; we make
bpf_validate() not reject backward branches, as we use them for the
protochain operator.

For BPF, don't assume that, just because no_optimize was set, we have a
program that we can't hand to the kernel; the user of the application
might have specified no optimization (e.g., tcpdump with -O), or we
might have generated code to handle 802.11 headers (the optimizer can't
handle that code).  Instead, try handing the filter to the kernel and,
if that fails, try it in userland.

Get rid of BPF_MAXINSNS - we don't have a limit on program size in
libpcap.
2008-01-02 04:16:46 +00:00
guy 716cd1f4dd Now that we try to build libpcap with large file support, add a warning
to users of pcap_file() that the resulting FILE * might refer to a file
> 2GB and a suggestion that they use large-file-capable calls on it or
on the result of passing it to fileno() if at all possible.
2008-01-01 04:34:49 +00:00
guy a9b98caa0d Use AC_SYS_LARGEFILE and AC_FUNC_FSEEKO to try to get large file support. 2008-01-01 03:49:11 +00:00
guy b2e8e34e97 Add --nounput if Flex supports the --noFUNCTION options, as at least
some versions that support those options don't support disabling yyunput
by defining YY_NO_UNPUT.

If it doesn't support those options, don't check if it supports
generating reentrant scanners, as we can't add any --noFUNCTION options
to suppress generation of functions.
2007-12-31 03:38:39 +00:00
guy 9070702bd0 Check for u_int64_t and define it as "unsigned long long" if we don't
have it; we use it in the USB pseudo-header.
2007-12-31 03:00:47 +00:00
guy bef9d3afe0 Check for u_int64_t and define it as "unsigned long long" if we don't
have it; we use it in the USB pseudo-header.
2007-12-31 02:49:26 +00:00
guy c370aa3788 The first argument to runlex is now just the command to run, so we can
just compare it with "flex" to determine whether we're running Lex or
Flex.
2007-12-31 02:40:21 +00:00
guy a4e747119e No need to quote $(LEX) when passing it to runlex.sh; that way, it can
process all the arguments as such, and makes its first argument the name
of the command to run.
2007-12-31 02:34:30 +00:00
guy e854a5360f Pass a bunch of --noyyXXX options to suppress routines defined but not
used or declared (and thus suppress some warnings about functins with no
declaration before the definition).
2007-12-31 02:21:09 +00:00
guy cfada28fd7 Add a wrapper around Lex/Flex; that lets us handle Lex's lack of support
for -o and Flex's support for it in a way that lets us more easily fail
if Lex/Flex fails (so that we don't try to compile a bogus scanner.c
that might be generated; that appears to have happened on at least one
occasion, with the resulting scanner.o missing some functions, causing
weird errors in configure scripts for programs using libpcap), and also
prepares us to handle newer versions of Flex where we want Flex to
generate a header file so we don't get "defined but not declared"
warnings.
2007-12-30 00:28:17 +00:00
guy 25ab78f4f7 The Prism header is in theory variable-length, but in practice it's
always 144 bytes long.  However, some drivers on Linux use
ARPHRD_IEEE80211_PRISM, but sometimes or always supply an AVS header, so
we have to check whether the radio header is a Prism header or an AVS
header, so, in practice, it's variable-length.

Treat DLT_PRISM_HEADER as having a variable-length header, and generate
code to find the length of the Prism header that first checks for an AVS
header and, if we have an AVS header, gets the length from the header,
and otherwise just gets a length of 144.  This fixes Sourceforge bug
1847574.

Sort various references to the radio headers (case labels, functions,
etc.) into the same order (Prism, AVS, radiotap), for consistency.  Put
PPI after them all.

Handle 802.11 and 802.11-plus-radio-header with a common case when
initializing.
2007-12-29 23:15:04 +00:00
guy 85f4786ac2 The AVS radio header is variable-length, and fields were added to it
recently, so it's not only variable-length in theory, it's
variable-length in practice.  Treat it as such.
2007-12-29 02:34:23 +00:00
guy 41995a4191 DLT_ value for IPMB with a Linux-specific pseudo-header,a s requested by
Alexey Neyman.

Add LINKTYPE_ values corresponding to the DLT_ values added earlier.
2007-12-23 04:40:45 +00:00
guy 2fcbb1f5a2 Some more link-layer types, as requested by Will Barker
<w.barker@zen.co.uk>.
2007-12-22 01:19:12 +00:00
guy 1952d35b37 Handle the case where mmap()ped access to the USB buffer is used;
hopefully I'm inferring correctly from the mon_bin_poll() routine that,
even with purely-mmapped access, you can use select() or poll() to wait
for packets to arrive.
2007-12-14 08:02:40 +00:00
guy 25ccbe6e86 Don't use handle->fd before you've set it. 2007-12-14 07:52:32 +00:00
guy 82fa7a2f43 From Paolo Abeni: fix some comments. 2007-12-13 17:28:38 +00:00
guy 91326ea08c Don't assume that p->fcode.bpf_insns remains unchanged while processing
a bufferfull of packets - it could get changed in a callback routine.
2007-12-05 23:37:26 +00:00
guy baa8f1a126 From Kris Katterjohn, with some additional changes from Paolo Abeni: fix
some sscanf() calls:

	The first change involves a sscanf() that has '%n' in the format
	string, which shouldn't be checked for in the return value
	(stored in "ntok").  This is done correctly elsewhere in the code
	(and even commented on) such that the return value is checked for
	everything but the %n modifier.

	And a few lines after this, a sscanf() is done for '%d' and the
	return value is stored in "ret".  However, the same exact line
	from the above mishap is used here, not even checking the right
	variable or number of conversions! It checks "ntok" for 2 when
	it should check "ret" for 1.
2007-11-30 19:53:06 +00:00
guy 8f6e068349 From Gregor Maier: pcap_open_dead() doesn't take an errbuf argument (the
only reason why it would fail would be if a malloc fails), so don't list
it as one of the functions that does.
2007-11-29 18:27:27 +00:00
gianluca 8ab2187e50 Fixed a bug when generating wireless filters in the form "link src host ...". The
source address was not retrieved properly.
2007-11-26 21:17:49 +00:00
guy 5bf51391d4 From Kris Katterjohn: when building a SITA version of libpcap, don't
include dead code.
2007-11-18 04:37:27 +00:00
guy 740fb4355d Support OpenBSD's "addr1", "addr2", "addr3", and "addr4" link-layer
address types for 802.11.

Support the OpenBSD names for some of the 802.11 frame types.

Support OpenBSD's "dir" keyword for 802.11 frame directions.
2007-11-18 02:03:52 +00:00
guy 70727eb8d2 Add some additional PF actions, from OpenBSD - but do so only if they're
defined on the platform on which we're compiling.
2007-11-14 00:54:35 +00:00
gianluca 18f99473ee Under MingW/cygwin, we need to use ddk/ndis.h instead of ntddndis.h. 2007-11-13 21:55:51 +00:00
guy 4148e8dfdc Update a comment. 2007-11-10 21:53:05 +00:00
guy da54d62ffd From Stephen Donnelly:
Changing the behaviour when the ERF type is unknown, and for ERF
	TYPE_PAD.

	Unknown ERF types can always be captured as DLT_ERF.  TYPE_PAD
	records are dropped silently.
2007-11-09 00:55:53 +00:00
guy efde9ae2b8 Handle the padding stuck in between the 802.11 header and the 802.11
payload by Atheros cards; check the radiotap header to see whether that
padding is there.
2007-11-08 01:50:26 +00:00
guy 7f5c751098 Do the DLT_PPI per-packet DLT check before computing any of the
variable-length offsets.

Update some routine names and comments.
2007-11-07 19:32:34 +00:00
guy a0f3381871 When we add the length of the QoS field to the offset of the MAC
payload, the existing value of that offset is *not* in the X register -
the offset of the MAC header is in the X register.  Load the register
containing the offset of the MAC payload, add 2 to it, and store the
result back in that register.
2007-11-06 19:09:10 +00:00
gianluca c9c0634709 [from Gisle Vanem]
Fixed a typo in pcap_setmintocopy().
2007-11-06 16:20:53 +00:00
guy 309c0ad349 Fix handling of ATM LANE for DLT_SUNATM. 2007-11-05 23:02:54 +00:00
guy 489f459bb8 Based on changes from Gianluca Varenni, partially handle variable-length
802.11 headers - we only handle the QoS bit and fields, for now.

Clean up various other things either in the process of doing that or as
a requirement for doing that.
2007-11-05 21:52:14 +00:00
guy 24bc44b0f2 From Stephen Donnelly:
support ERF extension headers;

	collect the ifdefs for different ERF types into a header
	to improve readability;

	add in a couple of new types.
2007-11-05 21:45:07 +00:00
guy f93ade7fde Don't crash if somebody tries link-layer type filtering on various
link-layer types.
2007-11-05 18:37:48 +00:00
guy 0276d343cb Fix the handling of IPX in VLAN encapsulation so that the SNAP header is
tested after all the VLAN headers, rather than after the initial MAC
header.
2007-11-04 22:29:02 +00:00
guy 762a5cc8a6 Fix the handling of AppleTalk in VLAN encapsulation (not that you're
likely to see that, but...) so that the SNAP header is tested after all
the VLAN headers, rather than after the initial MAC header.
2007-11-04 22:15:48 +00:00
guy 877d5fc4eb From Stephen Donnelly:
Clean up the configure output for the dag libraries a bit.

	Add Florent Drouin's changes for DLT_ERF.

	Some other DAG changes.
2007-10-30 10:16:45 +00:00
guy 149057f024 Re-initialize the table of used registers, and the current register,
before compiling an expression; pcap_compile() can be called more than
once, and some registers can now be allocated and not freed in the
process of code generation (for example, the register allocated to hold
the length of a radiotap header, which can't be freed until we're
finished generating all the code).
2007-10-26 00:44:56 +00:00
guy 69fd6e08ab Use VCI_ as a prefix for all the VCI values, rather than just prefixing
PPC with ATM_.
2007-10-22 19:28:58 +00:00
guy fc6fdb7bee Add DLT_LAPD, for raw LAPD with no pseudo-header, as per Varuna De
Silva.
2007-10-21 08:39:27 +00:00
guy bb9a52d915 SITA ACN support, from Fulko Hew. 2007-10-20 01:15:14 +00:00