dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

47 Commits

Author SHA1 Message Date
Guy Harris 968888b3e0 The SUSv3 says ntoh* and hton* are declared in <arpa/inet.h> and, on
HP-UX 10.20, by default you have to include <arpa/inet.h> to get them
defined.
2009-07-07 11:42:22 -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 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 9ba070ab93 Fixed some VC6 compilation warnings (missing return clauses that are never
reached).
2007-09-27 17:58: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
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 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 13a838cb48 Check for IPv4 addreses used with "port", "portrange", "proto", or
"protochain".
2006-05-16 08:30:05 +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 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
guy f912cc399c From Gisle Vanem: there's no need to include <sys/time.h> in
"grammar.y", as "pcap.h" includes it.
2004-12-18 08:49:23 +00:00
guy 142bdc23c5 <strings.h> doesn't seem to be necessary on OS X, either, and, at least
from a look at the code, it's probably not necessary on any UN*X (and if
some header is needed, it should be the ANSI C <string.h>, not
<strings.h>).
2004-10-07 16:54:54 +00:00
risso 7fb5bd595f Added an #ifndef WIN32 around #include <strings.h> since this include file is
neither present nor necessary under MSVC6 (and cygwin).
2004-10-07 09:06:56 +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 9aa42d6e5c On Mac OS X 10.3, including <sys/socket.h> eventually drags in a header
file that defines MASK, so when compiling the lexical analyzer, if INET6
is defined you get a redefinition warning.  Use NETMASK rather than MASK
for the token "mask".
2003-12-16 05:19:56 +00:00
guy 30e89f192a Add _U_ to "rcsid[]" definitions, to eliminate "unused variable"
warnings from newer versions of GCC.
2003-11-15 23:23:57 +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 2a22d604c4 Make "lane" behave like "vlan", i.e. have it tweak the interpretation
of packet headers so that, in all expressions after it, the tests assume
LANE encapsulation of packets.  (We also assume the emulated LAN is an
Ethernet LAN, rather than a Token Ring LAN.)

Allow ATM tests to be combined with non-ATM tests in expressions, so
that you can do, for example, "lane and icmp".
2002-08-11 18:27:13 +00:00
guy 68634dadde Get rid of probably-unnecessary includes of <net/if.h>. 2002-08-05 07:59:43 +00:00
guy f66b87464f Put in a comment on an #endif, as the #else has one. 2002-08-02 05:11:13 +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
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
guy ca3fec5964 Fix a memory leak found by Miklos Szeredi
<Miklos.Szeredi@eth.ericsson.se> - "pcap_ether_aton()" allocates memory
for the MAC address, but we don't free it when we're done with it.

Code inspection revealed that there's a similar problem with
"pcap_ether_hostton()"; fix that as well.
2001-07-03 19:15:47 +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 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 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 6ef0c9a172 Add definitions of Ethernet types from
"linux-includes/netinet/if_ether.h" to "ethertype.h", and remove
includes of <netinet/if_ether.h> from files that only include it to get
ETHERTYPE_ values defined.
2000-09-23 07:26:27 +00:00
assar 0e2f8c8892 add config.h, remove gnuc.h. remove __dead 2000-07-11 00:37:04 +00:00
itojun 299da87b7d -Wall -Werror clean. 2000-06-03 16:29:42 +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