fenner [Mon, 4 Dec 2000 00:43:39 +0000 (00:43 +0000)]
Add some truncation checks.
#include <netdb.h> for MAXHOSTNAMELEN on Solaris
Use EXTRACT_16BITS to extract 16-bit quantities
Print withdrawn routes if we think we can
Print must-be-zero attribute flags if they're not zero
Partly from: Jim Vaughn, http://www.tcpdump.org/lists/patches/107
fenner [Sun, 3 Dec 2000 23:42:23 +0000 (23:42 +0000)]
Update for new RFC's and IANA assignments. Many special-format options
are printed as binary strings. Any of these that are in common use
can get their own printers.
guy [Sun, 3 Dec 2000 20:31:26 +0000 (20:31 +0000)]
Don't print the value of a RADIUS attribute if the length is less than
or equal to 2 (the length includes the two bytes of type and length).
Don't print the values of RADIUS attributes that are supposed to be of a
particular length if they have a different length.
Don't use the result of "ctime()", unmodified, when printing an
attribute value; the string "ctime()" supplies includes a newline, which
we need to remove.
The "PRINT_HEX()" macro expands into code that modifies its first
argument; always set the variable in question to the appropriate value
before calling the macro.
fenner [Fri, 10 Nov 2000 17:52:02 +0000 (17:52 +0000)]
Resize 2 statically allocated hostname buffers.
This was in http://www.tcpdump.org/lists/patches/89 , and also
ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-00%3A61/tcpdump-4.x.patch.v1.1
guy [Mon, 30 Oct 2000 05:41:30 +0000 (05:41 +0000)]
Patch from Daniel Hagerty <[email protected]>, submitted with NetBSD PR
#4141, to dissect raw Appletalk-atop-Ethernet packets correctly, i.e.
not as if they were IPTalk packets. (A very similar patch was submitted
for Debian bug #67642.)
guy [Sat, 28 Oct 2000 10:10:54 +0000 (10:10 +0000)]
Tony Li's changes, from FreeBSD, to support filtering for OSI packets
and for ESIS and ISIS packets.
Don't describe "atalk", "aarp", "lat", "sca", "moprc", or "mopdl" as
qualifiers that restrict address or port matches to a particular
protocol, as they aren't.
"iso", however, is a qualifier that applies to "proto", at least, and
can take a number or "esis" or "isis" as arguments; "esis" and "isis"
are short for "iso proto esis" and "iso proto isis".
Update the enumeration of the protocols that can be the target of "ip
proto" to reflect current reality.
Enumerate all the protocols that can be the target of "ether proto",
including the new "iso".
guy [Fri, 27 Oct 2000 23:26:30 +0000 (23:26 +0000)]
Patch sent to Debian by Roderick Schertler <[email protected]> to print
the time zone offset as a signed 32-bit integer (as RFC 1533 says it is)
rather than as an unsigned 32-bit integer.
guy [Wed, 25 Oct 2000 07:49:28 +0000 (07:49 +0000)]
Document the deficiencies of tcpdump (of libpcap in general, actually)
with the Linux 2.0[.x] kernel, and suggest that the user upgrade to a
2.2[.x] kernel.
guy [Sun, 22 Oct 2000 04:17:52 +0000 (04:17 +0000)]
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).
guy [Sat, 21 Oct 2000 05:00:18 +0000 (05:00 +0000)]
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.
We should also no longer need to define __STDC__ as 2 on Digital UNIX,
as we're no longer including the native OS's <netinet/ip.h> to get the
layout of an IP packet declared, we're using our own "ip.h" header file
for that.
guy [Sat, 21 Oct 2000 04:54:26 +0000 (04:54 +0000)]
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.
We should also no longer need to define __STDC__ as 2 on Digital UNIX,
as we're no longer including the native OS's <netinet/ip.h> to get the
layout of an IP packet declared, we're using our own "ip.h" header file
for that.
guy [Thu, 12 Oct 2000 03:57:13 +0000 (03:57 +0000)]
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.
guy [Wed, 11 Oct 2000 04:04:33 +0000 (04:04 +0000)]
Clean up some problems that Sun C found (casting a "u_char *" pointer to
"char *" before assigning it to a "u_char *", assigning "const u_char *"
pointers to "u_char *" variables, putting a cast on the LHS of an
assignment).
guy [Wed, 11 Oct 2000 04:02:15 +0000 (04:02 +0000)]
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.)
Don't use expressions with side effects inside EXTRACT macros - the
arguments of those macros are used more than once, so the side-effects
(incrementing the pointer) occurs more than once, and they occur in a
sequence that may not be the same for all compilers.
When printing a UNIX time value, extract the value into a "time_t"
variable, and then pass a pointer to that variable to "ctime()", don't
cast the result of "EXTRACT_32BITS()" to a pointer. Also, when printing
the result of "ctime()", print only the first 24 characters, so that the
newline at the end isn't printed.
Cast the first argument passed to "radius_attr_print()", and the
argument passed to the print function for an attribute, to "u_char *",
not "char *", as those routines expect a "u_char *".
guy [Tue, 10 Oct 2000 05:03:32 +0000 (05:03 +0000)]
The infinite diversity of UNIX platforms is an eternal source of joy.
On some platforms (e.g., Solaris 2.5.1 and 2.6, at least), you have to
include <netdb.h> to get MAXHOSTNAMELEN defined, including <sys/param.h>
doesn't do it (on others, <netdb.h> doesn't help, and you have to
include <sys/param.h>.
Include <netdb.h> in some files, but, for "timed.h", just use 256 rather
than MAXHOSTNAMELEN - the Berkeley time daemon protocol spec (in the
timed source directory in various BSDs) says the packet includes "A
zero-terminated string of up to 256 ASCII characters with the name of
the machine sending the message."
guy [Mon, 9 Oct 2000 03:24:24 +0000 (03:24 +0000)]
Some compilers may pad structures to a length that's a multiple of 2 or
4 bytes, even though no member in the structure requires such an
alignment; don't use "sizeof (struct ether_arp), explicitly #define the
header length and use that #defined value.
We don't use "struct ether_addr" in any dissectors, so there's no need
to define it in "ether.h" - and, if compilers pad it to a multiple of 4
bytes, you can't use it anyway, as it'll be 8 bytes long, not 6 bytes
long.
guy [Mon, 9 Oct 2000 02:59:39 +0000 (02:59 +0000)]
Some compilers may pad structures to a length that's a multiple of 2 or
4 bytes, even though no member in the structure requires such an
alignment; don't use "sizeof (struct ether_header)" or "sizeof (struct
fddi_header)", explicitly #define the header length and use that
#defined value.
guy [Mon, 9 Oct 2000 01:53:19 +0000 (01:53 +0000)]
Pull the "linux-include" versions of "slip.h" and "slcompress.h" up to
the top-level directory, remove from them all stuff not needed by
tcpdump, include them rather than the system's header files, and get rid
of assorted unnecessary include files.
This means you don't need to check for "slip.h" when building
"print-sl.c", stubbing it out on systems that don't have "slip.h". We
also don't need to build the stuff in "print-vjc.c" only on BSD/OS.
Use "u_int32_t" and "u_int16_t" rather than "u_int" and "u_short" for
structure members in "print-chdlc.c".
Move PPP_HDRLEN from "print-ppp.c" to "ppp.h", as per the XXX comment in
"print-ppp.c".
guy [Sun, 8 Oct 2000 08:48:48 +0000 (08:48 +0000)]
Get rid of unnecessary includes, and use tcpdump's "ip.h" and "udp.h"
rather than the OS's <netinet/ip.h> and <netinet/udp.h>.
As per Bill Fenner's suggestion, print single-byte 2-digit hex values
with "%02X" rather than manually pulling the nibbles out of the byte and
converting them.
itojun [Sat, 7 Oct 2000 05:53:09 +0000 (05:53 +0000)]
put stripped-down version of ip6.h and icmp6.h into tcpdump tree.
ip6.h is almost normal RFC2292 header.
icmp6.h has couple of extensions (not covered by RFC2292),
like MLD, ICMPv6 nodeinfo, and router renumber.
guy [Fri, 6 Oct 2000 04:23:10 +0000 (04:23 +0000)]
Get rid of some includes of <net/route.h>, and empty declarations of
"struct mbuf" and "struct rtentry" - they shouldn't be necessary (and
weren't on the platforms on which I tested, both with GCC and the native
compiler if it isn't GCC).
guy [Fri, 6 Oct 2000 04:19:21 +0000 (04:19 +0000)]
We no longer include <netinet/ip.h>, so we don't need to work around
Digital UNIX using "ip_vhl" rather than "ip_v" and "ip_hl" bitfields if
__STDC__ is defined (we have our own "ip.h", and we don't use bitfields
in it).
Get rid of HAVE_INET_ATON, HAVE_INET_NTOP, and HAVE_INET_PTON - we don't
use them; instead, we supply our own versions of "inet_aton()",
"inet_ntop()", and "inet_pton()". (Defining them in "configure.in"
caused complaints from "autoreconf".)
Check for the "rc5.h" header, as we *do* use HAVE_RC5_H.
guy [Tue, 3 Oct 2000 09:17:40 +0000 (09:17 +0000)]
C bitfields are no longer being used to extract bit fields from the IP
and TCP headers, so there's no need to stuff the byte-order stuff into
these header files.
guy [Tue, 3 Oct 2000 09:13:25 +0000 (09:13 +0000)]
Bitfield layout in memory is not specified by the ANSI C spec; don't use
C bitfields to specify the layout of a DNS request or response header,
use shifts and masks to extract the bitfields.
itojun [Tue, 3 Oct 2000 02:59:53 +0000 (02:59 +0000)]
workaround check of inet_{ntop,pton} for bsdi4.
bsdi4 ships with BIND8 resolver, and the way it defines inet_{ntop,pton}
is rather strange; it does not ship with libc symbol "inet_ntop".
it ships with "_inet_ntop", and has a #define macro in header to rename it.
AC_CHECK_FUNCS will always fail for resolver functions.
i consider it as a bug in merger. bsdi should have done the following:
- supply _inet_ntop for libc-internal calls
- supply weak symbol inet_ntop for external reference
- no #define in headers
itojun [Tue, 3 Oct 2000 02:54:54 +0000 (02:54 +0000)]
always use u_intXX_t for protocol format declaration. char/short/int may not
come with exact size. while at it, correct signedness of ip/udp header field.
nuke most of the use of bitfield.
TODO: bitfield in namser.h
itojun [Tue, 3 Oct 2000 02:26:53 +0000 (02:26 +0000)]
do not use integer bitfield when we care about the resulting member size.
u_int x:4, y:4; will occupy sizeof(int) on some platforms, while it occupy
1 byte on some platforms. use macro to decode th_off.
remove rc5 support.
- presense of rc5.h does not correctly identify availability of rc5 library
(neither AC_CHECK_FUNCS),
- we don't advocate it,
- and its use is very rare.
guy [Fri, 29 Sep 2000 05:05:47 +0000 (05:05 +0000)]
Declare bitfields as "u_int", not "u_char"; ANSI C doesn't guarantee
that bitfields other than "int" or "unsigned int" are allowed, some
compilers warn about them, and, given that the declaration of a bit
field says how many bits it is wide, declaring them "u_char" doesn't
have any advantage (other than making it a bit clearer, when reading the
header, that the bitfields in question are part of a single byte).