dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

1440 Commits

Author SHA1 Message Date
itojun 20784fd22c netbsd 1.5 -> 1.6
Fix a hairy optimizer bug that causes the expression:
'ip and ((icmp and dst host 1.1.1.1 and not host 2.2.2.2) or (host 1.1.1.1 and src host 3.3.3.3))'
to compile incorrectly.  Details about to be mailed to LBL.
2000-11-19 13:37:20 +00:00
guy ef0a3b3d38 Add a DLT_IEEE802_11 for use by any platform that provides raw 802.11
link-layer headers on capture.  (Nothing uses it yet, but hopefully this
will make it less likely that they'll use different DLT_ names or
values.)
2000-11-15 05:36:48 +00:00
guy e9c32982c8 Oops! I gave LINKTYPE_PPP_HDLC the same value as LINKTYPE_FR, which is
Not Good.  Give LINKTYPE_PPP_HDLC 113 instead, as nothing else uses it.
2000-11-15 05:31:05 +00:00
itojun 142ff8d0c7 correct "protochain" processing. 2000-11-09 06:20:05 +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 525b970802 Patch from Arkadiusz Miskiewicz <misiek@pld.org.pl> to handle ARPHRD_SIT
(IPv6-inside-IPv4 tunnel).
2000-11-04 07:19:22 +00:00
guy 7d16400ec5 When reporting an unknown data link type, print it in decimal, not hex,
as DLT_ values are defined with decimal values in "net/bpf.h".

Cast the last argument to "gen_cmp()" to "bpf_int32", not "long", as
it's a "bpf_int32".
2000-10-30 06:06:53 +00:00
guy daef269870 Add a #define for the LSAP value for SNAP. 2000-10-29 05:53:21 +00:00
guy 00357a902a Handle "iso" as a PPP link-layer type. 2000-10-28 10:28:15 +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 f4cbadac41 Allow "iso proto esis" and "iso proto isis" (as the FreeBSD man page
claims are allowed, even though the FreeBSD tcpdump doesn't support
them).
2000-10-28 10:05:46 +00:00
guy be6af9e0ad Catch attempts to filter on ISO hosts (we don't support that) and to
apply "esis" or "isis" to host names.
2000-10-28 09:43:56 +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 14972aa99d Handle for DLT_PPP all the protocol types we handle for DLT_PPP_BSDOS. 2000-10-28 09:06:06 +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 8c16ead778 Fix from Jefferson Ogata <jogata@nodc.noaa.gov> - "count_stmts()" wasn't
counting any extra jumps required by a flowgraph node (the conditional
jump instructions have an 8-bit offset; if the target is more than 256
instructions away, we generate a nearby "jump always" to the target, and
jump to that instead).
2000-10-28 01:22:52 +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 188fee53cc If we're receiving packets from a PF_PACKET socket, check whether the
interface index of the interface for the packet is the interface index
of the loopback interface and, if it is, check if the packet is an
outgoing packet; if so, ignore it, as we'll also be seeing that packet
as a received packet.

If we don't handle the arphrd type of an interface, and fall back on
cooked mode, report the arphrd type, so we know what type we should
consider supporting (if that type can't be supported well, e.g.  if you
don't get any link-layer header, as happens with PPP, we'd be silent).
2000-10-25 07:46:49 +00:00
guy 5c4a950507 Clean up the lexical analyzer if we return normally from
"pcap_compile()", not just if we return with an error, so that we don't
leak memory by allocating a Flex buffer for the expression to be parsed
but not freeing it.
2000-10-25 07:28:22 +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
guy fd8a7488b1 If we're reading from a savefile, don't try to install a kernel packet
filter.

It appears that "recvfrom()", in 2.2 and later kernels, doesn't check
whether the starting buffer address plus the byte count goes into an
unmapped region of the address space - it (or code it calls) presumably
only checks the locations into which it's actually copying data - so
there doesn't appear to be, on systems with 2.2 and later kernels, any
need to ensure that the buffer size is at least large as the snapshot
length.  We therefore only do so if we're using the old
PF_INET/SOCK_PACKET mechanism; if we're using PF_PACKET, we're on a
2.2 or later kernel, so we don't do it there.
2000-10-25 05:59:04 +00:00
fenner 72f94b6459 Eliminate __P(). 2000-10-23 19:32:20 +00:00
guy 4bff247486 Oh, well, maybe *next* time I'll remember that the names are in
alphabetical order by first then last name.
2000-10-22 04:18:44 +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 6251821734 Document that a null pointer or "any", when specified as the "device"
argument to "pcap_open_live()", will, on Linux systems with a 2.2 or
later kernel, snoop on all interfaces.
2000-10-22 02:21:34 +00:00
guy b4bfe1ee30 Add "lbl/os-osf4.h" to declare "snprintf()" and "vsnprintf()", to
squelch some compiler warnings.
2000-10-21 05:04:18 +00:00
guy be7f1ec5ad We should no longer need to use our own versions of system header files
when compiling on Linux, as we extracted from those copies the
definitions and declarations we need in order to dissect packets, and
put them into our own header files in the regular source directory.
2000-10-21 04:50:43 +00:00
guy edcaeb1db4 Don't declare "iface_get_id()" or "iface_bind()" if
"HAVE_NETPACKET_PACKET_H" isn't defined, as we won't define them if it's
not defined.

If the packet buffer size, as computed from the MTU of the interface, is
less than the user's requested snapshot length, set it to the user's
requested snapshot length; otherwise, the "recvfrom()" call will fail,
as the length specified in the call is the user's requested snapshot
length, and the kernel checks whether the buffer is big enough for that
much data and rejects the "recvfrom()" call if it's not.
2000-10-20 06:55:28 +00:00
torsten c7823f5045 pcap_read: Back out the last change. Now EINTR is handled as timeout
reached so that pcap-based applications can use alarm timers
	   to interrupt the pcap loop.
2000-10-18 23:51:48 +00:00
torsten 0ae7f68987 pcap_read: Check the error code of select against EINTR. Reported by
Sebastian.
2000-10-18 23:47:41 +00:00
guy 9cd2d87ddd Oops, I missed one PCAP_ENCAP_ value; revert it to the equivalent DLT_
value.
2000-10-18 08:32:55 +00:00
guy 3a5713e4fc In addition to telling people not to change the format of the savefile
header without getting a new magic number from us, tell them not to
change the interpretation of any fields in the header without getting a
new magic number from us.
2000-10-12 04:16:52 +00:00
guy 88541c9adf Get rid of the PCAP_ENCAP_ values - if an application uses them, that
application won't build with any other version of libpcap, which means
that a lot of applications won't use them.  In addition,
"pcap_linktype()" needs to return DLT_ values, so that platforms that
build libpcap as a shared library won't break binary compatibility if
they update to this version of libpcap.

Instead, we map from DLT_ values to LINKTYPE_ values when writing
savefiles, and map from LINKTYPE_ values to DLT_ values when reading
savefiles, so that savefiles don't have platform-dependent DLT_ values
in the header as the link type, they have platform-independent LINKTYPE_
values.

This means we don't need to make DLT_ATM_RFC1483, DLT_RAW, etc. have
platform-independent values starting at 100 - only the values in the
savefile header need to be like that.
2000-10-12 04:12:27 +00:00
guy 2c961ff224 Get rid of the PCAP_ENCAP_ values - if an application uses them, that
application won't build with any other version of libpcap, which means
that a lot of applications won't use them.  In addition,
"pcap_linktype()" needs to return DLT_ values, so that platforms that
build libpcap as a shared library won't break binary compatibility if
they update to this version of libpcap.

Instead, we map from DLT_ values to LINKTYPE_ values when writing
savefiles, and map from LINKTYPE_ values to DLT_ values when reading
savefiles, so that savefiles don't have platform-dependent DLT_ values
in the header as the link type, they have platform-independent LINKTYPE_
values.

This means we don't need to make DLT_ATM_RFC1483, DLT_RAW, etc. have
platform-independent values starting at 100 - only the values in the
savefile header need to be like that.
2000-10-12 03:53:57 +00:00
guy f7179f8b0d Remove from "lbl/os-solaris2.h" declarations of functions we don't use;
the declaration of "utimes()" collides with the declaration that SunOS
5.5.1 and later, at least, *do* have.  (5.5.1 doesn't declare
"snprintf()", even though it has "snprintf()", so we declare it here; we
declare some others that don't cause problems.)
2000-10-11 04:02:52 +00:00
guy bcb41391ec Eliminate a warning with some compilers. 2000-10-10 04:53:54 +00:00
guy fd7f1bf605 Include <string.h> to declare various string-manipulating routines. 2000-10-10 04:53:08 +00:00
guy b8be30ba60 Include the license file as one of the files in the tarball. 2000-10-10 04:51:18 +00:00
mcr 8c9d56c5d4 added license file 2000-10-09 22:38:56 +00:00
guy 79e2793fb3 Make "gen_protochain()", as it's not used outside "gencode.c", and
declare it before it's defined.
2000-10-06 04:52:53 +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
torsten 45b3cb247a Added support for an "any" device based on a patch from Sebastian Krahmer. 2000-09-20 15:10:28 +00:00
guy da539dbb00 Give it an SCCS ID and an RCS ID. 2000-09-20 07:52:04 +00:00
guy 6e4c95091d When making directories into which to install files in "make install",
change the directory mode to 755 after making the directory, so that the
directory is publicly readable and searchable even if the user doing the
"make install" has a umask that takes away public read and search
permissions.  (I think that's been a problem at least once - somebody
had trouble configuring and building Ethereal, probably because
"/usr/local/include/net" wasn't publicly readable and searchable, and my
suspicion is that somebody did "make install-incl" or "make install" of
libpcap when their umask was 027.)

Fix the check for directory existence done before making
"$(DESTDIR)$(includedir)" and "$(DESTDIR)$(includedir)/net" to check for
the existence of those directories, not for the existence of
"$(DESTDIR)$(libdir)".
2000-09-19 14:52:41 +00:00
guy d1713b06bb The current "config.guess" may give different Alpha processors different
names, e.g. "alphaev56", rather than just "alpha", so, in
"AC_LBL_UNALIGNED_ACCESS", we should check for "alpha*", rather than
"alpha", in our test for platforms we *know* shouldn't do unaligned
accesses (Digital^H^H^H^H^H^H^HTru64 UNIX, by default, may just catch
the alignment trap, complain on the console, and then simulate the
unaligned access, but that's slow - and, in one test, didn't appear to
prevent all the faults from unaligned accesses).
2000-09-19 03:56:26 +00:00
guy 7e4d6babb8 Not all systems running on Alpha processors add 3 bytes of padding to
FDDI headers to align the payload on a 4-byte boundary; for example,
Linux/Alpha doesn't appear to do so, which causes filter expressions not
to work correctly on FDDI on Linux/Alpha.

The "__alpha" test was really intended to check for DEC
OSF/1^H^H^H^H^H^H^H^H^HDigital UNIX^H^H^H^H^H^H^H^H^H^H^H^H Tru64 UNIX,
so test "__osf__" instead.
2000-09-19 03:28:10 +00:00
torsten a744b40d5e Added a TODO file with some stuff that needs to be done IMHO (putting
on the asbestos suit). As we don't have a bug tracking system or
task manager we need some way to record a list of tasks. I think this
is the easiest way. Discussion on -workers please.
2000-09-18 19:33:07 +00:00
torsten 808b77b191 Fixed my mail address. The GMX address might go away. For open source
stuff I prefer using the debian.org address.
2000-09-18 18:47:46 +00:00
guy 8439f66a3f In "init_linktype()", map DLT_ codes that don't have the same value as
the equivalent PCAP_ENCAP_ codes to the corresponding PCAP_ENCAP_ code
so that the code generator need check only the PCAP_ENCAP_ codes.

Handle PCAP_ENCAP_PPP_HDLC just like PCAP_ENCAP_PPP.
2000-09-18 06:39:44 +00:00
guy e7e53064df Don't map DLT_LOOP to PCAP_ENCAP_NULL; it's handled differently from
DLT_NULL in OpenBSD's libpcap, and I'm not sure what the right way to
handle it is yet - for now, this lets the OpenBSD folk merge their
DLT_LOOP support in if, as, and when they pick up the next version of
libpcap.
2000-09-18 06:38:08 +00:00