dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

505 Commits

Author SHA1 Message Date
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
guy d5c3be9ab6 FreeBSD also defines DLT_SLIP_BSDOS as 13 and DLT_PPP_BSDOS as 14, so we
define them that way on FreeBSD as well as NetBSD.
2003-03-08 09:21:37 +00:00
guy cb73be0549 Check for OpenBSD and, if we're building on OpenBSD, #define various
DLT_ values to have the same value they have in OpenBSD.
2003-03-08 09:13:39 +00:00
guy 786403c0a7 Add support for OpenBSD DLT_ENC - and map it to a value of 109, as its
value in OpenBSD, 13, is Yet Another DLT_ Value That Other OSes Use For
Their Own Purposes.
2003-03-08 08:42:13 +00:00
guy 78da480204 From clodder@acm.org, via OpenBSD: add checks for memory allocation
failure.
2003-03-08 08:26:31 +00:00
guy 8c2a3a235c From clodder@acm.org, via OpenBSD: add a check for memory allocation
failure.
2003-03-08 08:23:47 +00:00
guy 39c13cd5ee Boost some table sizes even more, as the HP-UX lex requires it. 2003-03-08 05:53:11 +00:00
guy a9c93b1828 From Motonori Shindo: version.h is a generated file, ignore it when
doing CVS operations.
2003-03-01 05:04:40 +00:00
fenner c5419d46c8 Only look up "tcp" and "udp" in pcap_nametoport(). This fixes the
case in e.g. FreeBSD where /etc/services lists port 4 for the ddp "echo"
 service.

Submitted by:	Alan Bawden <Alan@LCS.MIT.EDU>
2003-02-25 22:12:03 +00:00
fenner bb7cf360b1 Don't make the bpf buffer smaller than the default. 2003-02-25 21:58:48 +00:00
guy 164af2f0bf Alas, there are some versions of GNU libc that don't have "SA_LEN()"; at
least for those that also have "getifaddrs()", we have to get the size
by looking at the address family.
2003-02-25 07:50:28 +00:00
guy 463507912d Include "config.h", so that LBL_ALIGN is defined as appropriate, and add
"__arm__" to the list of #defines we check for if LBL_ALIGN isn't
defined, so that on ARM we assume unaligned accesses are unsafe (which
they are, on at least some ARM processors).
2003-02-23 00:22:00 +00:00
guy 0e96f354ca From Andrew Brown: make "pcap.o" depend on "version.h", so that even in
non-".devel" builds, with no automatically-generated dependencies,
"version.h" will be built before we try to build "pcap.o" ("pcap.c"
includes "version.h", so we need it to be built).
2003-02-21 03:19:19 +00:00
guy e592efb3bc According to the bufmod man page for Solaris 2.4 and 9 (meaning it's
probably true in all versions), "sbh_drops" is "the cumulative number of
input messages that this instance of bufmod has dropped due to flow
control or resource exhaustion."

"Cumulative" presumably means "don't add it to the count of drops, as
it's *already* a count since the capture started; just set the count of
drops to the value".  Do so.
2003-02-19 08:06:26 +00:00
guy 4244b90c15 Unfortunately, there is no direction flag for DLT_PPP. 2003-02-14 07:48:25 +00:00
guy 896263cfdc The comment in the rules for "version.h" was getting printed when
"version.h" was getting built; put the comment before the rules.
2003-02-13 07:56:38 +00:00
guy 694746f160 At least on SunOS 5.x, Digital UNIX 4.0, AIX 4.3, FreeBSD 3.4, some
version of Red Hat Linux, HP-UX 11.00, and MacOS X 10.1, if a string in
a shared library is static, and returned by a function in that library,
the return value of that function, when called from a program, will
reflect the contents of the string in the version of the shared library
with which the program is running, not the version with which it's
linked.

Therefore we can just generate a definition of the version string and
put it into "version.h", which means that VERSION can contain any string
(as long as " and \ are escaped with \) rather than having to be N.M or
N.M.MM.
2003-02-13 07:54:59 +00:00
hannes 9378712f13 allocate a bunch of DLT_ and LINKTYPES_ for Juniper-internal chassis encapsulation 2003-02-11 17:03:22 +00:00
guy 2807261207 Don't describe the string returned by "pcap_lib_version()" as a version
number - it has more than just a version number in it (and may have two
version numbers for WinPcap).
2003-02-11 08:03:21 +00:00
guy be8c1efc2c Support dot-dot version numbers.
Generate version.h before generating dependencies.
2003-02-11 08:01:40 +00:00
guy c3d7575735 Handle Win32/WinPcap differently when generating the version string. 2003-02-11 07:50:03 +00:00
guy e13c350417 Add a "pcap_lib_version()" routine to return a version string for
libpcap; it generates the string at run time on the first call, so that
it's not a constant string - in at least some UNIXes, constant data in a
shared library is kept separate from the library code, and is bound into
applications linked with that library at link time, not at run time, so
a constant string (such as "pcap_version[]") can reflect the version of
the library with which the application was built, not the version with
which it's running.

Document it, in the hopes that vendors will be less likely to omit it
from their libpcaps (unlike "pcap_version[]", which is absent from some
vendors' libpcaps).
2003-02-11 07:40:09 +00:00
guy 725f1b9d27 Before testing for DLPI, test for "/usr/include/odmi.h", so that, on
AIX, we choose BPF, not DLPI, by default; we won't necessarily choose
BPF if no libpcap-based program has been run since booting, as libpcap
(both IBM's and, now, ours) create BPF devices and load the driver if
that hasn't already been done since booting).
2003-02-11 06:21:00 +00:00
guy f4129e990d Use "odm_err_msg()" to get the error message string corresponding to ODM
errors.

Check for "odm_terminate()" failing.

Fix a typo.

Remove spaces between casts and variables, to match the style used
elsewhere.
2003-02-11 06:19:26 +00:00
guy d4b09f9421 Put in Shaun Clowes' full name. 2003-02-11 02:07:20 +00:00
guy aedf01b20f From Shaun <delius@progsoc.uts.edu.au>: on AIX, load the BPF driver and
create the BPF device nodes if necessary, and rename our "bpf.h" to
"pcap-bpf.h" and install it in "/usr/include", so that "pcap-bpf.c" gets
the system's bpf.h file if it includes <net/bpf.h> - on AIX, it needs to
get an AIX-specific structure from that header in order to support
loading the driver and creating the nodes.

Update "packaging/pcap.spec".
2003-02-11 01:46:05 +00:00
guy 52866495a0 From Gisle Vanem <giva@bgnett.no>: treat CR as white space in
expressions.
2003-02-08 19:27:00 +00:00
guy 6efec806a4 For DLT_ATM_RFC1483, the network-layer header starts 8 bytes from the
beginning of the packet if the packet has an 802.2+SNAP header (3 bytes
802.2, 5 bytes SNAP), and 3 bytes from the beginning of the packet if it
has only an 802.2 header, just as is the case for DLT_ATM_CLIP, so go
back to handling them both with the same case.

Restore some comments asking whether we need to check the SSAP when
testing the 802.2 header for protocol types.

Clean up white space.

RFC 1188, RFC 1042, and RFCs 1483 and 2225 specify that SNAP
encapsulation is used for IP, not LLC encapsulation with LLCSAP_IP and,
in fact, that's what most if not all IP traffic over FDDI, 802 networks,
and LLC-encapsulated ATM use; go back to treating those link-layer types
the same way other link-layer types are handled.
2003-02-05 01:53:29 +00:00
guy 8b31d709a2 If we have bufmod, allocate a buffer big enough to hold the size of
chunk we ask bufmod to send upstream.

Yes, uint_t is always 32 bits, at least as I read the Solaris 8 code.

The chunk size is 8192, not 0, by default.

Don't do the chunk size stuff if we don't have bufmod.
2003-02-05 01:46:58 +00:00
risso c6c36989f7 Added a const modifier to the first argument of pcap_lookupnet() for Win32. Without it, libpcap didn't compile under Cygwin. 2003-02-04 09:51:38 +00:00
guy 2256aabb91 As per suggestions from the anonymous SourceForge user who submitted bug
673958, make two changes on Solaris:

	don't set SB_NO_DROPS - doing so means that bufmod doesn't drop
	packets, so it can't report the number of drops, but packets
	probably still get dropped *somewhere*, if for no other reason
	than that the system refuses to allocate more mblks/dblks, even
	if it doesn't discard messages that arrive at the stream head if
	it's full;

	set the chunk size to 65536, as otherwise packets are dropped
	too easily.

snoop also appears not to set SB_NO_DROPS and also appears to set the
chunk size to 65536, so that's probably the right thing to do.
2003-02-04 05:42:03 +00:00
guy 04672f261b Put in break statements after every case in the switch on the NDIS
medium type.
2003-01-23 09:40:09 +00:00
guy 2d1ac3b4d5 From Peter Fales <peter@fales-lorenz.net>: support for Linux ARCNET,
which supplies different headers from BSD ARCNET, and fixes to the
ARCNET code generator (the protocol ID field is 1 byte, so the values
for it shouldn't be byte-swapped).

Whitespace cleanups.

The "NetBSD-style" ARCNET headers are used in other BSDs as well, so
just call them "BSD-style".
2003-01-23 07:24:51 +00:00
guy 4c88bf1f3e Add DLT_ARCNET_LINUX and LINKTYPE_ARCNET_LINUX; the link-layer headers
supplied by Linux's ARCNET code aren't the same as the ones supplied by
NetBSD's ARCNET code.

Fix up some LINKTYPE_ values to match the corresponding DLT_ values.
(There is no released version of libpcap/tcpdump that supports their
previous values.)
2003-01-21 04:39:05 +00:00
guy 5b474ef2bb Move the freeing of "p->dlt_list" to the proper place. 2003-01-16 07:44:27 +00:00
guy a41135fcd3 From NetBSD, as checked in by Antti Kantee <pooka@netbsd.org>: fix the
documentation for "pcap_next()" to indicate that it returns a "const
u_char *", not just a "u_char *".
2003-01-16 07:43:24 +00:00
guy 1445ed8be1 From NetBSD, as checked in by Antti Kantee <pooka@netbsd.org>: fix the
documentation for "pcap_next()" to indicate that it returns a "const
u_char *", not just a "u_char *".
2003-01-16 07:29:15 +00:00
guy 5060f872d8 Oops - fix a typo. 2003-01-10 09:15:18 +00:00
guy d4e32467f8 Test both for "sparc" and "__sparc__" in the case where LBL_ALIGN isn't
defined - Debian bug 171210 says that "sparc" isn't defined by GCC,
which presumably means "with the compiler we're using on Debian" as
there are versions of GCC that *do* define "sparc" on SPARC.
2003-01-10 09:14:07 +00:00
guy 3150af88f7 Squelch compiler warnings from Sun C. 2003-01-03 08:34:46 +00:00
guy a8d3536171 Make "split_dname()" take a "char *" as an argument and return a "char
*", and arrange never to pass it the argument to "pcap_open_live()" -
copy the device name to a buffer before doing anything else to it.
2003-01-03 08:33:54 +00:00
guy 123b602037 Put in a comment noting that you probably should Not Worry and just Be
Happy even with the warnings about passing a "const char *" to
"pfopen()".
2003-01-03 08:33:24 +00:00
guy 2b3d687c1e Constify the device argument to "pcap_open_live()", as was done for
other pcap-xxx.c files, and constify the argument to and return value
from "split_dname()" as well, to match.
2002-12-28 01:07:10 +00:00
guy 6f70bcdf95 "device" in the "pcap_md" structure is a copy of a string, and needn't
be "const" - not should it be, as that causes compiler whining for calls
that free the copy.
2002-12-28 00:44:04 +00:00
hannes 79c4d5bc62 from Chris Waters chris.waters[AT]networkchemistry.com:
reserve DLT and LINKTYPE for the Tazmen Sniffer
Protocol (TZSP).
2002-12-26 08:53:07 +00:00
guy dc9d85f819 Make "pcap_dump_flush()" return a success-vs-failure indication;
unfortunately, we can't fix "pcap_dump()" and "pcap_dump_close()" to do
that, as any application that tests the return value would fail to work
correctly if linked at runtime with an older libpcap, but we should
perhaps introduce "pcap_dump_ex()" and "pcap_dump_close_ex()" routines
that do return a success-vs-vailure indication.
2002-12-22 23:05:52 +00:00
guy 8cd68a0fa4 From Yoann Vandoorselaere <yoann@prelude-ids.org>: make the "device"
argument to "pcap_open_live()" a "const" pointer.

Constify some additional device name arguments, and update the man page
to reflect some arguments that were already consts.
2002-12-22 02:36:48 +00:00
guy eca5a61ef1 From Andrew Brown <atatat@atatdot.net>: add a "pcap_dump_flush()" call,
to flush the standard I/O buffer for a "pcap_dumper_t" and force all
packets written with "pcap_dump()" to the savefile.
2002-12-21 23:38:51 +00:00
guy 482fa426bc NetBSD support for multiple data link types on an interface, from David
Young <dyoung@ojctech.com>, with some minor changes by Jason R.  Thorpe
<thorpej@netbsd.org>, and further changes by me to support it on BPF
systems lacking BIOCGDLTLIST and other platforms lacking an equivalent
feature.

Update Jason Thorpe's e-mail address (Zembu is going away, if it hasn't
done so already).

Add APIs to map DLT names to DLT values and vice versa.
2002-12-19 09:05:45 +00:00
guy 1e574aa6fd Indicate when "pcap_next()" returns NULL, and that, unfortunately, you
don't know whether that happens because of an error or because no
packets were available at the time.
2002-12-17 07:32:55 +00:00