-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.
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:
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
*/
#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
#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>
/* 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
#! /bin/sh
-# From configure.in Revision: 1.155
+# From configure.in Revision: 1.156
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
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
-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.
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)
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
* 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)))
#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)))
#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
#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 = " "; \
#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>
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;
#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>
u_int plen;
plen = pptr[0];
- if (plen < 0 || 32 < plen)
+ if (32 < plen)
return -1;
memset(&addr, 0, sizeof(addr));
plen-=24; /* adjust prefixlen - labellength */
- if (plen < 0 || 32 < plen)
+ if (32 < plen)
return -1;
memset(&addr, 0, sizeof(addr));
plen-=(24+64); /* adjust prefixlen - labellength - RD len*/
- if (plen < 0 || 32 < plen)
+ if (32 < plen)
return -1;
memset(&addr, 0, sizeof(addr));
#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
#include "interface.h"
+#include "addrtoname.h"
+
#include "tcp.h"
struct nfhdr {
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) {
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)
#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
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);
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);
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);
#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
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) {
#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
register u_int netlen;
int gateways, distances, networks;
int t_gateways;
- char *comma;
+ const char *comma;
addr = egp->egp_sourcenet;
if (IN_CLASSA(addr)) {
#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
struct esp_algorithm {
- char *name;
+ const char *name;
enum cipher algo;
int ivlen;
int authlen;
#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
#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);
#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;
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 */
#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
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;
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);
#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
} 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"
};
};
/* 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,
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++)
}
struct attrmap {
- char *type;
- int nvalue;
- char *value[30]; /*XXX*/
+ const char *type;
+ u_int nvalue;
+ const char *value[30]; /*XXX*/
};
static u_char *
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",
{ "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 *
{
struct isakmp_pl_t *p, t;
u_char *cp;
- char *idstr;
+ const char *idstr;
struct attrmap *map;
size_t nmap;
u_char *ep2;
{
#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",
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",
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",
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",
"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));
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);
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);
#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
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);
#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
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++);
}
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++);
}
#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
}
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),
#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
lwres_printname(size_t l, const char *p0)
{
const char *p;
- int i;
+ size_t i;
p = p0;
/* + 1 for terminating \0 */
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 +
lwres_gnbaresponse_t *gnba;
lwres_grbnresponse_t *grbn;
u_int32_t l, na;
- int i;
+ u_int32_t i;
gabn = NULL;
gnba = NULL;
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),
*/
#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
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;
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(" ");
#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
char *spacep;
if (uflag) {
- int i;
+ u_int i;
char const *sep = "";
printf(" fh[");
#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
bp += 12;
len -= 12;
for (njp = 0; njp < (njoin + nprune); njp++) {
- char *type;
+ const char *type;
if (njp < njoin)
type = "Join ";
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]);
#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
#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[] = {
}
code = *p;
- if ((code >= CPCODES_MIN) && (code <= CPCODES_MAX))
+ if (code <= CPCODES_MAX)
printf("%s", cpcodes[code]);
else {
printf("0x%02x", code);
#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
#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 */
#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
};
-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 */
{
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
{
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)
{
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);
#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
{
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) {
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
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]");
#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
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" },
{ 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" },
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;
}
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];
if (vflag <= 1)
return;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
bp += sizeof(struct rx_header);
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;
}
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;
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;
}
{
struct rx_header *rxh;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
rxh = (struct rx_header *) bp;
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;
}
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;
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;
}
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;
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");
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");
{
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;
}
{
struct rx_header *rxh;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
rxh = (struct rx_header *) bp;
{
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;
}
{
struct rx_header *rxh;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
rxh = (struct rx_header *) bp;
{
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;
}
{
struct rx_header *rxh;
- if (length <= sizeof(struct rx_header))
+ if (length <= (int)sizeof(struct rx_header))
return;
rxh = (struct rx_header *) bp;
{
struct rx_header *rxh;
- if (length < sizeof(struct rx_header))
+ if (length < (int)sizeof(struct rx_header))
return;
rxh = (struct rx_header *) bp;
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);
#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>
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)
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]);
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)
{ 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 } },
{ "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 },
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";
for (;;) {
const char *f1, *f2;
int wct;
- int bcc;
+ u_int bcc;
TCHECK(words[0]);
wct = words[0];
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)));
{
const u_char *maxbuf = data + length;
int flags;
- int nbt_len;
+ u_int nbt_len;
TCHECK2(data[2], 2);
flags = data[0];
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;
#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
* 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",
/*
* Application-wide ASN.1 types from the Internet SMI and their tags
*/
-char *Application[] = {
+const char *Application[] = {
"IpAddress",
#define IPADDR 0
"Counter",
/*
* Context-specific ASN.1 types for the SNMP PDUs and their tags
*/
-char *Context[] = {
+const char *Context[] = {
"GetRequest",
#define GETREQ 0
"GetNextRequest",
/*
* Context-specific ASN.1 types for the SNMP Exceptions and their tags
*/
-char *Exceptions[] = {
+const char *Exceptions[] = {
"noSuchObject",
#define NOSUCHOBJECT 0
"noSuchInstance",
* 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",
"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",
#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))
*/
#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),
/*
* defined forms for ASN.1 types
*/
-char *Form[] = {
+const char *Form[] = {
"Primitive",
#define PRIMITIVE 0
"Constructed",
* 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 */
* 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 */
/*
* SNMP versions recognized by this module
*/
-char *SnmpVersion[] = {
+const char *SnmpVersion[] = {
"SNMPv1",
#define SNMP_VERSION_1 0
"SNMPv2c",
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);
{
u_char *p = (u_char *)elem->data.raw;
u_int32_t asnlen = elem->asnlen;
- int i;
+ u_int32_t i;
switch (elem->type) {
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;
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;
fputs("[no PDU]", stdout);
return;
}
- if (count < length)
+ if ((u_int)count < length)
printf("[%d extra after PDU]", length - count);
if (vflag) {
fputs("{ ", stdout);
length -= count;
np += count;
- if (count < length)
+ if ((u_int)count < length)
printf("[%d extra after usm SEQ]", length - count);
}
length -= count;
np += count;
- if (count < length)
+ if ((u_int)count < length)
printf("[%d extra after message SEQ]", length - count);
if (vflag) {
asn1_print(&elem);
return;
}
- if (count < length)
+ if ((u_int)count < length)
printf("[%d extra after iSEQ]", length - count);
/* descend */
length = elem.asnlen;
#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
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);
#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
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;
/*
* 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 = '<';
break;
default:
- (void)printf("opt-%d:", opt);
+ (void)printf("opt-%u:", opt);
datalen = len - 2;
for (i = 0; i < datalen; ++i) {
LENCHECK(i);
#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>
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 { \
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++;
#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
#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",
*/
#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
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;
#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
}
-char *dopstr[] = {
+const char *dopstr[] = {
"dop-0!",
"dop-1!",
"RECT",
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("[|]");
#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
char *inst;
char *opcode;
char *sender;
- char *recipient;
+ const char *recipient;
char *format;
int cksum;
int multi;
}
static const char *
-z_triple(char *class, char *inst, char *recipient)
+z_triple(char *class, char *inst, const char *recipient)
{
if (!*recipient)
recipient = "*";
#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>
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;
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, '|'))) {
*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++;
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) {
{
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);
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);
}
static struct {
int code;
- char *class;
+ const char *class;
err_code_struct *err_msgs;
} err_classes[] = {
{ 0, "SUCCESS", NULL },
-/* @(#) $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.
#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;