summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguy <guy>2002-09-05 00:00:07 +0000
committerguy <guy>2002-09-05 00:00:07 +0000
commitedb0e92cdcaf06168a38e632847b8fd2c0a62a2d (patch)
treefaf57bac69529b8d0e0700df10e30844cf553779
parent28b539271c4d4ac30faa29cdb79d040c823535ab (diff)
downloadtcpdump-edb0e92cdcaf06168a38e632847b8fd2c0a62a2d.tar.gz
Add a few more GCC warnings on GCC >= 2 for ".devel" builds.
From Neil T. Spring: fixes for many of those warnings: addrtoname.c, configure.in: Linux needs netinet/ether.h for ether_ntohost print-*.c: change char *foo = "bar" to const char *foo = "bar" to appease -Wwrite-strings; should affect no run-time behavior. print-*.c: make some variables unsigned. print-bgp.c: plen ('prefix len') is unsigned, no reason to validate by comparing to zero. print-cnfp.c, print-rx.c: use intoa, provided by addrtoname, instead of inet_ntoa. print-domain.c: unsigned int l; (l=foo()) < 0 is guaranteed to be false, so check for (u_int)-1, which represents failure, explicitly. print-isakmp.c: complete initialization of attrmap objects. print-lwres.c: "if(x); print foo;" seemed much more likely to be intended to be "if(x) { print foo; }". print-smb.c: complete initialization of some structures. In addition, add some fixes for the signed vs. unsigned comparison warnings: extract.h: cast the result of the byte-extraction-and-combining, as, at least for the 16-bit version, C's integral promotions will turn "u_int16_t" into "int" if there are other "int"s nearby. print-*.c: make some more variables unsigned, or add casts to an unsigned type of signed values known not to be negative, or add casts to "int" of unsigned values known to fit in an "int", and make other changes needed to handle the aforementioned variables now being unsigned. print-isakmp.c: clean up the handling of error/status indicators in notify messages. print-ppp.c: get rid of a check that an unsigned quantity is >= 0. print-radius.c: clean up some of the bounds checking. print-smb.c: extract the word count into a "u_int" to avoid the aforementioned problems with C's integral promotions. print-snmp.c: change a check that an unsigned variable is >= 0 to a check that it's != 0. Also, fix some formats to use "%u" rather than "%d" for unsigned quantities.
-rw-r--r--CREDITS1
-rw-r--r--aclocal.m47
-rw-r--r--addrtoname.c5
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure6
-rw-r--r--configure.in6
-rw-r--r--extract.h32
-rw-r--r--print-802_11.c4
-rw-r--r--print-ascii.c4
-rw-r--r--print-bgp.c8
-rw-r--r--print-cnfp.c10
-rw-r--r--print-domain.c8
-rw-r--r--print-dvmrp.c5
-rw-r--r--print-egp.c4
-rw-r--r--print-esp.c4
-rw-r--r--print-fr.c13
-rw-r--r--print-ip.c6
-rw-r--r--print-isakmp.c119
-rw-r--r--print-isoclns.c4
-rw-r--r--print-l2tp.c6
-rw-r--r--print-llc.c4
-rw-r--r--print-lwres.c12
-rw-r--r--print-msdp.c8
-rw-r--r--print-nfs.c4
-rw-r--r--print-pim.c6
-rw-r--r--print-ppp.c5
-rw-r--r--print-pptp.c4
-rw-r--r--print-radius.c43
-rw-r--r--print-rip.c21
-rw-r--r--print-rx.c62
-rw-r--r--print-smb.c40
-rw-r--r--print-snmp.c50
-rw-r--r--print-sunrpc.c4
-rw-r--r--print-tcp.c12
-rw-r--r--print-telnet.c7
-rw-r--r--print-timed.c4
-rw-r--r--print-token.c5
-rw-r--r--print-wb.c6
-rw-r--r--print-zephyr.c6
-rw-r--r--smbutil.c26
-rw-r--r--token.h4
41 files changed, 323 insertions, 265 deletions
diff --git a/CREDITS b/CREDITS
index fd1ee737..6e0be140 100644
--- a/CREDITS
+++ b/CREDITS
@@ -70,6 +70,7 @@ Additional people who have contributed patches:
Motonori Shindo <mshindo@mshindo.net>
Nathan J. Williams <nathanw@MIT.EDU>
Nathaniel Couper-Noles <Nathaniel@isi1.tccisi.com>
+ Neil T. Spring <bluehal@users.sourceforge.net>
Niels Provos <provos@openbsd.org>
Nickolai Zeldovich <kolya@MIT.EDU>
Olaf Kirch <okir@caldera.de>
diff --git a/aclocal.m4 b/aclocal.m4
index ae9215c8..641b737a 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.87 2002-08-04 21:20:29 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.88 2002-09-05 00:00:07 guy Exp $ (LBL)
dnl
dnl Copyright (c) 1995, 1996, 1997, 1998
dnl The Regents of the University of California. All rights reserved.
@@ -594,7 +594,8 @@ EOF
dnl
dnl If using gcc and the file .devel exists:
dnl Compile with -g (if supported) and -Wall
-dnl If using gcc 2, do extra prototype checking
+dnl If using gcc 2 or later, do extra prototype checking and some other
+dnl checks
dnl If an os prototype include exists, symlink os-proto.h to it
dnl
dnl usage:
@@ -620,7 +621,7 @@ AC_DEFUN(AC_LBL_DEVEL,
fi
$1="$$1 -Wall"
if test $ac_cv_lbl_gcc_vers -gt 1 ; then
- $1="$$1 -Wmissing-prototypes -Wstrict-prototypes"
+ $1="$$1 -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -W -Wno-unused"
fi
fi
else
diff --git a/addrtoname.c b/addrtoname.c
index 59e8610b..2e07e414 100644
--- a/addrtoname.c
+++ b/addrtoname.c
@@ -23,7 +23,7 @@
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.92 2002-08-07 13:53:21 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.93 2002-09-05 00:00:08 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -39,6 +39,9 @@ struct rtentry; /* declarations in <net/if.h> */
#include <net/if.h> /* for "struct ifnet" in "struct arpcom" on Solaris */
#include <netinet/if_ether.h>
#endif /* HAVE_NETINET_IF_ETHER_H */
+#ifdef HAVE_NETINET_ETHER_H
+#include <netinet/ether.h> /* ether_ntohost on linux */
+#endif /* HAVE_NETINET_ETHER_H */
#endif /* USE_ETHER_NTOHOST */
#include <pcap.h>
diff --git a/config.h.in b/config.h.in
index d71c33d9..bf6d4e41 100644
--- a/config.h.in
+++ b/config.h.in
@@ -171,6 +171,9 @@
/* Define if you have the <netdnet/dnetdb.h> header file. */
#undef HAVE_NETDNET_DNETDB_H
+/* Define if you have the <netinet/ether.h> header file. */
+#undef HAVE_NETINET_ETHER_H
+
/* Define if you have the <netinet/if_ether.h> header file. */
#undef HAVE_NETINET_IF_ETHER_H
diff --git a/configure b/configure
index d047e890..1addf73a 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
-# From configure.in Revision: 1.155
+# From configure.in Revision: 1.156
@@ -1268,7 +1268,7 @@ else
fi
echo "$ac_t""$CPP" 1>&6
-for ac_hdr in fcntl.h rpc/rpcent.h netinet/if_ether.h netdnet/dnetdb.h
+for ac_hdr in fcntl.h rpc/rpcent.h netinet/if_ether.h netdnet/dnetdb.h netinet/ether.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -4291,7 +4291,7 @@ rm -f os-proto.h
fi
V_CCOPT="$V_CCOPT -Wall"
if test $ac_cv_lbl_gcc_vers -gt 1 ; then
- V_CCOPT="$V_CCOPT -Wmissing-prototypes -Wstrict-prototypes"
+ V_CCOPT="$V_CCOPT -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -W -Wno-unused"
fi
fi
else
diff --git a/configure.in b/configure.in
index e671ff4d..3c740016 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.155 2002-08-03 22:37:01 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.156 2002-09-05 00:00:08 guy Exp $ (LBL)
dnl
dnl Copyright (c) 1994, 1995, 1996, 1997
dnl The Regents of the University of California. All rights reserved.
@@ -6,7 +6,7 @@ dnl
dnl Process this file with autoconf to produce a configure script.
dnl
-AC_REVISION($Revision: 1.155 $)
+AC_REVISION($Revision: 1.156 $)
AC_PREREQ(2.13)
AC_INIT(tcpdump.c)
@@ -16,7 +16,7 @@ AC_LBL_C_INIT(V_CCOPT, V_INCLS)
AC_LBL_C_INLINE
AC_C___ATTRIBUTE__
-AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netinet/if_ether.h netdnet/dnetdb.h)
+AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netinet/if_ether.h netdnet/dnetdb.h netinet/ether.h)
AC_HEADER_TIME
case "$host_os" in
diff --git a/extract.h b/extract.h
index 0117f389..5e72d2e5 100644
--- a/extract.h
+++ b/extract.h
@@ -18,20 +18,20 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/extract.h,v 1.17 2001-09-17 21:57:52 fenner Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/extract.h,v 1.18 2002-09-05 00:00:09 guy Exp $ (LBL)
*/
/* Network to host order macros */
#ifdef LBL_ALIGN
#define EXTRACT_16BITS(p) \
- ((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \
- (u_int16_t)*((const u_int8_t *)(p) + 1))
+ ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \
+ (u_int16_t)*((const u_int8_t *)(p) + 1)))
#define EXTRACT_32BITS(p) \
- ((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \
- (u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \
- (u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \
- (u_int32_t)*((const u_int8_t *)(p) + 3))
+ ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 3)))
#else
#define EXTRACT_16BITS(p) \
((u_int16_t)ntohs(*(const u_int16_t *)(p)))
@@ -40,18 +40,18 @@
#endif
#define EXTRACT_24BITS(p) \
- ((u_int32_t)*((const u_int8_t *)(p) + 0) << 16 | \
- (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
- (u_int32_t)*((const u_int8_t *)(p) + 2))
+ ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 16 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 2)))
/* Little endian protocol host order macros */
#define EXTRACT_LE_8BITS(p) (*(p))
#define EXTRACT_LE_16BITS(p) \
- ((u_int16_t)*((const u_int8_t *)(p) + 1) << 8 | \
- (u_int16_t)*((const u_int8_t *)(p) + 0))
+ ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 1) << 8 | \
+ (u_int16_t)*((const u_int8_t *)(p) + 0)))
#define EXTRACT_LE_32BITS(p) \
- ((u_int32_t)*((const u_int8_t *)(p) + 3) << 24 | \
- (u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \
- (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
- (u_int32_t)*((const u_int8_t *)(p) + 0))
+ ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 3) << 24 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
+ (u_int32_t)*((const u_int8_t *)(p) + 0)))
diff --git a/print-802_11.c b/print-802_11.c
index a3319195..2897a468 100644
--- a/print-802_11.c
+++ b/print-802_11.c
@@ -22,7 +22,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.9 2002-08-01 08:52:59 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.10 2002-09-05 00:00:09 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -46,7 +46,7 @@ static const char rcsid[] =
#define PRINT_RATES(p) \
do { \
int z; \
- char *sep = " ["; \
+ const char *sep = " ["; \
for (z = 0; z < p.rates.length ; z++) { \
printf("%s%2.1f", sep, (.5 * (p.rates.rate[z] & 0x7f))); \
sep = " "; \
diff --git a/print-ascii.c b/print-ascii.c
index 524a430e..1bbc8be4 100644
--- a/print-ascii.c
+++ b/print-ascii.c
@@ -42,7 +42,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.9 2002-08-01 08:53:00 risso Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.10 2002-09-05 00:00:10 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
#include <stdio.h>
@@ -65,7 +65,7 @@ ascii_print_with_offset(register const u_char *cp, register u_int length,
register int nshorts;
char hexstuff[HEXDUMP_SHORTS_PER_LINE*HEXDUMP_HEXSTUFF_PER_SHORT+1], *hsp;
char asciistuff[ASCII_LINELENGTH+1], *asp;
- int maxlength = (Aflag ? ASCII_LINELENGTH : HEXDUMP_SHORTS_PER_LINE);
+ u_int maxlength = (Aflag ? ASCII_LINELENGTH : HEXDUMP_SHORTS_PER_LINE);
nshorts = length / sizeof(u_short);
i = 0;
diff --git a/print-bgp.c b/print-bgp.c
index b6651d1f..4bd8cb2c 100644
--- a/print-bgp.c
+++ b/print-bgp.c
@@ -36,7 +36,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.49 2002-08-25 18:25:57 hannes Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.50 2002-09-05 00:00:10 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
@@ -380,7 +380,7 @@ decode_prefix4(const u_char *pptr, char *buf, u_int buflen)
u_int plen;
plen = pptr[0];
- if (plen < 0 || 32 < plen)
+ if (32 < plen)
return -1;
memset(&addr, 0, sizeof(addr));
@@ -411,7 +411,7 @@ decode_labeled_prefix4(const u_char *pptr, char *buf, u_int buflen)
plen-=24; /* adjust prefixlen - labellength */
- if (plen < 0 || 32 < plen)
+ if (32 < plen)
return -1;
memset(&addr, 0, sizeof(addr));
@@ -478,7 +478,7 @@ decode_labeled_vpn_prefix4(const u_char *pptr, char *buf, u_int buflen)
plen-=(24+64); /* adjust prefixlen - labellength - RD len*/
- if (plen < 0 || 32 < plen)
+ if (32 < plen)
return -1;
memset(&addr, 0, sizeof(addr));
diff --git a/print-cnfp.c b/print-cnfp.c
index b95087ed..02cef037 100644
--- a/print-cnfp.c
+++ b/print-cnfp.c
@@ -34,7 +34,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.9 2002-08-01 08:53:03 risso Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.10 2002-09-05 00:00:10 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -48,6 +48,8 @@ static const char rcsid[] =
#include "interface.h"
+#include "addrtoname.h"
+
#include "tcp.h"
struct nfhdr {
@@ -129,7 +131,7 @@ cnfp_print(const u_char *cp, u_int len, const u_char *bp)
snprintf(asbuf, sizeof(asbuf), ":%u",
(unsigned)(ntohl(nr->asses) >> 16) & 0xffff);
}
- printf("\n %s%s%s:%u ", inet_ntoa(nr->src_ina), buf, asbuf,
+ printf("\n %s%s%s:%u ", intoa(nr->src_ina.s_addr), buf, asbuf,
(unsigned)ntohl(nr->ports) >> 16);
if (ver == 5 || ver ==6) {
@@ -138,10 +140,10 @@ cnfp_print(const u_char *cp, u_int len, const u_char *bp)
snprintf(asbuf, sizeof(asbuf), ":%u",
(unsigned)ntohl(nr->asses) & 0xffff);
}
- printf("> %s%s%s:%u ", inet_ntoa(nr->dst_ina), buf, asbuf,
+ printf("> %s%s%s:%u ", intoa(nr->dst_ina.s_addr), buf, asbuf,
(unsigned)ntohl(nr->ports) & 0xffff);
- printf(">> %s\n ", inet_ntoa(nr->nhop_ina));
+ printf(">> %s\n ", intoa(nr->nhop_ina.s_addr));
pent = getprotobynumber((ntohl(nr->proto_tos) >> 8) & 0xff);
if (!pent || nflag)
diff --git a/print-domain.c b/print-domain.c
index 633cd622..ecb06eb3 100644
--- a/print-domain.c
+++ b/print-domain.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.79 2002-08-01 08:53:04 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.80 2002-09-05 00:00:11 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -152,7 +152,7 @@ ns_nprint(register const u_char *cp, register const u_char *bp)
int elt;
int data_size = snapend - bp;
- if ((l = labellen(cp)) < 0)
+ if ((l = labellen(cp)) == (u_int)-1)
return(NULL);
if (!TTEST2(*cp, 1))
return(NULL);
@@ -172,7 +172,7 @@ ns_nprint(register const u_char *cp, register const u_char *bp)
if (!TTEST2(*cp, 1))
return(NULL);
cp = bp + (((i << 8) | *cp) & 0x3fff);
- if ((l = labellen(cp)) < 0)
+ if ((l = labellen(cp)) == (u_int)-1)
return(NULL);
if (!TTEST2(*cp, 1))
return(NULL);
@@ -211,7 +211,7 @@ ns_nprint(register const u_char *cp, register const u_char *bp)
cp += l;
chars_processed += l;
putchar('.');
- if ((l = labellen(cp)) < 0)
+ if ((l = labellen(cp)) == (u_int)-1)
return(NULL);
if (!TTEST2(*cp, 1))
return(NULL);
diff --git a/print-dvmrp.c b/print-dvmrp.c
index 92738e3f..fcd1a31a 100644
--- a/print-dvmrp.c
+++ b/print-dvmrp.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-dvmrp.c,v 1.22 2002-08-01 08:53:05 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-dvmrp.c,v 1.23 2002-09-05 00:00:11 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -154,7 +154,8 @@ print_report(register const u_char *bp, register const u_char *ep,
register u_int len)
{
register u_int32_t mask, origin;
- register int metric, i, width, done;
+ register int metric, done;
+ register u_int i, width;
while (len > 0) {
if (len < 3) {
diff --git a/print-egp.c b/print-egp.c
index 1aa01c87..06fc4dae 100644
--- a/print-egp.c
+++ b/print-egp.c
@@ -20,7 +20,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.30 2002-08-01 08:53:05 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.31 2002-09-05 00:00:12 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -142,7 +142,7 @@ egpnrprint(register const struct egp_packet *egp, register u_int length)
register u_int netlen;
int gateways, distances, networks;
int t_gateways;
- char *comma;
+ const char *comma;
addr = egp->egp_sourcenet;
if (IN_CLASSA(addr)) {
diff --git a/print-esp.c b/print-esp.c
index 70d47308..636ff8ed 100644
--- a/print-esp.c
+++ b/print-esp.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.28 2002-08-01 08:53:05 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.29 2002-09-05 00:00:12 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -73,7 +73,7 @@ enum cipher { NONE,
struct esp_algorithm {
- char *name;
+ const char *name;
enum cipher algo;
int ivlen;
int authlen;
diff --git a/print-fr.c b/print-fr.c
index cb02782d..87fa4b2e 100644
--- a/print-fr.c
+++ b/print-fr.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.4 2002-08-01 08:53:07 risso Exp $ (LBL)";
+ "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.5 2002-09-05 00:00:12 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -52,10 +52,10 @@ static void q933_print(const u_char *, int);
#define FR_DLCI(b0, b1) ((((b0)&0xFC)<<2)+(((b1)&0xF0)>>4))
/* find out how many bytes are there in a frame */
-static int
+static u_int
fr_addr_len(const u_char *p)
{
- int i=0;
+ u_int i=0;
while (!FR_EA_BIT(p[i]) && i++ && !FR_EA_BIT(p[i+1])) i++;
return (i+1);
@@ -138,10 +138,10 @@ init_fr_nlpids(void)
#define FR_PROTOCOL(p) fr_protocol((p))
-static int
+static u_int
fr_hdrlen(const u_char *p)
{
- int hlen;
+ u_int hlen;
hlen = fr_addr_len(p)+1; /* addr_len + 0x03 + padding */
if (p[hlen])
return hlen;
@@ -371,7 +371,8 @@ q933_print(const u_char *p, int length)
struct q933_header *header = (struct q933_header *)(p+1);
const u_char *ptemp = p;
int ie_len;
- char *decode_str, temp_str[255];
+ const char *decode_str;
+ char temp_str[255];
struct common_ie_header *ie_p;
/* printing out header part */
diff --git a/print-ip.c b/print-ip.c
index 3f7482df..4a3c0af2 100644
--- a/print-ip.c
+++ b/print-ip.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.111 2002-08-01 08:53:10 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.112 2002-09-05 00:00:13 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -122,7 +122,7 @@ ip_printts(register const u_char *cp, u_int length)
register u_int ptr = cp[2] - 1;
register u_int len = 0;
int hoplen;
- char *type;
+ const char *type;
printf(" TS{");
hoplen = ((cp[3]&0xF) != IPOPT_TS_TSONLY) ? 8 : 4;
@@ -629,7 +629,7 @@ again:
if (vflag) {
u_int16_t sum, ip_sum;
- char *sep = "";
+ const char *sep = "";
if ((u_char *)ip + hlen <= snapend) {
sum = in_cksum((const u_short *)ip, hlen, 0);
diff --git a/print-isakmp.c b/print-isakmp.c
index 297a3c9e..2df29c23 100644
--- a/print-isakmp.c
+++ b/print-isakmp.c
@@ -30,7 +30,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.32 2002-08-01 08:53:13 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.33 2002-09-05 00:00:13 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -101,12 +101,12 @@ struct {
} cookiecache[MAXINITIATORS];
/* protocol id */
-static char *protoidstr[] = {
+static const char *protoidstr[] = {
NULL, "isakmp", "ipsec-ah", "ipsec-esp", "ipcomp",
};
/* isakmp->np */
-static char *npstr[] = {
+static const char *npstr[] = {
"none", "sa", "p", "t", "ke", "id", "cert", "cr", "hash",
"sig", "nonce", "n", "d", "vid"
};
@@ -131,7 +131,7 @@ static u_char *(*npfunc[])(struct isakmp_gen *, u_char *, u_int32_t,
};
/* isakmp->etype */
-static char *etypestr[] = {
+static const char *etypestr[] = {
"none", "base", "ident", "auth", "agg", "inf", NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -325,7 +325,7 @@ static void
rawprint(caddr_t loc, size_t len)
{
static u_char *p;
- int i;
+ size_t i;
p = (u_char *)loc;
for (i = 0; i < len; i++)
@@ -333,9 +333,9 @@ rawprint(caddr_t loc, size_t len)
}
struct attrmap {
- char *type;
- int nvalue;
- char *value[30]; /*XXX*/
+ const char *type;
+ u_int nvalue;
+ const char *value[30]; /*XXX*/
};
static u_char *
@@ -485,40 +485,40 @@ isakmp_p_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
return cp;
}
-static char *isakmp_p_map[] = {
+static const char *isakmp_p_map[] = {
NULL, "ike",
};
-static char *ah_p_map[] = {
+static const char *ah_p_map[] = {
NULL, "(reserved)", "md5", "sha", "1des",
"sha2-256", "sha2-384", "sha2-512",
};
-static char *esp_p_map[] = {
+static const char *esp_p_map[] = {
NULL, "1des-iv64", "1des", "3des", "rc5", "idea", "cast",
"blowfish", "3idea", "1des-iv32", "rc4", "null", "aes"
};
-static char *ipcomp_p_map[] = {
+static const char *ipcomp_p_map[] = {
NULL, "oui", "deflate", "lzs",
};
struct attrmap ipsec_t_map[] = {
- { NULL, 0, },
+ { NULL, 0, { NULL } },
{ "lifetype", 3, { NULL, "sec", "kb", }, },
- { "life", 0, },
+ { "life", 0, { NULL } },
{ "group desc", 5, { NULL, "modp768", "modp1024", "EC2N 2^155",
"EC2N 2^185", }, },
{ "enc mode", 3, { NULL, "tunnel", "transport", }, },
{ "auth", 5, { NULL, "hmac-md5", "hmac-sha1", "1des-mac", "keyed", }, },
- { "keylen", 0, },
- { "rounds", 0, },
- { "dictsize", 0, },
- { "privalg", 0, },
+ { "keylen", 0, { NULL } },
+ { "rounds", 0, { NULL } },
+ { "dictsize", 0, { NULL } },
+ { "privalg", 0, { NULL } },
};
struct attrmap oakley_t_map[] = {
- { NULL, 0 },
+ { NULL, 0, { NULL } },
{ "enc", 8, { NULL, "1des", "idea", "blowfish", "rc5",
"3des", "cast", "aes", }, },
{ "hash", 7, { NULL, "md5", "sha1", "tiger",
@@ -528,17 +528,17 @@ struct attrmap oakley_t_map[] = {
{ "group desc", 5, { NULL, "modp768", "modp1024", "EC2N 2^155",
"EC2N 2^185", }, },
{ "group type", 4, { NULL, "MODP", "ECP", "EC2N", }, },
- { "group prime", 0, },
- { "group gen1", 0, },
- { "group gen2", 0, },
- { "group curve A", 0, },
- { "group curve B", 0, },
+ { "group prime", 0, { NULL } },
+ { "group gen1", 0, { NULL } },
+ { "group gen2", 0, { NULL } },
+ { "group curve A", 0, { NULL } },
+ { "group curve B", 0, { NULL } },
{ "lifetype", 3, { NULL, "sec", "kb", }, },
- { "lifeduration", 0, },
- { "prf", 0, },
- { "keylen", 0, },
- { "field", 0, },
- { "order", 0, },
+ { "lifeduration", 0, { NULL } },
+ { "prf", 0, { NULL } },
+ { "keylen", 0, { NULL } },
+ { "field", 0, { NULL } },
+ { "order", 0, { NULL } },
};
static u_char *
@@ -547,7 +547,7 @@ isakmp_t_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
{
struct isakmp_pl_t *p, t;
u_char *cp;
- char *idstr;
+ const char *idstr;
struct attrmap *map;
size_t nmap;
u_char *ep2;
@@ -626,10 +626,10 @@ isakmp_id_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
{
#define USE_IPSECDOI_IN_PHASE1 1
struct isakmp_pl_id *p, id;
- static char *idtypestr[] = {
+ static const char *idtypestr[] = {
"IPv4", "IPv4net", "IPv6", "IPv6net",
};
- static char *ipsecidtypestr[] = {
+ static const char *ipsecidtypestr[] = {
NULL, "IPv4", "FQDN", "user FQDN", "IPv4net", "IPv6",
"IPv6net", "IPv4range", "IPv6range", "ASN1 DN", "ASN1 GN",
"keyid",
@@ -765,7 +765,7 @@ isakmp_cert_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
u_int32_t doi0, u_int32_t proto0)
{
struct isakmp_pl_cert *p, cert;
- static char *certstr[] = {
+ static const char *certstr[] = {
"none", "pkcs7", "pgp", "dns",
"x509sign", "x509ke", "kerberos", "crl",
"arl", "spki", "x509attr",
@@ -789,7 +789,7 @@ isakmp_cr_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
u_int32_t doi0, u_int32_t proto0)
{
struct isakmp_pl_cert *p, cert;
- static char *certstr[] = {
+ static const char *certstr[] = {
"none", "pkcs7", "pgp", "dns",
"x509sign", "x509ke", "kerberos", "crl",
"arl", "spki", "x509attr",
@@ -868,7 +868,7 @@ isakmp_n_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
u_char *ep2;
u_int32_t doi;
u_int32_t proto;
- static char *notifystr[] = {
+ static const char *notify_error_str[] = {
NULL, "INVALID-PAYLOAD-TYPE",
"DOI-NOT-SUPPORTED", "SITUATION-NOT-SUPPORTED",
"INVALID-COOKIE", "INVALID-MAJOR-VERSION",
@@ -886,15 +886,33 @@ isakmp_n_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
"CERTIFICATE-UNAVAILABLE", "UNSUPPORTED-EXCHANGE-TYPE",
"UNEQUAL-PAYLOAD-LENGTHS",
};
- static char *ipsecnotifystr[] = {
+ static const char *ipsec_notify_error_str[] = {
+ "RESERVED",
+ };
+ static const char *notify_status_str[] = {
+ "CONNECTED",
+ };
+ static const char *ipsec_notify_status_str[] = {
"RESPONDER-LIFETIME", "REPLAY-STATUS",
"INITIAL-CONTACT",
};
/* NOTE: these macro must be called with x in proper range */
-#define NOTIFYSTR(x) \
- (((x) == 16384) ? "CONNECTED" : STR_OR_ID((x), notifystr))
-#define IPSECNOTIFYSTR(x) \
- (((x) == 8192) ? "RESERVED" : STR_OR_ID(((x) - 24576), ipsecnotifystr))
+
+/* 0 - 8191 */
+#define NOTIFY_ERROR_STR(x) \
+ STR_OR_ID((x), notify_error_str)
+
+/* 8192 - 16383 */
+#define IPSEC_NOTIFY_ERROR_STR(x) \
+ STR_OR_ID((u_int)((x) - 8192), ipsec_notify_error_str)
+
+/* 16384 - 24575 */
+#define NOTIFY_STATUS_STR(x) \
+ STR_OR_ID((u_int)((x) - 16384), notify_status_str)
+
+/* 24576 - 32767 */
+#define IPSEC_NOTIFY_STATUS_STR(x) \
+ STR_OR_ID((u_int)((x) - 24576), ipsec_notify_status_str)
printf("%s:", NPSTR(ISAKMP_NPTYPE_N));
@@ -905,7 +923,14 @@ isakmp_n_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
if (doi != 1) {
printf(" doi=%d", doi);
printf(" proto=%d", proto);
- printf(" type=%s", NOTIFYSTR(ntohs(n.type)));
+ if (ntohs(n.type) < 8192)
+ printf(" type=%s", NOTIFY_ERROR_STR(ntohs(n.type)));
+ else if (ntohs(n.type) < 16384)
+ printf(" type=%s", numstr(ntohs(n.type)));
+ else if (ntohs(n.type) < 24576)
+ printf(" type=%s", NOTIFY_STATUS_STR(ntohs(n.type)));
+ else
+ printf(" type=%s", numstr(ntohs(n.type)));
if (n.spi_size) {
printf(" spi=");
rawprint((caddr_t)(p + 1), n.spi_size);
@@ -916,15 +941,15 @@ isakmp_n_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
printf(" doi=ipsec");
printf(" proto=%s", PROTOIDSTR(proto));
if (ntohs(n.type) < 8192)
- printf(" type=%s", NOTIFYSTR(ntohs(n.type)));
+ printf(" type=%s", NOTIFY_ERROR_STR(ntohs(n.type)));
else if (ntohs(n.type) < 16384)
- printf(" type=%s", IPSECNOTIFYSTR(ntohs(n.type)));
+ printf(" type=%s", IPSEC_NOTIFY_ERROR_STR(ntohs(n.type)));
else if (ntohs(n.type) < 24576)
- printf(" type=%s", NOTIFYSTR(ntohs(n.type)));
- else if (ntohs(n.type) < 40960)
- printf(" type=%s", IPSECNOTIFYSTR(ntohs(n.type)));
+ printf(" type=%s", NOTIFY_STATUS_STR(ntohs(n.type)));
+ else if (ntohs(n.type) < 32768)
+ printf(" type=%s", IPSEC_NOTIFY_STATUS_STR(ntohs(n.type)));
else
- printf(" type=%s", NOTIFYSTR(ntohs(n.type)));
+ printf(" type=%s", numstr(ntohs(n.type)));
if (n.spi_size) {
printf(" spi=");
rawprint((caddr_t)(p + 1), n.spi_size);
diff --git a/print-isoclns.c b/print-isoclns.c
index 922c084f..4d65f7c9 100644
--- a/print-isoclns.c
+++ b/print-isoclns.c
@@ -26,7 +26,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.60 2002-09-03 14:21:42 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.61 2002-09-05 00:00:14 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -806,7 +806,7 @@ isis_print_tlv_ip_reach (const u_char *cp, int length)
tlv_ip_reach = (const struct isis_tlv_ip_reach *)cp;
while (length > 0) {
- if (length < sizeof(*tlv_ip_reach)) {
+ if ((size_t)length < sizeof(*tlv_ip_reach)) {
printf("short IPv4 reachability (%d vs %lu)", length,
(unsigned long)sizeof(*tlv_ip_reach));
return (0);
diff --git a/print-l2tp.c b/print-l2tp.c
index b8087fcd..5ce40b64 100644
--- a/print-l2tp.c
+++ b/print-l2tp.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-l2tp.c,v 1.13 2002-08-01 08:53:15 risso Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-l2tp.c,v 1.14 2002-09-05 00:00:14 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -244,7 +244,7 @@ static char *l2tp_error_code_general[] = {
static void
print_string(const u_char *dat, u_int length)
{
- int i;
+ u_int i;
for (i=0; i<length; i++) {
printf("%c", *dat++);
}
@@ -253,7 +253,7 @@ print_string(const u_char *dat, u_int length)
static void
print_octets(const u_char *dat, u_int length)
{
- int i;
+ u_int i;
for (i=0; i<length; i++) {
printf("%02x", *dat++);
}
diff --git a/print-llc.c b/print-llc.c
index 2e99a0c0..73a0ee72 100644
--- a/print-llc.c
+++ b/print-llc.c
@@ -24,7 +24,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.48 2002-08-01 08:53:17 risso Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.49 2002-09-05 00:00:15 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -265,7 +265,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
}
if ((control & LLC_S_FMT) == LLC_S_FMT) {
- static char *llc_s[] = { "rr", "rej", "rnr", "03" };
+ static const char *llc_s[] = { "rr", "rej", "rnr", "03" };
(void)printf("%s (r=%d,%c)",
llc_s[LLC_S_CMD(control)],
LLC_IS_NR(control),
diff --git a/print-lwres.c b/print-lwres.c
index 0ca637d5..828905c8 100644
--- a/print-lwres.c
+++ b/print-lwres.c
@@ -29,7 +29,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-lwres.c,v 1.6 2002-08-01 08:53:18 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-lwres.c,v 1.7 2002-09-05 00:00:15 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -196,7 +196,7 @@ static int
lwres_printname(size_t l, const char *p0)
{
const char *p;
- int i;
+ size_t i;
p = p0;
/* + 1 for terminating \0 */
@@ -420,9 +420,10 @@ lwres_print(register const u_char *bp, u_int length)
printf(" %s", tok2str(ns_type2str, "Type%d",
ntohs(grbn->rdtype)));
- if (ntohs(grbn->rdclass) != C_IN);
+ if (ntohs(grbn->rdclass) != C_IN) {
printf(" %s", tok2str(ns_class2str, "Class%d",
ntohs(grbn->rdclass)));
+ }
/* XXX grbn points to packed struct */
s = (const char *)&grbn->namelen +
@@ -446,7 +447,7 @@ lwres_print(register const u_char *bp, u_int length)
lwres_gnbaresponse_t *gnba;
lwres_grbnresponse_t *grbn;
u_int32_t l, na;
- int i;
+ u_int32_t i;
gabn = NULL;
gnba = NULL;
@@ -538,9 +539,10 @@ lwres_print(register const u_char *bp, u_int length)
printf(" %s", tok2str(ns_type2str, "Type%d",
ntohs(grbn->rdtype)));
- if (ntohs(grbn->rdclass) != C_IN);
+ if (ntohs(grbn->rdclass) != C_IN) {
printf(" %s", tok2str(ns_class2str, "Class%d",
ntohs(grbn->rdclass)));
+ }
printf(" TTL ");
relts_print(ntohl(grbn->ttl));
printf(" %u/%u", ntohs(grbn->nrdatas),
diff --git a/print-msdp.c b/print-msdp.c
index 0d97f890..cf21f3f4 100644
--- a/print-msdp.c
+++ b/print-msdp.c
@@ -17,7 +17,7 @@
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-msdp.c,v 1.3 2002-08-01 08:53:20 risso Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-msdp.c,v 1.4 2002-09-05 00:00:16 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -52,7 +52,7 @@ msdp_print(const unsigned char *sp, u_int length)
type = *sp;
len = EXTRACT_16BITS(sp + 1);
if (len > 1400 || vflag)
- printf(" [len %d]", len);
+ printf(" [len %u]", len);
if (len < 3)
goto trunc;
sp += 3;
@@ -65,8 +65,8 @@ msdp_print(const unsigned char *sp, u_int length)
else
(void)printf(" SA-Response");
TCHECK(*sp);
- (void)printf(" %d entries", *sp);
- if (*sp * 12 + 8 < len) {
+ (void)printf(" %u entries", *sp);
+ if ((u_int)((*sp * 12) + 8) < len) {
(void)printf(" [w/data]");
if (vflag > 1) {
(void)printf(" ");
diff --git a/print-nfs.c b/print-nfs.c
index 6719f3db..7cff4c1e 100644
--- a/print-nfs.c
+++ b/print-nfs.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.96 2002-08-26 09:36:20 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.97 2002-09-05 00:00:16 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -764,7 +764,7 @@ nfs_printfh(register const u_int32_t *dp, const u_int len)
char *spacep;
if (uflag) {
- int i;
+ u_int i;
char const *sep = "";
printf(" fh[");
diff --git a/print-pim.c b/print-pim.c
index eb638f5a..dc714a2c 100644
--- a/print-pim.c
+++ b/print-pim.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.32 2002-08-01 08:53:23 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.33 2002-09-05 00:00:16 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -122,7 +122,7 @@ pimv1_join_prune_print(register const u_char *bp, register u_int len)
bp += 12;
len -= 12;
for (njp = 0; njp < (njoin + nprune); njp++) {
- char *type;
+ const char *type;
if (njp < njoin)
type = "Join ";
@@ -442,7 +442,7 @@ static int
pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent)
{
int af;
- char *afstr;
+ const char *afstr;
int len, hdrlen;
TCHECK(bp[0]);
diff --git a/print-ppp.c b/print-ppp.c
index 8bb9d36e..3427cdaa 100644
--- a/print-ppp.c
+++ b/print-ppp.c
@@ -31,7 +31,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.68 2002-08-01 08:53:24 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.69 2002-09-05 00:00:17 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -80,7 +80,6 @@ static const char rcsid[] =
#define CPCODES_RESET_REQ 14 /* Reset-Request (CCP only) */
#define CPCODES_RESET_REP 15 /* Reset-Reply (CCP only) */
-#define CPCODES_MIN CPCODES_VEXT
#define CPCODES_MAX CPCODES_RESET_REP
static const char *cpcodes[] = {
@@ -387,7 +386,7 @@ handle_ctrl_proto(u_int proto, const u_char *p, int length)
}
code = *p;
- if ((code >= CPCODES_MIN) && (code <= CPCODES_MAX))
+ if (code <= CPCODES_MAX)
printf("%s", cpcodes[code]);
else {
printf("0x%02x", code);
diff --git a/print-pptp.c b/print-pptp.c
index 585b2f94..f5026455 100644
--- a/print-pptp.c
+++ b/print-pptp.c
@@ -24,7 +24,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-pptp.c,v 1.5 2002-08-01 08:53:25 risso Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-pptp.c,v 1.6 2002-09-05 00:00:17 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -73,7 +73,7 @@ static char tstr[] = " [|pptp]";
#define PPTP_BEARER_CAP_ANALOG_MASK 0x00000001 /* Analog */
#define PPTP_BEARER_CAP_DIGITAL_MASK 0x00000002 /* Digital */
-static char *pptp_message_type_string[] = {
+static const char *pptp_message_type_string[] = {
"NOT_DEFINED", /* 0 Not defined in the RFC2637 */
"SCCRQ", /* 1 Start-Control-Connection-Request */
"SCCRP", /* 2 Start-Control-Connection-Reply */
diff --git a/print-radius.c b/print-radius.c
index acb88125..21314e09 100644
--- a/print-radius.c
+++ b/print-radius.c
@@ -44,7 +44,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: print-radius.c,v 1.15 2002-08-06 04:42:06 guy Exp $";
+ "$Id: print-radius.c,v 1.16 2002-09-05 00:00:18 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -319,7 +319,7 @@ static const char *prompt[]={ "No Echo",
};
-struct attrtype { char *name; /* Attribute name */
+struct attrtype { const char *name; /* Attribute name */
const char **subtypes; /* Standard Values (if any) */
u_char siz_subtypes; /* Size of total standard values */
u_char first_subtype; /* First standard value is 0 or 1 */
@@ -519,12 +519,12 @@ print_attr_num(register u_char *data, u_int length, u_short attr_code )
{
data_value = EXTRACT_32BITS(data);
}
- if ( data_value <= (attr_type[attr_code].siz_subtypes - 1 +
+ if ( data_value <= (u_int32_t)(attr_type[attr_code].siz_subtypes - 1 +
attr_type[attr_code].first_subtype) &&
data_value >= attr_type[attr_code].first_subtype )
printf("{%s}",table[data_value]);
else
- printf("{#%d}",data_value);
+ printf("{#%u}",data_value);
}
else
{
@@ -804,10 +804,17 @@ void
radius_print(const u_char *dat, u_int length)
{
register const struct radius_hdr *rad;
- register int i;
- int len;
+ register u_int i;
+ u_int len;
- i = min(length, snapend - dat);
+ if (snapend < dat)
+ {
+ printf(" [|radius]");
+ return;
+ }
+ i = snapend - dat;
+ if (i > length)
+ i = length;
if (i < MIN_RADIUS_LEN)
{
@@ -832,46 +839,46 @@ radius_print(const u_char *dat, u_int length)
switch (rad->code)
{
case RADCMD_ACCESS_REQ:
- printf(" rad-access-req %d", length);
+ printf(" rad-access-req %u", length);
break;
case RADCMD_ACCESS_ACC:
- printf(" rad-access-accept %d", length);
+ printf(" rad-access-accept %u", length);
break;
case RADCMD_ACCESS_REJ:
- printf(" rad-access-reject %d", length);
+ printf(" rad-access-reject %u", length);
break;
case RADCMD_ACCOUN_REQ:
- printf(" rad-account-req %d", length);
+ printf(" rad-account-req %u", length);
break;
case RADCMD_ACCOUN_RES:
- printf(" rad-account-resp %d", length);
+ printf(" rad-account-resp %u", length);
break;
case RADCMD_ACCESS_CHA:
- printf(" rad-access-cha %d", length);
+ printf(" rad-access-cha %u", length);
break;
case RADCMD_STATUS_SER:
- printf(" rad-status-serv %d", length);
+ printf(" rad-status-serv %u", length);
break;
case RADCMD_STATUS_CLI:
- printf(" rad-status-cli %d", length);
+ printf(" rad-status-cli %u", length);
break;
case RADCMD_RESERVED:
- printf(" rad-reserved %d", length);
+ printf(" rad-reserved %u", length);
break;
default:
- printf(" rad-#%d %d", rad->code, length);
+ printf(" rad-#%u %u", rad->code, length);
break;
}
- printf(" [id %d]", rad->id);
+ printf(" [id %u]", rad->id);
if (i)
radius_attr_print( dat + MIN_RADIUS_LEN, i);
diff --git a/print-rip.c b/print-rip.c
index 9b0cfb15..5b2220e6 100644
--- a/print-rip.c
+++ b/print-rip.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-rip.c,v 1.50 2002-08-01 08:53:26 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-rip.c,v 1.51 2002-09-05 00:00:18 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -154,13 +154,21 @@ rip_print(const u_char *dat, u_int length)
{
register const struct rip *rp;
register const struct rip_netinfo *ni;
- register int i, j, trunc;
+ register u_int i, j;
+ register int trunc;
- i = min(length, snapend - dat) - sizeof(*rp);
- if (i < 0) {
+ if (snapend < dat) {
printf(" [|rip]");
return;
}
+ i = snapend - dat;
+ if (i > length)
+ i = length;
+ if (i < sizeof(*rp)) {
+ printf(" [|rip]");
+ return;
+ }
+ i -= sizeof(*rp);
rp = (struct rip *)dat;
switch (rp->rip_vers) {
@@ -190,7 +198,7 @@ rip_print(const u_char *dat, u_int length)
break;
case RIPCMD_RESPONSE:
j = length / sizeof(*ni);
- if (j * sizeof(*ni) != length - 4)
+ if (j * sizeof(*ni) + 4 != length)
printf(" RIPv%d-resp [items %d] [%d]:",
rp->rip_vers, j, length);
else
@@ -198,11 +206,12 @@ rip_print(const u_char *dat, u_int length)
rp->rip_vers, j);
trunc = (i / sizeof(*ni)) != j;
ni = (struct rip_netinfo *)(rp + 1);
- for (; (i -= sizeof(*ni)) >= 0; ++ni) {
+ for (; i >= sizeof(*ni); ++ni) {
if (rp->rip_vers == 1)
rip_entry_print_v1(rp->rip_vers, ni);
else
rip_entry_print_v2(rp->rip_vers, ni);
+ i -= sizeof(*ni);
}
if (trunc)
printf("[|rip]");
diff --git a/print-rx.c b/print-rx.c
index 1a18124e..20ea3b33 100644
--- a/print-rx.c
+++ b/print-rx.c
@@ -34,7 +34,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.32 2002-08-06 04:42:06 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.33 2002-09-05 00:00:19 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -71,7 +71,7 @@ static struct tok rx_types[] = {
static struct double_tok {
int flag; /* Rx flag */
int packetType; /* Packet type */
- char *s; /* Flag string */
+ const char *s; /* Flag string */
} rx_flags[] = {
{ RX_CLIENT_INITIATED, 0, "client-init" },
{ RX_REQUEST_ACK, 0, "req-ack" },
@@ -343,7 +343,7 @@ static struct tok ubik_lock_types[] = {
{ 0, NULL },
};
-static char *voltype[] = { "read-write", "read-only", "backup" };
+static const char *voltype[] = { "read-write", "read-only", "backup" };
static struct tok afs_fs_errors[] = {
{ 101, "salvage volume" },
@@ -438,7 +438,7 @@ rx_print(register const u_char *bp, int length, int sport, int dport,
int i;
int32_t opcode;
- if (snapend - bp < sizeof (struct rx_header)) {
+ if (snapend - bp < (int)sizeof (struct rx_header)) {
printf(" [|rx] (%d)", length);
return;
}
@@ -592,7 +592,7 @@ rx_cache_insert(const u_char *bp, const struct ip *ip, int dport,
struct rx_cache_entry *rxent;
const struct rx_header *rxh = (const struct rx_header *) bp;
- if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t))
+ if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t)))
return;
rxent = &rx_cache[rx_cache_next];
@@ -775,7 +775,7 @@ ack_print(register const u_char *bp, int length)
if (vflag <= 1)
return;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
bp += sizeof(struct rx_header);
@@ -845,10 +845,10 @@ fs_print(register const u_char *bp, int length)
int fs_op;
unsigned long i;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
- if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) {
+ if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) {
goto trunc;
}
@@ -996,7 +996,7 @@ fs_reply_print(register const u_char *bp, int length, int32_t opcode)
unsigned long i;
struct rx_header *rxh;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
rxh = (struct rx_header *) bp;
@@ -1160,10 +1160,10 @@ cb_print(register const u_char *bp, int length)
int cb_op;
unsigned long i;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
- if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) {
+ if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) {
goto trunc;
}
@@ -1241,7 +1241,7 @@ cb_reply_print(register const u_char *bp, int length, int32_t opcode)
{
struct rx_header *rxh;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
rxh = (struct rx_header *) bp;
@@ -1291,10 +1291,10 @@ prot_print(register const u_char *bp, int length)
unsigned long i;
int pt_op;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
- if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) {
+ if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) {
goto trunc;
}
@@ -1433,7 +1433,7 @@ prot_reply_print(register const u_char *bp, int length, int32_t opcode)
struct rx_header *rxh;
unsigned long i;
- if (length < sizeof(struct rx_header))
+ if (length < (int)sizeof(struct rx_header))
return;
rxh = (struct rx_header *) bp;
@@ -1545,10 +1545,10 @@ vldb_print(register const u_char *bp, int length)
int vldb_op;
unsigned long i;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
- if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) {
+ if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) {
goto trunc;
}
@@ -1638,7 +1638,7 @@ vldb_reply_print(register const u_char *bp, int length, int32_t opcode)
struct rx_header *rxh;
unsigned long i;
- if (length < sizeof(struct rx_header))
+ if (length < (int)sizeof(struct rx_header))
return;
rxh = (struct rx_header *) bp;
@@ -1687,7 +1687,7 @@ vldb_reply_print(register const u_char *bp, int length, int32_t opcode)
TCHECK2(bp[0], sizeof(int32_t));
if (i < nservers)
printf(" %s",
- inet_ntoa(*((struct in_addr *) bp)));
+ intoa(((struct in_addr *) bp)->s_addr));
bp += sizeof(int32_t);
}
printf(" partitions");
@@ -1734,7 +1734,7 @@ vldb_reply_print(register const u_char *bp, int length, int32_t opcode)
TCHECK2(bp[0], sizeof(int32_t));
if (i < nservers)
printf(" %s",
- inet_ntoa(*((struct in_addr *) bp)));
+ intoa(((struct in_addr *) bp)->s_addr));
bp += sizeof(int32_t);
}
printf(" partitions");
@@ -1824,10 +1824,10 @@ kauth_print(register const u_char *bp, int length)
{
int kauth_op;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
- if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) {
+ if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) {
goto trunc;
}
@@ -1917,7 +1917,7 @@ kauth_reply_print(register const u_char *bp, int length, int32_t opcode)
{
struct rx_header *rxh;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
rxh = (struct rx_header *) bp;
@@ -1968,10 +1968,10 @@ vol_print(register const u_char *bp, int length)
{
int vol_op;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
- if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) {
+ if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) {
goto trunc;
}
@@ -2006,7 +2006,7 @@ vol_reply_print(register const u_char *bp, int length, int32_t opcode)
{
struct rx_header *rxh;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
rxh = (struct rx_header *) bp;
@@ -2050,10 +2050,10 @@ bos_print(register const u_char *bp, int length)
{
int bos_op;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
- if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) {
+ if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) {
goto trunc;
}
@@ -2141,7 +2141,7 @@ bos_reply_print(register const u_char *bp, int length, int32_t opcode)
{
struct rx_header *rxh;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
rxh = (struct rx_header *) bp;
@@ -2308,7 +2308,7 @@ ubik_reply_print(register const u_char *bp, int length, int32_t opcode)
{
struct rx_header *rxh;
- if (length < sizeof(struct rx_header))
+ if (length < (int)sizeof(struct rx_header))
return;
rxh = (struct rx_header *) bp;
@@ -2372,7 +2372,7 @@ rx_ack_print(register const u_char *bp, int length)
struct rx_ackPacket *rxa;
int i, start, last;
- if (length < sizeof(struct rx_header))
+ if (length < (int)sizeof(struct rx_header))
return;
bp += sizeof(struct rx_header);
diff --git a/print-smb.c b/print-smb.c
index 989ffbdd..058bf0e6 100644
--- a/print-smb.c
+++ b/print-smb.c
@@ -12,7 +12,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.25 2002-08-01 08:53:29 risso Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.26 2002-09-05 00:00:20 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
@@ -384,25 +384,26 @@ trunc:
static void
print_negprot(const u_char *words, const u_char *data, const u_char *buf, const u_char *maxbuf)
{
+ u_int wcnt;
const char *f1 = NULL, *f2 = NULL;
TCHECK(words[0]);
+ wcnt = words[0];
if (request)
f2 = "*|Dialect=[Z]\n";
else {
- if (words[0] == 1)
+ if (wcnt == 1)
f1 = "Core Protocol\nDialectIndex=[d]";
- else if (words[0] == 17)
+ else if (wcnt == 17)
f1 = "NT1 Protocol\nDialectIndex=[d]\nSecMode=[B]\nMaxMux=[d]\nNumVcs=[d]\nMaxBuffer=[D]\nRawSize=[D]\nSessionKey=[W]\nCapabilities=[W]\nServerTime=[T3]TimeZone=[d]\nCryptKey=";
- else if (words[0] == 13)
+ else if (wcnt == 13)
f1 = "Coreplus/Lanman1/Lanman2 Protocol\nDialectIndex=[d]\nSecMode=[w]\nMaxXMit=[d]\nMaxMux=[d]\nMaxVcs=[d]\nBlkMode=[w]\nSessionKey=[W]\nServerTime=[T1]TimeZone=[d]\nRes=[W]\nCryptKey=";
}
if (f1)
- smb_fdata(words + 1, f1, SMBMIN(words + 1 + words[0] * 2, maxbuf));
+ smb_fdata(words + 1, f1, SMBMIN(words + 1 + wcnt * 2, maxbuf));
else
- print_data(words + 1, SMBMIN(words[0] * 2,
- PTR_DIFF(maxbuf, words + 1)));
+ print_data(words + 1, SMBMIN(wcnt * 2, PTR_DIFF(maxbuf, words + 1)));
TCHECK2(*data, 2);
if (f2)
@@ -418,7 +419,7 @@ trunc:
static void
print_sesssetup(const u_char *words, const u_char *data, const u_char *buf, const u_char *maxbuf)
{
- int wcnt;
+ u_int wcnt;
const char *f1 = NULL, *f2 = NULL;
TCHECK(words[0]);
@@ -429,19 +430,18 @@ print_sesssetup(const u_char *words, const u_char *data, const u_char *buf, cons
else
f1 = "Com2=[B]\nRes1=[B]\nOff2=[d]\nMaxBuffer=[d]\nMaxMpx=[d]\nVcNumber=[d]\nSessionKey=[W]\nCaseInsensitivePasswordLength=[d]\nCaseSensitivePasswordLength=[d]\nRes=[W]\nCapabilities=[W]\nPass1&Pass2&Account&Domain&OS&LanMan=\n";
} else {
- if (words[0] == 3) {
+ if (wcnt == 3) {
f1 = "Com2=[w]\nOff2=[d]\nAction=[w]\n";
- } else if (words[0] == 13) {
+ } else if (wcnt == 13) {
f1 = "Com2=[B]\nRes=[B]\nOff2=[d]\nAction=[w]\n";
f2 = "NativeOS=[S]\nNativeLanMan=[S]\nPrimaryDomain=[S]\n";
}
}
if (f1)
- smb_fdata(words + 1, f1, SMBMIN(words + 1 + words[0] * 2, maxbuf));
+ smb_fdata(words + 1, f1, SMBMIN(words + 1 + wcnt * 2, maxbuf));
else
- print_data(words + 1, SMBMIN(words[0] * 2,
- PTR_DIFF(maxbuf, words + 1)));
+ print_data(words + 1, SMBMIN(wcnt * 2, PTR_DIFF(maxbuf, words + 1)));
TCHECK2(*data, 2);
if (f2)
@@ -539,7 +539,7 @@ static struct smbfns smb_fns[] = {
{ pSETDIR, "SMBsetdir", 0, { NULL, "Path=[Z]\n", NULL, NULL, NULL } },
{ SMBlseek, "SMBlseek", 0,
- { "Handle=[d]\nMode=[w]\nOffset=[D]\n", "Offset=[D]\n", NULL, NULL } },
+ { "Handle=[d]\nMode=[w]\nOffset=[D]\n", "Offset=[D]\n", NULL, NULL, NULL } },
{ SMBflush, "SMBflush", 0, { "Handle=[d]\n", NULL, NULL, NULL, NULL } },
@@ -717,7 +717,7 @@ static struct smbfns smb_fns[] = {
{ "Com2=[w]\nOff2=[d]\nRes=[b]\nNameLen=[d]\nFlags=[W]\nRootDirectoryFid=[D]\nAccessMask=[W]\nAllocationSize=[L]\nExtFileAttributes=[W]\nShareAccess=[W]\nCreateDisposition=[W]\nCreateOptions=[W]\nImpersonationLevel=[W]\nSecurityFlags=[b]\n",
"Path=[S]\n",
"Com2=[w]\nOff2=[d]\nOplockLevel=[b]\nFid=[d]\nCreateAction=[W]\nCreateTime=[T3]LastAccessTime=[T3]LastWriteTime=[T3]ChangeTime=[T3]ExtFileAttributes=[W]\nAllocationSize=[L]\nEndOfFile=[L]\nFileType=[w]\nDeviceState=[w]\nDirectory=[b]\n",
- NULL } },
+ NULL, NULL } },
{ SMBntcancel, "SMBntcancel", 0, DEFDESCRIPT },
@@ -734,7 +734,7 @@ print_smb(const u_char *buf, const u_char *maxbuf)
int command;
const u_char *words, *data;
struct smbfns *fn;
- char *fmt_smbheader =
+ const char *fmt_smbheader =
"[P4]SMB Command = [B]\nError class = [BP1]\nError code = [d]\nFlags1 = [B]\nFlags2 = [B][P13]\nTree ID = [d]\nProc ID = [d]\nUID = [d]\nMID = [d]\nWord Count = [b]\n";
@@ -765,7 +765,7 @@ print_smb(const u_char *buf, const u_char *maxbuf)
for (;;) {
const char *f1, *f2;
int wct;
- int bcc;
+ u_int bcc;
TCHECK(words[0]);
wct = words[0];
@@ -806,7 +806,7 @@ print_smb(const u_char *buf, const u_char *maxbuf)
smb_fdata(data + 2, f2, data + 2 + bcc);
}
} else {
- printf("smb_bcc=%d\n", bcc);
+ printf("smb_bcc=%u\n", bcc);
if (bcc > 0) {
printf("smb_buf[]=\n");
print_data(data + 2, SMBMIN(bcc, PTR_DIFF(maxbuf, data + 2)));
@@ -847,7 +847,7 @@ nbt_tcp_print(const u_char *data, int length)
{
const u_char *maxbuf = data + length;
int flags;
- int nbt_len;
+ u_int nbt_len;
TCHECK2(data[2], 2);
flags = data[0];
@@ -949,7 +949,7 @@ nbt_udp137_print(const u_char *data, int length)
const u_char *maxbuf = data + length;
int name_trn_id, response, opcode, nm_flags, rcode;
int qdcount, ancount, nscount, arcount;
- char *opcodestr;
+ const char *opcodestr;
const u_char *p;
int total, i;
diff --git a/print-snmp.c b/print-snmp.c
index 634ffdbe..46e23d51 100644
--- a/print-snmp.c
+++ b/print-snmp.c
@@ -58,7 +58,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.55 2002-08-01 08:53:30 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.56 2002-09-05 00:00:21 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -81,7 +81,7 @@ static const char rcsid[] =
* Universal ASN.1 types
* (we only care about the tag values for those allowed in the Internet SMI)
*/
-char *Universal[] = {
+const char *Universal[] = {
"U-0",
"Boolean",
"Integer",
@@ -104,7 +104,7 @@ char *Universal[] = {
/*
* Application-wide ASN.1 types from the Internet SMI and their tags
*/
-char *Application[] = {
+const char *Application[] = {
"IpAddress",
#define IPADDR 0
"Counter",
@@ -123,7 +123,7 @@ char *Application[] = {
/*
* Context-specific ASN.1 types for the SNMP PDUs and their tags
*/
-char *Context[] = {
+const char *Context[] = {
"GetRequest",
#define GETREQ 0
"GetNextRequest",
@@ -153,7 +153,7 @@ char *Context[] = {
/*
* Context-specific ASN.1 types for the SNMP Exceptions and their tags
*/
-char *Exceptions[] = {
+const char *Exceptions[] = {
"noSuchObject",
#define NOSUCHOBJECT 0
"noSuchInstance",
@@ -166,14 +166,14 @@ char *Exceptions[] = {
* Private ASN.1 types
* The Internet SMI does not specify any
*/
-char *Private[] = {
+const char *Private[] = {
"P-0"
};
/*
* error-status values for any SNMP PDU
*/
-char *ErrorStatus[] = {
+const char *ErrorStatus[] = {
"noError",
"tooBig",
"noSuchName",
@@ -195,14 +195,14 @@ char *ErrorStatus[] = {
"inconsistentName"
};
#define DECODE_ErrorStatus(e) \
- ( e >= 0 && e < sizeof(ErrorStatus)/sizeof(ErrorStatus[0]) \
+ ( e >= 0 && (size_t)e < sizeof(ErrorStatus)/sizeof(ErrorStatus[0]) \
? ErrorStatus[e] \
: (snprintf(errbuf, sizeof(errbuf), "err=%u", e), errbuf))
/*
* generic-trap values in the SNMP Trap-PDU
*/
-char *GenericTrap[] = {
+const char *GenericTrap[] = {
"coldStart",
"warmStart",
"linkDown",
@@ -213,7 +213,7 @@ char *GenericTrap[] = {
#define GT_ENTERPRISE 7
};
#define DECODE_GenericTrap(t) \
- ( t >= 0 && t < sizeof(GenericTrap)/sizeof(GenericTrap[0]) \
+ ( t >= 0 && (size_t)t < sizeof(GenericTrap)/sizeof(GenericTrap[0]) \
? GenericTrap[t] \
: (snprintf(buf, sizeof(buf), "gt=%d", t), buf))
@@ -224,8 +224,8 @@ char *GenericTrap[] = {
*/
#define defineCLASS(x) { "x", x, sizeof(x)/sizeof(x[0]) } /* not ANSI-C */
struct {
- char *name;
- char **Id;
+ const char *name;
+ const char **Id;
int numIDs;
} Class[] = {
defineCLASS(Universal),
@@ -243,7 +243,7 @@ struct {
/*
* defined forms for ASN.1 types
*/
-char *Form[] = {
+const char *Form[] = {
"Primitive",
#define PRIMITIVE 0
"Constructed",
@@ -255,7 +255,7 @@ char *Form[] = {
* This is stored as a general-order tree.
*/
struct obj {
- char *desc; /* name of object */
+ const char *desc; /* name of object */
u_char oid; /* sub-id following parent */
u_char type; /* object type (unused) */
struct obj *child, *next; /* child and next sibling pointers */
@@ -277,9 +277,9 @@ struct obj {
* private enterprises tree, and the experimental tree.
*/
struct obj_abrev {
- char *prefix; /* prefix for this abrev */
+ const char *prefix; /* prefix for this abrev */
struct obj *node; /* pointer into object table */
- char *oid; /* ASN.1 encoded OID */
+ const char *oid; /* ASN.1 encoded OID */
} obj_abrev_list[] = {
#ifndef NO_ABREV_MIB
/* .iso.org.dod.internet.mgmt.mib */
@@ -358,7 +358,7 @@ struct be {
/*
* SNMP versions recognized by this module
*/
-char *SnmpVersion[] = {
+const char *SnmpVersion[] = {
"SNMPv1",
#define SNMP_VERSION_1 0
"SNMPv2c",
@@ -460,7 +460,7 @@ asn1_parse(register const u_char *p, u_int len, struct be *elem)
elem->asnlen = *p;
p++; len--; hdr++;
if (elem->asnlen & ASN_BIT8) {
- int noct = elem->asnlen % ASN_BIT8;
+ u_int32_t noct = elem->asnlen % ASN_BIT8;
elem->asnlen = 0;
if (len < noct) {
ifNotTruncated printf("[asnlen? %d<%d]", len, noct);
@@ -649,7 +649,7 @@ asn1_print(struct be *elem)
{
u_char *p = (u_char *)elem->data.raw;
u_int32_t asnlen = elem->asnlen;
- int i;
+ u_int32_t i;
switch (elem->type) {
@@ -781,7 +781,7 @@ asn1_print(struct be *elem)
case BE_INETADDR:
if (asnlen != ASNLEN_INETADDR)
printf("[inetaddr len!=%d]", ASNLEN_INETADDR);
- for (i = asnlen; i-- > 0; p++) {
+ for (i = asnlen; i-- != 0; p++) {
printf((i == asnlen-1) ? "%u" : ".%u", *p);
}
break;
@@ -1167,7 +1167,7 @@ varbind_print(u_char pduid, const u_char *np, u_int length)
asn1_print(&elem);
return;
}
- if (count < length)
+ if ((u_int)count < length)
printf("[%d extra after SEQ of varbind]", length - count);
/* descend */
length = elem.asnlen;
@@ -1420,7 +1420,7 @@ pdu_print(const u_char *np, u_int length, int version)
fputs("[no PDU]", stdout);
return;
}
- if (count < length)
+ if ((u_int)count < length)
printf("[%d extra after PDU]", length - count);
if (vflag) {
fputs("{ ", stdout);
@@ -1638,7 +1638,7 @@ usm_print(const u_char *np, u_int length)
length -= count;
np += count;
- if (count < length)
+ if ((u_int)count < length)
printf("[%d extra after usm SEQ]", length - count);
}
@@ -1731,7 +1731,7 @@ v3msg_print(const u_char *np, u_int length)
length -= count;
np += count;
- if (count < length)
+ if ((u_int)count < length)
printf("[%d extra after message SEQ]", length - count);
if (vflag) {
@@ -1807,7 +1807,7 @@ snmp_print(const u_char *np, u_int length)
asn1_print(&elem);
return;
}
- if (count < length)
+ if ((u_int)count < length)
printf("[%d extra after iSEQ]", length - count);
/* descend */
length = elem.asnlen;
diff --git a/print-sunrpc.c b/print-sunrpc.c
index 3b3aaa3a..b4257cfa 100644
--- a/print-sunrpc.c
+++ b/print-sunrpc.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.41 2002-08-01 08:53:31 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.42 2002-09-05 00:00:22 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -136,7 +136,7 @@ progstr(prog)
register struct rpcent *rp;
#endif
static char buf[32];
- static int lastprog = 0;
+ static u_int32_t lastprog = 0;
if (lastprog != 0 && prog == lastprog)
return (buf);
diff --git a/print-tcp.c b/print-tcp.c
index aa9217c4..536fd57a 100644
--- a/print-tcp.c
+++ b/print-tcp.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.101 2002-08-20 00:17:23 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.102 2002-09-05 00:00:22 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -183,7 +183,7 @@ tcp_print(register const u_char *bp, register u_int length,
register const struct tcphdr *tp;
register const struct ip *ip;
register u_char flags;
- register int hlen;
+ register u_int hlen;
register char ch;
u_int16_t sport, dport, win, urp;
u_int32_t seq, ack, thseq, thack;
@@ -429,10 +429,12 @@ tcp_print(register const u_char *bp, register u_int length,
/*
* Handle any options.
*/
- if ((hlen -= sizeof(*tp)) > 0) {
+ if (hlen > sizeof(*tp)) {
register const u_char *cp;
- register int i, opt, len, datalen;
+ register u_int i, opt, datalen;
+ register u_int len;
+ hlen -= sizeof(*tp);
cp = (const u_char *)tp + sizeof(*tp);
putchar(' ');
ch = '<';
@@ -556,7 +558,7 @@ tcp_print(register const u_char *bp, register u_int length,
break;
default:
- (void)printf("opt-%d:", opt);
+ (void)printf("opt-%u:", opt);
datalen = len - 2;
for (i = 0; i < datalen; ++i) {
LENCHECK(i);
diff --git a/print-telnet.c b/print-telnet.c
index 35998fcf..b3d99cb5 100644
--- a/print-telnet.c
+++ b/print-telnet.c
@@ -51,7 +51,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-telnet.c,v 1.20 2002-08-01 08:53:32 risso Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-telnet.c,v 1.21 2002-09-05 00:00:22 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
@@ -109,7 +109,8 @@ numstr(int x)
static int
telnet_parse(const u_char *sp, u_int length, int print)
{
- int i, c, x;
+ int i, x;
+ u_int c;
const u_char *osp, *p;
#define FETCH(c, sp, length) \
do { \
@@ -155,7 +156,7 @@ telnet_parse(const u_char *sp, u_int length, int print)
break;
/* IAC SB .... IAC SE */
p = sp;
- while (length > p + 1 - sp) {
+ while (length > (u_int)(p + 1 - sp)) {
if (p[0] == IAC && p[1] == SE)
break;
p++;
diff --git a/print-timed.c b/print-timed.c
index b8fec6d8..d6fc3b0f 100644
--- a/print-timed.c
+++ b/print-timed.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-timed.c,v 1.4 2002-08-01 08:53:32 risso Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-timed.c,v 1.5 2002-09-05 00:00:23 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -36,7 +36,7 @@ static const char rcsid[] =
#include "timed.h"
#include "interface.h"
-static char *tsptype[TSPTYPENUMBER] =
+static const char *tsptype[TSPTYPENUMBER] =
{ "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP",
"SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT",
"DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ",
diff --git a/print-token.c b/print-token.c
index de2f276e..dd806691 100644
--- a/print-token.c
+++ b/print-token.c
@@ -25,7 +25,7 @@
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.17 2002-08-01 08:53:33 risso Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.18 2002-09-05 00:00:23 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -103,7 +103,8 @@ token_print(const u_char *p, u_int length, u_int caplen)
const struct token_header *trp;
u_short extracted_ethertype;
struct ether_header ehdr;
- u_int route_len = 0, hdr_len = TOKEN_HDRLEN, seg;
+ u_int route_len = 0, hdr_len = TOKEN_HDRLEN;
+ int seg;
trp = (const struct token_header *)p;
diff --git a/print-wb.c b/print-wb.c
index 48144f26..b13e18c6 100644
--- a/print-wb.c
+++ b/print-wb.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-wb.c,v 1.27 2002-08-01 08:53:34 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-wb.c,v 1.28 2002-09-05 00:00:24 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -286,7 +286,7 @@ wb_prep(const struct pkt_prep *prep, u_int len)
}
-char *dopstr[] = {
+const char *dopstr[] = {
"dop-0!",
"dop-1!",
"RECT",
@@ -317,7 +317,7 @@ wb_dops(const struct dophdr *dh, u_int32_t ss, u_int32_t es)
else {
printf(" %s", dopstr[t]);
if (t == DT_SKIP || t == DT_HOLE) {
- int ts = ntohl(dh->dh_ts);
+ u_int32_t ts = ntohl(dh->dh_ts);
printf("%d", ts - ss + 1);
if (ss > ts || ts > es) {
printf("[|]");
diff --git a/print-zephyr.c b/print-zephyr.c
index c94eeff0..db8acecc 100644
--- a/print-zephyr.c
+++ b/print-zephyr.c
@@ -20,7 +20,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-zephyr.c,v 1.5 2002-08-01 08:53:35 risso Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-zephyr.c,v 1.6 2002-09-05 00:00:24 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -48,7 +48,7 @@ struct z_packet {
char *inst;
char *opcode;
char *sender;
- char *recipient;
+ const char *recipient;
char *format;
int cksum;
int multi;
@@ -105,7 +105,7 @@ parse_field(char **pptr, int *len)
}
static const char *
-z_triple(char *class, char *inst, char *recipient)
+z_triple(char *class, char *inst, const char *recipient)
{
if (!*recipient)
recipient = "*";
diff --git a/smbutil.c b/smbutil.c
index 48e5116a..e80b6636 100644
--- a/smbutil.c
+++ b/smbutil.c
@@ -12,7 +12,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.24 2002-09-04 09:53:42 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.25 2002-09-05 00:00:25 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
@@ -252,10 +252,10 @@ print_asc(const unsigned char *buf, int len)
safeputchar(buf[i]);
}
-static char *
+static const char *
name_type_str(int name_type)
{
- char *f = NULL;
+ const char *f = NULL;
switch (name_type) {
case 0: f = "Workstation"; break;
@@ -313,9 +313,9 @@ print_data(const unsigned char *buf, int len)
static void
-write_bits(unsigned int val, char *fmt)
+write_bits(unsigned int val, const char *fmt)
{
- char *p = fmt;
+ const char *p = fmt;
int i = 0;
while ((p = strchr(fmt, '|'))) {
@@ -356,7 +356,7 @@ unistr(const u_char *s, int *len)
*len = 1;
}
- while (l < (sizeof(buf) - 1) && s[0] && s[1] == 0) {
+ while (l < (int)(sizeof(buf) - 1) && s[0] && s[1] == 0) {
buf[l] = s[0];
s += 2;
l++;
@@ -371,7 +371,7 @@ static const u_char *
smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
{
int reverse = 0;
- char *attrib_fmt = "READONLY|HIDDEN|SYSTEM|VOLUME|DIR|ARCHIVE|";
+ const char *attrib_fmt = "READONLY|HIDDEN|SYSTEM|VOLUME|DIR|ARCHIVE|";
int len;
while (*fmt && buf<maxbuf) {
@@ -573,20 +573,20 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
{
time_t t;
struct tm *lt;
- char *tstring;
- int x;
+ const char *tstring;
+ u_int32_t x;
x = EXTRACT_LE_32BITS(buf);
switch (atoi(fmt + 1)) {
case 1:
- if (x == 0 || x == -1 || x == 0xFFFFFFFF)
+ if (x == 0 || x == 0xFFFFFFFF)
t = 0;
else
t = make_unix_date(buf);
buf += 4;
break;
case 2:
- if (x == 0 || x == -1 || x == 0xFFFFFFFF)
+ if (x == 0 || x == 0xFFFFFFFF)
t = 0;
else
t = make_unix_date2(buf);
@@ -675,7 +675,7 @@ smb_fdata(const u_char *buf, const char *fmt, const u_char *maxbuf)
return(buf);
memset(s, 0, sizeof(s));
p = strchr(fmt, ']');
- if (p - fmt + 1 > sizeof(s)) {
+ if ((size_t)(p - fmt + 1) > sizeof(s)) {
/* overrun */
return(buf);
}
@@ -802,7 +802,7 @@ err_code_struct hard_msgs[] = {
static struct {
int code;
- char *class;
+ const char *class;
err_code_struct *err_msgs;
} err_classes[] = {
{ 0, "SUCCESS", NULL },
diff --git a/token.h b/token.h
index 97b46159..fb1a8387 100644
--- a/token.h
+++ b/token.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/token.h,v 1.3 2000-10-03 02:55:03 itojun Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/token.h,v 1.4 2002-09-05 00:00:25 guy Exp $ (LBL) */
/*
* Copyright (c) 1998, Larry Lile
* All rights reserved.
@@ -40,7 +40,7 @@
#define LARGEST_FRAME(trp) ((ntohs((trp)->token_rcf) & 0x0070) >> 4)
#define RING_NUMBER(trp, x) ((ntohs((trp)->token_rseg[x]) & 0xfff0) >> 4)
#define BRIDGE_NUMBER(trp, x) ((ntohs((trp)->token_rseg[x]) & 0x000f))
-#define SEGMENT_COUNT(trp) ((RIF_LENGTH(trp) - 2) / 2)
+#define SEGMENT_COUNT(trp) ((int)((RIF_LENGTH(trp) - 2) / 2))
struct token_header {
u_int8_t token_ac;