dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

37 Commits

Author SHA1 Message Date
Guy Harris cc7b2f2e42 Add support for "wlan ra" and "wlan ta".
The RA field is absent from management frames (addr1 is DA there), and
addr1 in other frames.

The TA field is absent from management frames (addr2 is SA there), and
addr2, if present, in other frames.

While we're at it, fix a font glitch in the pcap-filter man page.
2010-07-03 13:15:01 -07: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 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 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 7fb15ab846 Add "pppoed" and "pppoes" keywords, for PPPoE Discovery and Session
packets (based on the Ethernet type).  "pppoes" has the side-effect that
subsequent filter expressions will test the PPP header and headers
in the PPP payload, not the link-layer header and headers in the
link-layer payload.
2005-09-05 09:06:58 +00:00
guy a0a4852137 From Gilbert Hoyek <gil_hoyek@hotmail.com>: support for capturing SS7
traffic on Intel Septel cards, and for filtering on SS7 MTP3 fields.

Clean up indentation.
2005-06-20 21:27:07 +00:00
guy 875df1a937 Make "link[N:M]" refer to the 802.11 header for all 802.11 DLT_ values,
including those with fixed-length radio headers (it already refers to
the 802.11 header for radiotap).

Add a new "radio" keyword, to allow access to the radio header.  In
theory, something to allow testing for specific signal strengths, etc.
might be useful, but radiotap makes that difficult as the code can't
loop through the header looking for the signal strength field, the loop
has to be unrolled, and some of the other headers might not have
standardized the meaning of some of the fields, so we require the user
to construct such a filter themselves, for now.
2005-05-02 21:13:08 +00:00
guy 6804103187 Make the value argument to "gen_ncmp()" a bpf_int32, the same as the
value arguments are to other routines.  Do the same with the value
argument to "gen_atmfield_code()".

"gen_load_a()" can return more than one statement; append to the list of
statements it returns with "sappend()", rather than manually appending
to the first statement.

Fix the argument list to one "gen_ncmp()" call, and get rid of the casts
in the other calls, as the arguments already have the right types.

Fix the casts in calls to "gen_atmfield_code()".
2005-05-01 08:37:04 +00:00
guy 022b629ab1 From Albert Chin: just define __attribute__ as an empty macro if we
don't have __attribute__ support in the compiler.

While we're at it, get rid of the declaration of bpf_error() in
gencode.c, as it's already declared in gencode.h.
2005-04-23 22:26:51 +00:00
guy 97a8e5112d From Patrick Marie <mycroft@virgaria.org>: add support for port ranges
in tests - "portrange X-Y" matches all ports in the range [X,Y].

Support added for port ranges with IPv6.

Fix some comments.
2005-04-19 04:25:00 +00:00
hannes 405ab1a931 add baseline support for MPLS protocol and per-label filtering 2004-06-16 08:20:28 +00:00
fenner 8177eec7d9 Handle the new OpenBSD pf format (DLT 117), which is now being used
by other systems as they adopt pf.
Don't bother trying to be backwards compatible with DLT 17.
2004-03-28 20:27:12 +00:00
guy 2e69dd906a The value pointed to by "gen_pf_ifname()"'s argument isn't modified, so
make it a const pointer.

Cast the interface name in the "gen_bcmp()" call in "gen_pf_ifname()" to
squelch a compiler warning.
2003-05-02 08:37:43 +00:00
guy 23d8b7205b Add support for OpenBSD DLT_PFLOG.
Get rid of bogus newline in BPF error string.
2003-03-11 06:23:52 +00:00
hannes bd4881668c add BPF_ filters for misc. IS-IS PDU Types 2002-12-06 00:01:33 +00:00
guy 243b20ec55 Add SunATM support, based on code from Yen Yen Lim at North Dakota State
University.
2002-07-11 09:06:30 +00:00
itojun 5918c491c1 whitespace cleanup 2002-06-11 17:04:44 +00:00
fenner 283da6d726 SCTP support from Armando L. Caro Jr. <acaro@mail.eecis.udel.edu> 2001-05-10 14:48:01 +00:00
guy 38b97b7e84 ARCNet support, from NetBSD. 2001-04-17 08:25:21 +00:00
guy cae3c555e6 Patch from NetBSD, by Klaus Klein <kleink@netbsd.org>, to support "vrrp"
as an IP protocol, like "udp", "tcp", "icmp", "pim", etc..
2001-02-21 09:33:03 +00:00
guy b0dcde29f7 Add a "netbeui" keyword, which selects NetBEUI packets (LLC packets with
0xf0 as the DSAP and SSAP).

Let "ipx" work on non-Ethernet 802.2 frames - we assume they're always
frames with the IPX DSAP.
2001-01-28 09:44:48 +00:00
guy d17596dbd9 Add "ipx", which checks for the LLC SAP for IPX as well as, on Ethernet,
for "Novell 802.3" frames, which are 802.3 frames (i.e., the type/length
field is a length field, i.e. it's <= ETHERMTU) with 0xFFFF as the first
2 bytes.  We don't yet check for ETHERTYPE_IPX as well.

When checking for OSI packets on Linux cooked captures, check for 802.2
frames by testing the packet type for LINUX_SLL_P_802_2 rather than by
checking whether the type field is <= ETHERMTU (it's always a type field
in DLT_LINUX_SLL captures).
2001-01-14 07:57:47 +00:00
guy 2b3dac284e Support checking for protocols specified by an LLC SAP on FDDI, Token
Ring, and RFC 1483-style ATM, as well as on Ethernet.

Support checking for LLC SAP protocols other than OSI protocols on
Ethernet - for now, we check only the DSAP on those, rather than
checking both the DSAP and SSAP as we do for OSI, as I think, in some
cases, the SSAP isn't the same as the DSAP.

When generating protocol type checks on link-layer types with no type
field, where packets are always IP (SLIP, BSD/OS SLIP, raw IP), generate
a "test" that always succeeds if the protocol being checked for is IP or
IPv6 and a "test" that always fails otherwise.  (We originally did
"gen_true()" if the protocol is IP, and bogusly generated code to check
the field at an offset of -1 otherwise; a subsequent change caused us
always to do "gen_true()", but that doesn't properly handle attempts to
check for other protocols - those attempts should generate code that
always fails, meaning that if you try to look for ARP packets in such a
capture the BPF compiler will return "expression rejects all packets" as
an error - and still generated extra code not all of which was removed
by the optimizer.  The current code generates no *more* BPF code.)

Add "stp", which checks for the LLC SAP for the Spanning Tree Protocol.
2001-01-14 04:34:51 +00:00
guy ad7e091f5d Declare "install_bpf_program()" in "pcap-int.h", not "gencode.h"; it has
nothing to do with generating code, and "gencode.h" isn't included by
all "pcap-XXX.c" modules, whilst "pcap-int.h" is.
2000-11-04 10:09:55 +00:00
guy 195ad572d1 Allow "clnp", as well as "esis" and "isis", as OSI protocols for which
we can check.
2000-10-28 10:18:39 +00:00
guy af30d75a3e Tony Li's changes, from FreeBSD, to support filtering for OSI packets
and for ESIS and ISIS packets.
2000-10-28 09:30:20 +00:00
guy 54b2ab13c2 Patch from Monroe Williams <monroe@pobox.com>, submitted with NetBSD PR
#5228, to correctly check for Appletalk for EtherTalk phase II - they
use 802.3 with LLC SNAP packets, rather than D/I/X Ethernet packets.

His patch made "atalk" check for Appletalk ARP as well as other
Appletalk packets; I've instead added a separate "aarp" packet type,
leaving "atalk" checking only for ETHERTYPE_ATALK, so you can check for
ETHERTYPE_ATALK, ETHERTYPE_AARP, or both.
2000-10-28 08:19:29 +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 98a503e843 Improved VLAN support, from Peter Jeremy - "vlan" filtering keyword,
letting you filter based on the VLAN to which a packet belongs, and an
improvement to the printing of VLAN packets (adding an extra space to
separate the VLAN priority and flags from the next stuff printed).
2000-10-22 04:15:55 +00:00
guy 0d0297bdd1 Older versions of Flex (e.g., 2.5.2, which at least one user had) dump
core if the YY_FLUSH_BUFFER macro is called when there's no current
buffer (e.g., before any scanning has been done).

So, instead, when using Flex, we use "yy_scan_string()" to specify that
the scanner should read from the filter expression string, rather than
defining our own YY_INPUT macro, and we add a "lex_cleanup()" routine,
called after parsing is complete, to delete the buffer allocated by
"yy_scan_string()", which arranges that, when we next hand the scanner a
string, it doesn't then return to the parser cruft left over from the
previous parse.
2000-07-13 06:51:56 +00:00
assar 0e2f8c8892 add config.h, remove gnuc.h. remove __dead 2000-07-11 00:37:04 +00:00
assar ae9e9d40b5 remove non-STDC code 2000-07-01 03:33:48 +00:00
assar 417d093c9c (bpf_error): conditionalize __attribute__ 2000-04-01 12:27:28 +00:00
itojun 7fe3c1111a IPv6 packet filtering code.
./configure --enable-ipv6 (requires getaddrinfo(3) and getnameinfo(3)).

TODO: make it work even without getaddrinfo(3) or getnameinfo(3)
(or, tcpdump/configure.in should provide alternative version by
AC_REPLACE_FUNCS)
TODO: make IPv6 filtering code work by default
TODO: make "protochain" friendly with optimization
1999-10-19 15:18:28 +00:00
mcr b11ddf8a9b Initial revision 1999-10-07 23:46:40 +00:00