dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

1271 Commits

Author SHA1 Message Date
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
guy 8445a15c7c Add support for NetBSD DLT_PPP_SERIAL (PPP in HDLC-like framing, as per
RFC 1662, or Cisco point-to-point with HDLC framing, as per seciont
4.3.1 of RFC 1547; there's always an address and control octet at the
beginning of these packets, but they're not necessarily 0xff 0x03),
which we map to PCAP_ENCAP_PPP_HDLC.
2000-09-18 05:08:02 +00:00
guy 7e461ddcbe There's no longer a rule to make "force", so don't make "depend" depend
on "force".
2000-09-18 05:04:52 +00:00
guy 781fae3571 Introduce a set of PCAP_ENCAP_ codes to specify packet encapsulations.
For those PCAP_ENCAP_ codes corresponding to DLT_ codes that are
(believed to be) the same in all BSDs, the PCAP_ENCAP_ codes have the
same values as the corresponding DLT_ codes.

For those PCAP_ENCAP_ codes corresponding to DLT_ codes that were added
in libpcap 0.5 as "non-kernel" DLT_ codes, or had their values changed
in libpcap 0.5 in order to cope with the fact that those DLT_ codes
have different values in different systems, the PCAP_ENCAP_ codes have
the same values as the corresponding DLT_ codes.

We add some additional PCAP_ENCAP_ codes to handle IEEE 802.11 (which
currently has its link-layer information turned into an Ethernet header
by at least some of the BSDs, but John Hawkinson at MIT wants to add a
DLT_ value for 802.11 and pass up the full link-layer header) and the
Classical IP encapsulation for ATM on Linux (which isn't always the same
as DLT_ATM_RFC1483, from what I can tell, alas).

"pcap-bpf.c" maps DLT_ codes to PCAP_ENCAP_ codes, so as not to supply
to libpcap's callers any DLT_ codes other than the ones that have the
same values on all platforms; it supplies PCAP_ENCAP_ codes for all
others.

In libpcap's "bpf/net/bpf.h", we define the DLT_ values that aren't the
same on all platforms with the new values starting at 100 (to keep them
out of the way of the values various BSDs might assign to them), as we
did in 0.5, but do so only if they're not already defined; platforms
with <net/bpf.h> headers that come with the kernel (e.g., the BSDs)
should define them with the values that they have always had on that
platform, *not* with the values we used in 0.5.

(Code using this version of libpcap should check for the new PCAP_ENCAP_
codes; those are given the values that the corresponding DLT_ values had
in 0.5, so code that checks for them will handle 0.5 libpcap files
correctly even if the platform defines DLT_RAW, say, as something other
than 101.  If that code also checks for DLT_RAW - which means it can't
just use a switch statement, as DLT_RAW might be defined as 101 if the
platform doesn't itself define DLT_RAW with some other value - then it
will also handle old DLT_RAW captures, as long as they were made on the
same platform or on another platform that used the same value for
DLT_RAW.  It can't handle captures from a platform that uses that value
for another DLT_ code, but that's always been the case, and isn't easily
fixable.)

The intent here is to decouple the values that are returned by
"pcap_datalink()" and put into the header of tcpdump/libpcap save files
from the DLT_ values returned by BIOCGDLT in BSD kernels, allowing the
BSDs to assign values to DLT_ codes, in their kernels, as they choose,
without creating more incompatibilities between tcpdump/libpcap save
files from different platforms.
2000-09-17 04:04:36 +00:00
guy 74ab49bec1 Add comments telling people not to gratuitously change the capture file
format (file header or per-packet header format, or interpretation of
any of the fields in those headers) without getting a new magic number
from "tcpdump-workers@tcpdump.org", and to make sure that libpcap can
still read files with the existing magic numbers, not just files with
the new magic number and record formats.

(There have been at least three libpcap changes I know of that have
changed the header formats, or the interpretation of fields in those
headers, without changing the magic number.  I would like not to ever
have any other such changes happen ever again.)
2000-09-14 09:49:28 +00:00
itojun 549c0b2c89 repair argument mismatch to malloc().
From: Uwe Girlich <Uwe.Girlich@philosys.de>
To: Ethereal Development List <ethereal-dev@zing.org>
Subject: [ethereal-dev] libpcap
2000-09-06 07:40:03 +00:00
fenner 9700d14e7b Regenerate. 2000-08-16 20:30:46 +00:00
fenner af62365a17 Add a check for lame lex and fail with an error message recommending flex. 2000-08-16 20:28:52 +00:00
torsten d8d8ac33c8 Changed the indention of pcap-linux.c to match with the other source
files of libpcap.
2000-08-13 21:25:26 +00:00
torsten 6bc711849d Stopped pcap_close from closing stdin. I don't see why somebody would
want to close that file apart from becoming a daemon. Thanks to
Don Talsma for pointing this out.
2000-08-13 10:33:14 +00:00
guy 5c220490cb Change the message issued on HP-UX if we can't find the PPA for a
network device, so that

	1) you can infer from the message whether the program is using
	   the old version of the code to get the PPA (which didn't work
	   all that well) or the newer version, without having to prod a
	   user complaining about tcpdump/Ethereal/whatever not working
	   to tell you which version of libpcap they're using;

	2) programs can perhaps check the error message returned by
	   libpcap and, if it's the old error message, tell the user
	   that the problem may be that they're using an old libpcap.
2000-08-13 06:56:05 +00:00
torsten 64c7184aa6 Fixed the BPF compiler for Linux. The BPF code used to truncate the
packets after the snaplen. On Linux this hinders us from inquiring
the original packet size so I removed that feature for Linux builds.
2000-08-06 01:22:39 +00:00
torsten c2c579d32b Updated the comment on the MSG_TRUNC problem in connection with the Linux
packet filter. Work around to come.
2000-08-04 18:35:48 +00:00
assar 407e3aaf67 regenerated from configure.in 2000-07-30 10:50:22 +00:00
assar c972305a1f bring a little bit more uptodate 2000-07-30 06:01:22 +00:00
assar e5db17becd use common names for directories
use INSTALL_PROGRAM/INSTALL_DATA
2000-07-30 05:56:49 +00:00
guy ef67d43d46 Change my address to my mail-forwarding address; "any problem in
computer science can be solved by adding a layer of indirection".
2000-07-30 05:28:24 +00:00
guy 763e372b7e Fix the names in the entries in the credits for Alexey Kuznetsov and
Fulvio Risso.
2000-07-30 05:20:13 +00:00
assar ccd074109a try fetch names from CVS logs and adding here 2000-07-29 10:16:08 +00:00
assar 6dc5bf2601 replace bzero with memset 2000-07-29 08:03:56 +00:00