dect
/
libpcap
Archived
13
0
Fork 0
Commit Graph

27 Commits

Author SHA1 Message Date
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
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 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 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
guy c8c2e7e65b Token Ring support, from various patches. Also add "tr" as an alias for
"ether", "fddi", "link", etc..
2000-07-25 05:50:08 +00:00
guy 0d0297bdd1 Older versions of Flex (e.g., 2.5.2, which at least one user had) dump
core if the YY_FLUSH_BUFFER macro is called when there's no current
buffer (e.g., before any scanning has been done).

So, instead, when using Flex, we use "yy_scan_string()" to specify that
the scanner should read from the filter expression string, rather than
defining our own YY_INPUT macro, and we add a "lex_cleanup()" routine,
called after parsing is complete, to delete the buffer allocated by
"yy_scan_string()", which arranges that, when we next hand the scanner a
string, it doesn't then return to the parser cruft left over from the
previous parse.
2000-07-13 06:51:56 +00:00
assar 0e2f8c8892 add config.h, remove gnuc.h. remove __dead 2000-07-11 00:37:04 +00:00
assar 95cd5942c1 remove non-stdc code
remove unused variable warning
2000-07-01 03:32:50 +00:00
assar 2dffac5060 handle no link-layer
From Darren Reed <darrenr@reed.wattle.id.au>
2000-06-26 05:10:40 +00:00
itojun 299da87b7d -Wall -Werror clean. 2000-06-03 16:29:42 +00:00
itojun eb3914c790 nuke strcpy, one more. 2000-04-27 11:16:54 +00:00
itojun 6abf10866e nuke strcpy() 2000-04-27 11:16:19 +00:00
itojun a906e591fb revert renaming of pcap_nametoaddrinfo to pcap_nametoaddr. this gets
painful when upgrading old libpcap to tcpdump.org pcap (function rename
usually requires shlib major number bump, while api addition only require
minor)
2000-04-27 09:18:57 +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 4343a38646 (gen_proto_abbrev): add fallback definition for IPPROTO_IGMP and use
constant
2000-04-01 11:44:59 +00:00
assar c9e00ba444 remove superfluous line for igrp. From Rick Jones <raj@cup.hp.com> 2000-04-01 11:37:45 +00:00
itojun e3ddb0ce0f improve message on ip{,6} host foo failure 2000-03-01 14:07:02 +00:00
itojun d27ad07fae fix "ip host foo" or "ip6 host foo" where foo has both A and AAAA records.
FreeBSD PR: 17083
2000-03-01 03:37:24 +00:00
fenner b04bc7d664 Eliminate duplicated word in comment. 2000-01-29 21:01:27 +00:00
mcr e660fb6947 This adds a new function that allows using the bpf compiler without
having a pcap open.  One could argue that this and the existing
	compiler should be factored in common routines, but I was trying to
	make it clear that this wouldn't break the existing code.
	from Greg Troxel <gdt@ir.bbn.com>
1999-12-08 19:54:03 +00:00
itojun 5b7ead9173 add configure option --disable-protochain, to make Arne happier. 1999-11-01 15:56:40 +00:00
itojun a1c72596a3 fix protochain operator on IPv4/v6. 1999-11-01 13:47:51 +00:00
itojun e66d344350 last-resort def for IPPROTO_NONE. 1999-10-30 05:16:35 +00:00
itojun 3c03d42af2 libpcap fix for non-IPv6 build.
<http://www.sics.se/~assar/tcpdump_patches/1>

From: Assar Westerlund <assar@sics.se>
1999-10-30 04:30:13 +00:00
itojun 7fe3c1111a IPv6 packet filtering code.
./configure --enable-ipv6 (requires getaddrinfo(3) and getnameinfo(3)).

TODO: make it work even without getaddrinfo(3) or getnameinfo(3)
(or, tcpdump/configure.in should provide alternative version by
AC_REPLACE_FUNCS)
TODO: make IPv6 filtering code work by default
TODO: make "protochain" friendly with optimization
1999-10-19 15:18:28 +00:00
mcr b11ddf8a9b Initial revision 1999-10-07 23:46:40 +00:00