dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

17 Commits

Author SHA1 Message Date
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
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 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
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 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 855d5eab07 conditionalize on USHRT_MAX and SOL_PACKET. From Love
<lha@stacken.kth.se>
2000-07-11 01:09:16 +00:00
assar b59cd6dc3c (MSG_TRUNC): define if it's not defined. From Love
<lha@stacken.kth.se>
2000-07-11 01:06:27 +00:00
assar 0e2f8c8892 add config.h, remove gnuc.h. remove __dead 2000-07-11 00:37:04 +00:00
assar be5b659ebf use snprintf instead of sprintf. From Juergen Schoenwaelder
<schoenw@ibr.cs.tu-bs.de>
2000-07-04 12:24:01 +00:00
torsten 94de442535 Merged the Linux v2.2 packet support into the main trunk (from
tag linux-2-2-packet). Please test this code :)
2000-06-08 06:40:09 +00:00
assar 742c75ef83 (pcap_open_live): remove duplicate PCAP_ERRBUF_SIZE 2000-05-13 13:14:41 +00:00
itojun a2b5a241a2 typo; snprint -> snprintf 2000-05-08 23:11:02 +00:00
itojun 466c37aaa3 s/PCAP_ERRBUFF_SIZE/PCAP_ERRBUF_SIZE/ (fatal typo) 2000-04-27 14:24:11 +00:00
itojun 6abf10866e nuke strcpy() 2000-04-27 11:16:19 +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
mcr b11ddf8a9b Initial revision 1999-10-07 23:46:40 +00:00