dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

138 Commits

Author SHA1 Message Date
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
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 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 cb1f8ef14d Add new DLT_ type for AVS's WLAN header. 2002-12-11 22:43:31 +00:00
risso 8b5f7cc99e There was a bug in pcap_open_offline: in case of error, the returned pointer was freed but the open file was not closed. Thus, a handle on the opened file was kept and could not be released as the returned pointer was null. 2002-10-24 08:09:42 +00:00
guy d1d0fe1d98 Add support for RFC 2625 IP-over-Fibre Channel, mapping all the Linux
ARPHRD_FC* types to it.
2002-10-18 08:46:13 +00:00
guy f8a3b72cd9 Add LINKTYPE_ values and mapping table entries for the new DLT_ values
added for Kent Dahlgren.
2002-10-09 19:02:56 +00:00
guy 24481411c8 The Frame Realay and SunATM link-layer types are no longer reserved for
future use, they're being used.
2002-08-06 06:27:49 +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 5095d581ec We'd already reserved 107 for Frame Relay; use that instead of a new
value.
2002-06-07 04:31:12 +00:00
guy 562499a65d Reserve a DLT_ value for Frame Relay, and map BSD/OS's DLT_FR to it. 2002-06-07 04:17:15 +00:00
guy d041ab8109 Reserve a DLT_ value for capturing on Solaris with SunATM. 2002-06-06 08:57:03 +00:00
guy 0a4e47d8be Don Lee was doing IP-over-FC, with the link-layer header from the
capture device having only an RFC 2625 Network_Header field, not a Fibre
Channel frame header; rename the constants to emphasize this and to
leave room for another "raw Fibre Channel" link-layer type, if it's ever
needed.
2002-04-20 21:01:57 +00:00
guy 5ba1adf267 No UNIX-specific functions are used here, so there's no need to include
<unistd.h>.
2002-04-09 07:44:46 +00:00
guy fdaba9c2a6 <pcap.h> includes <sys/types.h> and <sys/time.h>; there's no need to
include it in these files, as they either include "pcap-int.h", which
includes <pcap.h>, or they include <pcap.h> directly.
2002-03-24 23:21:51 +00:00
guy 7346580de5 Add a LINKTYPE_ value for Fibre Channel, as per a request from Don Lee
<donlee@cray.com>.
2002-03-08 11:24:32 +00:00
guy da21ca14ff Link-layer type 121 reserved for Siemens HiPath HDLC, as per a request
from Tomas Kukosa <tomas.kukosa@anfdata.cz>.
2002-01-25 08:27:33 +00:00
guy cabc9945d9 Add in items for the new savefile types. 2001-11-28 07:16:53 +00:00
guy 7acd15ba8d Reserve 116 for IP Filter capture files and 117 for OpenBSD DLT_PFLOG. 2001-09-09 05:02:28 +00:00
guy b57608cf35 LINKTYPE_IEEE802_11 and LINKTYPE_LOOP, and DLT_IEEE802_11, are no longer
reserved for future use; they're being used.

Move other currently-being-used LINKTYPE_ values above the "reserved for
future use" comment, to make it clear which types are reserved and which
are already in use.

Note that 100 through 103 shouldn't be used for new DLT_ types.
2001-09-09 04:27:18 +00:00
guy ba047e2bd0 Add a DLT_ value and a link-layer type value for savefiles for Acorn
Econet.
2001-09-05 04:27:23 +00:00
guy e83123b1eb DLT_ value and capture file header LINKTYPE_ value reserved for Apple
LocalTalk hardware.
2001-06-05 03:09:39 +00:00
guy 80788ad380 Add support for NetBSD DLT_PPP_ETHER, as per the NetBSD libpcap. 2001-04-17 08:10:00 +00:00
guy 5b0a98d641 Add support for a new link layer type DLT_LINUX_SLL, for use when doing
live captures with a "cooked" (SOCK_DGRAM) rather than a "raw"
(SOCK_RAW) PF_PACKET socket; it includes a bunch of the fields from the
"struct sockaddr_ll" you get in a "recvfrom()", including the Ethernet
protocol field.

This requires us to rewrite the BPF program if we're stuffing it into
the kernel; as long as we're doing *ex post facto* rewriting, we might
as well also do the "ret <snaplen>" -> "ret 65535" fixup there as well,
rather than in the code generator.
2000-12-21 10:29:21 +00:00
guy d9d04b6303 Use 50, not 113, for the link layer type in NetBSD DLT_PPP_SERIAL
capture files; NetBSD uses 50, and, hopefully, nobody else will use 50
for something else.
2000-12-16 22:19:12 +00:00
guy 7928a0e823 Handle DLT_NULL correctly - the AF_ value is in host byte order, which
means that we should "htonl()" it before using it in BPF expressions
*but*, if we're reading a capture file from a machine with the opposite
byte order from ours, we should byte-swap it before "htonl()"ing it.

Handle OpenBSD DLT_LOOP as well - it's like DLT_NULL except that the AF_
value is in *network* byte order.

Don't support checking for inbound or outbound packets except on those
data link types that supply an inbound/outbound qualifier (DLT_SLIP and
DLT_PPP) - this came from OpenBSD's libpcap, delta 1.12 to "gencode.c".
2000-12-16 21:31:10 +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
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 fd7f1bf605 Include <string.h> to declare various string-manipulating routines. 2000-10-10 04:53:08 +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 884ed98aed Add support for reading capture files from programs using Alexey
Kuznetzov's patched version of libpcap; we ignore the additional fields
it adds to the per-packet header.  Red Hat Linux 6.2 uses that patched
version, and some other Linux distributions might do so as well.

(This won't handle an early version of his patch, which changed the
per-packet header but didn't change the magic number; that early version
appears in Red Hat Linux 6.1.

Doing that requires a heuristic test, wherein we assume the file is
standard libpcap and try to read the first and second records, and, if
the header of the second record looks like garbage, assume that the file
came from that early version, and that we're therefore reading random
packet data when we think we're reading the header of the second packet.

As we don't then want to seek back to the first packet, because we want
to continue to allow libpcap-based programs such as tcpdump to read from
pipes, we'd have to buffer data from the file so that we can go back and
re-read it.  I leave this for later.)
2000-07-18 03:43:47 +00:00
assar 0e2f8c8892 add config.h, remove gnuc.h. remove __dead 2000-07-11 00:37:04 +00:00
itojun 20d9e08cde do not use sprintf(). always use snprintf().
from NetBSD/OpenBSD src/lib/libpcap.

use freeifaddrs() if exists.
2000-04-27 09:11:11 +00:00
assar 56c33c01be (sf_next_packet, pcap_dump): convert between `pcap_pkthdr' and
`pcap_sf_pkthdr'
1999-11-21 01:11:58 +00:00
mcr b11ddf8a9b Initial revision 1999-10-07 23:46:40 +00:00