dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

217 Commits

Author SHA1 Message Date
Guy Harris 664e4a16bb From Robert Edmonds: in the lexical analyzer, free up any addrinfo
structure we got back from getaddrinfo().

Plug some other getaddrinfo() leaks while we're at it.

Fail if you try to use "gateway" on ATM if we're not checking for ATM
LANE.
2009-04-18 13:53:52 -07:00
guy b908482137 Update CHANGES for USB fixes.
Update CREDITS to give Jon Smirl credit for some of the USB fixes.

Rename DLT_USB_LINUX_MMAP to DLT_USB_LINUX_MMAPPED, and declare a
structure for the header of packets in DLT_USB_LINUX_MMAPPED captures.
2008-12-23 20:13:29 +00:00
guy 87d0db882e From Jon Smirl:
try scanning the sysfs USB directory first and, if that
	directory doesn't exist, try the procfs USB directory, to handle
	newer kernels where the relevant director is in sysfs;

	use the data length, not the URB length, as the amount of data
	in the packet (the URB length is the amount of space *available*
	for the data, not the actual amount of data).

For the memory-mapped interface, include the padding after the URB and
setup header in the packet lengths, and return a different link-layer
type so that code reading the packets knows that padding is there.
2008-12-23 18:03:22 +00:00
guy 8a49a4d47b New DLT_MPLS link-layer type, for MPLS packets with an MPLS label as the
link-layer header.
2008-12-21 19:28:56 +00:00
guy f4af9ed692 Link-layer type for 802.15.4 with PHY-level preamble, SFD, and frame
length, as requested by Max Filippov <jcmvbkbc@gmail.com>.
2008-09-22 20:14:19 +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
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 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 4148e8dfdc Update a comment. 2007-11-10 21:53:05 +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
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 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 9dc28aea3e Add DLT_AX25_KISS, for AX.25 with a KISS header, as per discussions in
the tcpdump-workers mailing list in early April, 2007.

Add Richard Stearn's support for DLT_AX25_KISS.
2007-10-05 01:40:14 +00:00
guy 7c16b1e9f1 Move a comment that applies to both branches of an #ifdef outside the
#ifdef.

Clean up white space a bit.
2007-10-05 01:03:53 +00:00
guy 29dc375264 Clean up indentation. 2007-09-29 00:48:05 +00:00
guy fe7433245e New DLT for Bluetooth H:4 with pseudo-header giving direction.
Add support for additional link types to gencode.c, so we at least
support "link[N:M]" and an empty expression.

Sort the DLT_CHOICE values in order by the DLT_ value, add missing ones,
and fix some existing descriptions.
2007-09-19 02:40:34 +00:00
guy b52473e046 From Max Laier: check whether the system has <net/pfvar.h> and:
if it does, use that for the pf definitions;

	if it doesn't, don't compile in pf support;

as both OpenBSD and FreeBSD have changed the pf definitions and header
format without changing the DLT value, so you can't reliably read
pflog-format libpcap files on a machine running an OS version other than
the one on which the file was generated.
2007-09-12 19:09:49 +00:00
hannes 18341fc1b5 allocate DLT_JUNIPER_ST as per request from Hannes Gredler <hannes@juniper.net> 2007-09-10 20:17:18 +00:00
guy 0fd3a1a661 From Stephen Donnelly of Endace:
This patch introduces support for the DAG ERF type
	TYPE_COLOR_MC_HDLC_POS.

	The patch also allows appropriate DAG cards (DAG 3.7T, DAG 7.1S)
	to optionally produce DLT_MTP2_WITH_PHDR (139) traces when
	capturing from channelised HDLC links, as an alternative to
	DLT_MTP2 (140).  When using the new DLT, the 'DAG channel' is
	recorded in the pcap record pseudo header as the 'link_number'.

	Basic BPF filtering support for DLT_MTP2_WITH_PHDR is also
	added.

Fix some warnings.
2007-06-22 06:32:06 +00:00
gianluca 92e7060fb8 Fixed the code that verifies if a PPI packet encapsulates 802.11 frames.
The bug was causing side effects even when the linktype was not PPI.
2007-06-14 20:55:44 +00:00
gianluca ec63ab312c Added more code in the compilation for the PPI linktype: now we generate
code that discards non-802.11 packets.
A couple of mods to remove some compilation warnings with VC6.
2007-06-14 18:49:30 +00:00
gianluca 9c308a3a48 Added some initial support for PPI filter generation. 2007-06-14 18:14:06 +00:00
guy a6186fa56d Pick up changes from NetBSD:
several files:

	date: 2006/02/27 15:53:24;  author: drochner;  state: Exp;
	avoid shadowing globals, for WARNS=2

	date: 2006/02/27 15:55:30;  author: drochner;  state: Exp;
	minor constification, good for WARNS=3 now

	date: 2006/02/27 15:57:17;  author: drochner;  state: Exp;
	NetBSD adaption:

		...

	-const pcap_strerror() for consistency


    gencode.c:

	date: 2006/04/26 09:24:33;  author: tron;  state: Exp;
	Add missing "const" keywords to match declarations in "pcap.h".

	date: 2006/10/15 19:27:21;  author: christos;  state: Exp;
	add a volatile variable to prevent vfork/longjmp clobbering.

    optimize.c:

	date: 2006/05/17 17:48:36;  author: drochner;  state: Exp;
	Make the optimizer use unsigned numbers as the kernel does.
	While it is not agreed on that purely unsigned arithmetics is nice,
	different behaviour of optimized and unoptimized code is less desirable.

    pcap-bpf.c:

	date: 2006/02/27 15:51:38;  author: drochner;  state: Exp;
	pull in from NetBSD's libpcap: use cloning bpf device on NetBSD

Have the configure script check for paths.h, so that we can include it
only if we have it, and use the cloning BPF device only if we're on
NetBSD *and* _PATH_BPF is defined (hopefully this will keep us from
using it on versions of NetBSD that don't have a cloning BPF device; if,
in the future, other OSes with BPF get cloning BPF devices, we can make
this work for them as well).
2007-06-11 10:04:24 +00:00
guy a8f23f719a Tests for the transport-layer protocol differ based on whether the
network-layer protocol is IPv4 or IPv6, regardless of the link-layer
protocol.  Therefore, we have to check for IPv4 and IPv6, even for
DLT_RAW - do so by checking the version field in the header.
2007-05-30 18:05:21 +00:00
hannes 666dd96733 add support for DLT_JUNIPER_ISM 2007-05-24 23:57:36 +00:00
guy 885670183d From Sepherosa Ziehau: additional filter operations for 802.11 frame
types.  Modified to add ieee80211.h from FreeBSD, rather than depending
on the OS supplying the header, and to support all 802.11 radio header
types.

Clean up some link-layer type checks and the messages for failing those
checks.
2007-03-11 04:35:23 +00:00
guy d02424cd4c From Florent Drouin: a Link Status Signal Unit is called an LSSU, not an
LSU.  (Leave "lsu" as an alias for backwards compatibility.)
2007-02-08 07:15:27 +00:00
guy 7589e0abc3 From Florent Drouin: add support for filtering on MTP2 frame types. 2006-12-21 19:44:06 +00:00
guy eda5020549 Handle DLT_USB_LINUX the same way we handle DLT_USB (i.e., punt and only
support link[N:M]).
2006-12-20 08:20:27 +00:00
guy 8c2a49b75c DLT_ value added for the Bluetooth HCI UART transport layer for Paolo
Abeni.

Added DLT/DLT name table mappings and linktype values and DLT/linktype
mappings for USB and for the Bluetooth NCI UART transport layer.

Fix up indentation.
2006-10-13 08:46:23 +00:00
guy 084bcf12ea Put the public libpcap headers into a pcap subdirectory in both the
source directory and the target include directory, and have include
files at the top-level directory to include those headers, for backwards
compatibility.

Update the FILES and INSTALL.txt files to reflect current reality.
2006-10-04 18:09:21 +00:00
guy e364899527 Handle DLT_USB. 2006-10-04 16:47:46 +00:00
guy 750519deb0 Add off_ll to off_nl in cases where that's required and that we missed
in earlier checkins, now that off_nl no longer includes off_ll.

Add in more comments explaining what we're doing.
2006-09-13 07:35:42 +00:00
guy c547cb1649 Make off_linktype, off_nl, and off_nl_nosnap *not* include off_ll.
Make gen_load_llrel() add in off_ll if there isn't a variable-length
radio header, so the offset passed to it is always relative to the
beginning of the link-layer header, not the beginning of the packet.
Don't add in off_ll when calling it.

Those changes centralize the addition of off_ll, so it's only done in
one place (rather than twice, where it was done before, meaning that the
offsets were wrong for the Prism and AVS headers as they had 2*off_ll
rather than just off_ll, as off_ll was added twice).
2006-09-13 06:54:15 +00:00
guy d91be5b8af C89 says that the result of shifting an N-bit value by >= N bits is
undefined; we want it to be zero, so we explicitly check for a 32-bit
shift count and clear the netmask in that case.
2006-05-28 20:12:28 +00:00
hannes b7d2f597d1 add support for DLT_JUNIPER_VP 2006-05-18 08:40:52 +00:00
hannes 8815467ef5 use gen_linktype() rather than a plain gen_cmp() for creating the link-layer specific match code for MPLS packets 2006-03-16 08:46:13 +00:00
hannes d52ccdfa66 OR_PACKET should match at the beginning of the packet and not at the beginning of the packet plus variable-length link-layer 2006-03-16 08:42:14 +00:00
hannes b1a31d31cc code cosmetics: clean up some if() chains and replace by switch() statements 2006-02-22 10:38:28 +00:00
hannes 525e3cbe8f code cosmetics: clean up some if() chains and replace by switch() statements 2006-02-22 10:22:04 +00:00
hannes 98a1d8cfbd add DLT/LINKTYPE for carrying FRF.16 Multi-link Frame Relay 2005-12-13 13:41:39 +00:00
guy 8e06df3e4c Make the "applied to" errors say "applied to net" if we're applying
bogus keywords to "net" rather than "host".
2005-11-17 04:49:34 +00:00