Merge tcpdump 3.7.2

This commit is contained in:
Bill Fenner 2003-03-02 08:25:48 +00:00
parent e32fdc8718
commit 0e0def197a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=111729
17 changed files with 129 additions and 375 deletions

View File

@ -25,7 +25,7 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.83 2001/09/17 21:57:50 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.83.4.1 2002/06/02 00:08:07 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -36,14 +36,16 @@ static const char rcsid[] =
#include <sys/socket.h>
#include <sys/time.h>
struct mbuf;
struct rtentry;
#include <net/if.h>
#include <netinet/in.h>
#ifdef USE_ETHER_NTOHOST
#ifdef HAVE_NETINET_IF_ETHER_H
struct mbuf; /* Squelch compiler warnings on some platforms for */
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
#endif /* HAVE_NETINET_IF_ETHER_H */
#endif /* USE_ETHER_NTOHOST */
#include <arpa/inet.h>

View File

@ -1,200 +0,0 @@
/* @(#) $Header: /tcpdump/master/tcpdump/Attic/dhcp6.h,v 1.4 2000/12/17 23:07:48 guy Exp $ (LBL) */
/*
* Copyright (C) 1998 and 1999 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* draft-ietf-dhc-dhcpv6-15
*/
#ifndef __DHCP6_H_DEFINED
#define __DHCP6_H_DEFINED
/* Error Values */
#define DH6ERR_FAILURE 16
#define DH6ERR_AUTHFAIL 17
#define DH6ERR_POORLYFORMED 18
#define DH6ERR_UNAVAIL 19
#define DH6ERR_NOBINDING 20
#define DH6ERR_INVALIDSOURCE 21
#define DH6ERR_NOSERVER 23
#define DH6ERR_ICMPERROR 64
/* Message type */
#define DH6_SOLICIT 1
#define DH6_ADVERT 2
#define DH6_REQUEST 3
#define DH6_REPLY 4
#define DH6_RELEASE 5
#define DH6_RECONFIG 6
/* Predefined addresses */
#define DH6ADDR_ALLAGENT "ff02::1:2"
#define DH6ADDR_ALLSERVER "ff05::1:3"
#define DH6ADDR_ALLRELAY "ff05::1:4"
#define DH6PORT_DOWNSTREAM "546"
#define DH6PORT_UPSTREAM "547"
/* Protocol constants */
#define ADV_CLIENT_WAIT 2 /* sec */
#define DEFAULT_SOLICIT_HOPCOUNT 4
#define SERVER_MIN_ADV_DELAY 100 /* msec */
#define SERVER_MAX_ADV_DELAY 1000 /* msec */
#define REPLY_MSG_TIMEOUT 2 /* sec */
#define REQUEST_MSG_MIN_RETRANS 10 /* retransmissions */
#define RECONF_MSG_MIN_RETRANS 10 /* retransmissions */
#define RECONF_MSG_RETRANS_INTERVAL 12 /* sec */
#define RECONF_MMSG_MIN_RESP 2 /* sec */
#define RECONF_MMSG_MAX_RESP 10 /* sec */
#define RECONF_MULTICAST_REQUEST_WAIT 120 /* sec */
#define MIN_SOLICIT_DELAY 1 /* sec */
#define MAX_SOLICIT_DELAY 5 /* sec */
#define XID_TIMEOUT 600 /* sec */
/* DHCP6 base packet format */
struct dhcp6_solicit {
u_int8_t dh6sol_msgtype; /* DH6_SOLICIT */
u_int8_t dh6sol_flags;
#define DH6SOL_CLOSE 0x80
#define DH6SOL_PREFIX 0x40
/* XXX: solicit-ID is a 9-bit field...ugly! */
#define DH6SOL_SOLICIT_ID_MASK 0x01ff
#define DH6SOL_SOLICIT_ID_SHIFT 0
#define DH6SOL_SOLICIT_ID(x) \
(((x) & DH6SOL_SOLICIT_ID_MASK) >> DH6SOL_SOLICIT_ID_SHIFT)
#define DH6SOL_SOLICIT_PLEN_MASK 0xfe00
#define DH6SOL_SOLICIT_PLEN_SHIFT 9
#define DH6SOL_SOLICIT_PLEN(x) \
(((x) & DH6SOL_SOLICIT_PLEN_MASK) >> DH6SOL_SOLICIT_PLEN_SHIFT)
u_int16_t dh6sol_plen_id; /* prefix-len and solict-ID */
struct in6_addr dh6sol_cliaddr; /* client's lladdr */
struct in6_addr dh6sol_relayaddr; /* relay agent's lladdr */
};
struct dhcp6_advert {
u_int8_t dh6adv_msgtype; /* DH6_ADVERT */
u_int8_t dh6adv_rsv_id; /* reserved and uppermost bit of ID */
u_int8_t dh6adv_solcit_id; /* lower 8 bits of solicit-ID */
u_int8_t dh6adv_pref;
struct in6_addr dh6adv_cliaddr; /* client's link-local addr */
struct in6_addr dh6adv_relayaddr; /* relay agent's (non-ll) addr */
struct in6_addr dh6adv_serveraddr; /* server's addr */
/* extensions */
};
struct dhcp6_request {
u_int8_t dh6req_msgtype; /* DH6_REQUEST */
u_int8_t dh6req_flags;
#define DH6REQ_CLOSE 0x80
#define DH6REQ_REBOOT 0x40
u_int16_t dh6req_xid; /* transaction-ID */
struct in6_addr dh6req_cliaddr; /* client's lladdr */
struct in6_addr dh6req_relayaddr; /* relay agent's (non-ll) addr */
struct in6_addr dh6req_serveraddr; /* server's addr */
/* extensions */
};
struct dhcp6_reply {
u_int8_t dh6rep_msgtype; /* DH6_REPLY */
u_int8_t dh6rep_flagandstat;
#define DH6REP_RELAYPRESENT 0x80
#define DH6REP_STATMASK 0x7f
u_int16_t dh6rep_xid; /* transaction-ID */
struct in6_addr dh6rep_cliaddr; /* client's lladdr */
/* struct in6_addr dh6rep_relayaddr; optional: relay address */
/* extensions */
};
/* XXX: followings are based on older drafts */
struct dhcp6_release {
u_int8_t dh6rel_msgtype; /* DH6_RELEASE */
u_int8_t dh6rel_flags;
#define DH6REL_DIRECT 0x80
u_int16_t dh6rel_xid; /* transaction-ID */
struct in6_addr dh6rel_cliaddr; /* client's lladdr */
struct in6_addr dh6rel_relayaddr; /* relay agent's (non-ll) addr */
struct in6_addr dh6rel_reladdr; /* server's addr to be released */
/* extensions */
};
struct dhcp6_reconfig {
u_int8_t dh6cfg_msgtype; /* DH6_RECONFIG */
u_int8_t dh6cfg_flags;
#define DH6REP_NOREPLY 0x80
u_int16_t dh6cfg_xid; /* transaction-ID */
struct in6_addr dh6cfg_servaddr; /* server's addr */
/* extensions */
};
union dhcp6 {
u_int8_t dh6_msgtype;
struct dhcp6_solicit dh6_sol;
struct dhcp6_advert dh6_adv;
struct dhcp6_request dh6_req;
struct dhcp6_reply dh6_rep;
struct dhcp6_release dh6_rel;
struct dhcp6_reconfig dh6_cfg;
};
/* DHCP6 extension */
struct dhcp6e_ipaddr {
u_int16_t dh6eip_type;
u_int16_t dh6eip_len;
u_int8_t dh6eip_status;
#define DH6EX_IP_SUCCESS 0 /* request granted, no errors */
#define DH6EX_IP_SECFAIL 18 /* Security parameters failed */
#define DH6EX_IP_AAAAFAIL 20 /* AAAA Record Parameter Problem */
#define DH6EX_IP_PTRFAIL 21 /* PTR Record Parameter Problem */
#define DH6EX_IP_PARAMFAIL 22 /* Unable to honor required params */
#define DH6EX_IP_DNSNAMEFAIL 23 /* DNS name string error */
#define DH6EX_IP_NODYNDNS 24 /* dynDNS Not Implemented */
#define DH6EX_IP_NOAUTHDNS 25 /* Authoritative DNS Server not found */
#define DH6EX_IP_DNSFORMFAIL 33 /* DNS format error */
#define DH6EX_IP_SERVFAIL 34 /* dynDNS unavailable at this time */
#define DH6EX_IP_NXDOMAIN 35 /* name does not exist */
#define DH6EX_IP_NOTIMP 36 /* DNS does not support the Opcode */
#define DH6EX_IP_REFUSED 37 /* DNS refuses specified operation */
#define DH6EX_IP_YXDOMAIN 38 /* name does not exist */
#define DH6EX_IP_YXRRSET 39 /* RRset does not exist */
#define DH6EX_IP_NXRRSET 40 /* RRset does not exist */
#define DH6EX_IP_NOTAUTH 41 /* non authoritative name server */
#define DH6EX_IP_NOTZONE 42 /* prerequisite out of zone */
u_int8_t dh6eip_flags;
#define DH6EX_IP_CLIANTADDR 0x80 /* C: cliant's addr */
#define DH6EX_IP_LIFETIME 0x40 /* L: preferred/valid lifetime */
#define DH6EX_IP_FORCEOPTS 0x20 /* Q: options are mandatory */
#define DH6EX_IP_AAAA 0x10 /* A: DNS dynamic update for AAAA */
#define DH6EX_IP_PTR 0x08 /* P: DNS dynamic update for PTR*/
u_int8_t dh6eip_pad;
u_int8_t dh6eip_prefixlen;
/* struct in6_addr: client's address (if C bit = 1) */
/* u_int: preferred lifetime (if L bit = 1) */
/* u_int: valid lifetime (if L bit = 1) */
/* string: DNS name */
};
#endif /*__DHCP6_H_DEFINED*/

View File

@ -1,81 +0,0 @@
/* @(#) $Header: /tcpdump/master/tcpdump/Attic/dhcp6opt.h,v 1.4 2001/09/17 21:57:51 fenner Exp $ (LBL) */
/*
* Copyright (C) 1998 and 1999 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* draft-ietf-dhc-v6exts-11
*/
#ifndef __DHCP6OPT_H_DEFINED
#define __DHCP6OPT_H_DEFINED
#define OL6_N -1
#define OL6_16N -2
#define OL6_Z -3
#define OT6_NONE 0
#define OT6_V6 1
#define OT6_STR 2
#define OT6_NUM 3
struct dhcp6_opt {
u_int code;
int len;
const char *name;
int type;
};
/* index to parameters */
#define DH6T_CLIENT_ADV_WAIT 1 /* milliseconds */
#define DH6T_DEFAULT_SOLICIT_HOPCOUNT 2 /* times */
#define DH6T_SERVER_MIN_ADV_DELAY 3 /* milliseconds */
#define DH6T_SERVER_MAX_ADV_DELAY 4 /* milliseconds */
#define DH6T_REQUEST_MSG_MIN_RETRANS 5 /* retransmissions */
#define DH6T_REPLY_MSG_TIMEOUT 6 /* milliseconds */
#define DH6T_REPLY_MSG_RETRANS_INTERVAL 7 /* milliseconds */
#define DH6T_RECONF_MSG_TIMEOUT 8 /* milliseconds */
#define DH6T_RECONF_MSG_MIN_RETRANS 9 /* retransmissions */
#define DH6T_RECONF_MSG_RETRANS_INTERVAL 10 /* milliseconds */
#define DH6T_RECONF_MMSG_MIN_RESP 11 /* milliseconds */
#define DH6T_RECONF_MMSG_MAX_RESP 12 /* milliseconds */
#define DH6T_MIN_SOLICIT_DELAY 13 /* milliseconds */
#define DH6T_MAX_SOLICIT_DELAY 14 /* milliseconds */
#define DH6T_XID_TIMEOUT 15 /* milliseconds */
#define DH6T_RECONF_MULTICAST_REQUEST_WAIT 16 /* milliseconds */
#if 0
extern struct dhcp6_opt *dh6o_pad;
extern struct dhcp6_opt *dh6o_end;
extern int dhcp6_param[];
extern void dhcp6opttab_init (void);
extern struct dhcp6_opt *dhcp6opttab_byname (char *);
extern struct dhcp6_opt *dhcp6opttab_bycode (u_int);
#endif
#endif /*__DHCP6OPT_H_DEFINED*/

View File

@ -18,7 +18,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.178 2002/01/21 11:39:58 mcr Exp $ (LBL)
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.178.4.2 2002/07/10 07:32:17 guy Exp $ (LBL)
*
* $FreeBSD$
*/
@ -83,8 +83,6 @@ extern int xflag; /* print packet in hex */
extern int Xflag; /* print packet in hex/ascii */
extern char *espsecret;
extern struct esp_algorithm *espsecret_xform; /* cache of decoded alg. */
extern char *espsecret_key;
extern int packettype; /* as specified by -T */
#define PT_VAT 1 /* Visual Audio Tool */

View File

@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.51 2001/09/17 21:57:54 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.51.4.2 2002/07/10 07:09:53 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -54,7 +54,7 @@ static const char rcsid[] =
* arp_tha and arp_tpa in that order, according to the lengths
* specified. Field names used correspond to RFC 826.
*/
struct arphdr {
struct arp_pkthdr {
u_short ar_hrd; /* format of hardware address */
#define ARPHRD_ETHER 1 /* ethernet hardware format */
#define ARPHRD_IEEE802 6 /* token-ring hardware format */
@ -82,10 +82,10 @@ struct arphdr {
u_char ar_tha[]; /* target hardware address */
u_char ar_tpa[]; /* target protocol address */
#endif
#define ar_sha(ap) (((const caddr_t)((ap)+1))+0)
#define ar_spa(ap) (((const caddr_t)((ap)+1))+ (ap)->ar_hln)
#define ar_tha(ap) (((const caddr_t)((ap)+1))+ (ap)->ar_hln+(ap)->ar_pln)
#define ar_tpa(ap) (((const caddr_t)((ap)+1))+2*(ap)->ar_hln+(ap)->ar_pln)
#define ar_sha(ap) (((const u_char *)((ap)+1))+0)
#define ar_spa(ap) (((const u_char *)((ap)+1))+ (ap)->ar_hln)
#define ar_tha(ap) (((const u_char *)((ap)+1))+ (ap)->ar_hln+(ap)->ar_pln)
#define ar_tpa(ap) (((const u_char *)((ap)+1))+2*(ap)->ar_hln+(ap)->ar_pln)
};
#define ARP_HDRLEN 8
@ -105,10 +105,10 @@ static u_char ezero[6];
void
arp_print(const u_char *bp, u_int length, u_int caplen)
{
const struct arphdr *ap;
const struct arp_pkthdr *ap;
u_short pro, hrd, op;
ap = (const struct arphdr *)bp;
ap = (const struct arp_pkthdr *)bp;
TCHECK(*ap);
if ((const u_char *)(ar_tpa(ap) + PLN(ap)) > snapend) {
(void)printf("truncated-arp");

View File

@ -25,7 +25,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.70 2001/11/15 08:23:12 itojun Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.70.2.1 2002/02/05 10:04:18 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -115,6 +115,14 @@ llap_print(register const u_char *bp, u_int length)
u_short snet;
#if 0
/*
* Our packet is on a 4-byte boundary, as we're either called
* directly from a top-level link-layer printer (ltalk_if_print)
* or from the UDP printer. The LLAP+DDP header is a multiple
* of 4 bytes in length, so the DDP payload is also on a 4-byte
* boundary, and we don't need to align it before calling
* "ddp_print()".
*/
lp = (const struct LAP *)bp;
bp += sizeof(*lp);
length -= sizeof(*lp);
@ -403,6 +411,11 @@ nbp_print(register const struct atNBP *np, u_int length, register u_short snet,
int i;
const u_char *ep;
if (length < nbpHeaderSize) {
(void)printf(" truncated-nbp %d", length);
return;
}
length -= nbpHeaderSize;
if (length < 8) {
/* must be room for at least one tuple */

View File

@ -24,7 +24,7 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.60 2001/09/17 21:57:56 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.60.4.2 2002/06/01 23:51:11 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -35,9 +35,6 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/socket.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>
#include <ctype.h>
@ -351,13 +348,14 @@ static struct tok arp2str[] = {
static void
rfc1048_print(register const u_char *bp)
{
register u_char tag;
register u_int16_t tag;
register u_int len, size;
register const char *cp;
register char c;
int first;
u_int32_t ul;
u_short us;
u_int16_t us;
u_int8_t uc;
printf(" vend-rfc1048");
@ -378,9 +376,9 @@ rfc1048_print(register const u_char *bp)
* preclude overlap of 1-byte and 2-byte spaces.
* If not, we need to offset tag after this step.
*/
cp = tok2str(xtag2str, "?xT%d", tag);
cp = tok2str(xtag2str, "?xT%u", tag);
} else
cp = tok2str(tag2str, "?T%d", tag);
cp = tok2str(tag2str, "?T%u", tag);
c = *cp++;
printf(" %s:", cp);
@ -396,8 +394,8 @@ rfc1048_print(register const u_char *bp)
}
if (tag == TAG_DHCP_MESSAGE && len == 1) {
c = *bp++;
switch (c) {
uc = *bp++;
switch (uc) {
case DHCPDISCOVER: printf("DISCOVER"); break;
case DHCPOFFER: printf("OFFER"); break;
case DHCPREQUEST: printf("REQUEST"); break;
@ -406,7 +404,7 @@ rfc1048_print(register const u_char *bp)
case DHCPNAK: printf("NACK"); break;
case DHCPRELEASE: printf("RELEASE"); break;
case DHCPINFORM: printf("INFORM"); break;
default: printf("%u", c); break;
default: printf("%u", uc); break;
}
continue;
}
@ -414,8 +412,8 @@ rfc1048_print(register const u_char *bp)
if (tag == TAG_PARM_REQUEST) {
first = 1;
while (len-- > 0) {
c = *bp++;
cp = tok2str(tag2str, "?T%d", c);
uc = *bp++;
cp = tok2str(tag2str, "?T%u", uc);
if (!first)
putchar('+');
printf("%s", cp + 1);
@ -427,9 +425,9 @@ rfc1048_print(register const u_char *bp)
first = 1;
while (len > 1) {
len -= 2;
c = EXTRACT_16BITS(bp);
us = EXTRACT_16BITS(bp);
bp += 2;
cp = tok2str(xtag2str, "?xT%d", c);
cp = tok2str(xtag2str, "?xT%u", us);
if (!first)
putchar('+');
printf("%s", cp + 1);
@ -504,7 +502,7 @@ rfc1048_print(register const u_char *bp)
if (!first)
putchar(',');
us = EXTRACT_16BITS(bp);
printf("%d", us);
printf("%u", us);
bp += sizeof(us);
size -= sizeof(us);
first = 0;
@ -524,7 +522,7 @@ rfc1048_print(register const u_char *bp)
putchar('Y');
break;
default:
printf("%d?", *bp);
printf("%u?", *bp);
break;
}
++bp;
@ -543,7 +541,7 @@ rfc1048_print(register const u_char *bp)
if (c == 'x')
printf("%02x", *bp);
else
printf("%d", *bp);
printf("%u", *bp);
++bp;
--size;
first = 0;
@ -570,7 +568,7 @@ rfc1048_print(register const u_char *bp)
if (*bp++)
printf("[svrreg]");
if (*bp)
printf("%d/%d/", *bp, *(bp+1));
printf("%u/%u/", *bp, *(bp+1));
bp += 2;
putchar('"');
(void)fn_printn(bp, size - 3, NULL);
@ -602,7 +600,7 @@ rfc1048_print(register const u_char *bp)
}
default:
printf("[unknown special tag %d, size %d]",
printf("[unknown special tag %u, size %u]",
tag, size);
bp += size;
size = 0;
@ -612,7 +610,7 @@ rfc1048_print(register const u_char *bp)
}
/* Data left over? */
if (size)
printf("[len %d]", len);
printf("[len %u]", len);
}
return;
trunc:

View File

@ -22,7 +22,7 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.65 2001/07/04 22:03:14 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.65.4.1 2002/06/01 23:51:12 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -33,9 +33,6 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/socket.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>
#include <stdio.h>

View File

@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.53 2001/11/14 16:46:34 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.53.2.1 2002/06/01 23:51:13 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -33,8 +33,6 @@ static const char rcsid[] =
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <netinet/in.h>

View File

@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.62 2001/07/24 16:56:11 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.62.4.1 2002/06/01 23:51:13 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -34,9 +34,6 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/socket.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>
#include <stdio.h>

View File

@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.100 2001/09/17 21:58:03 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.100.4.1 2002/01/25 05:39:54 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -36,6 +36,7 @@ static const char rcsid[] =
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -259,13 +260,12 @@ ip_print(register const u_char *bp, register u_int length)
register const u_char *cp;
u_char nh;
int advance;
struct protoent *proto;
ip = (const struct ip *)bp;
#ifdef LBL_ALIGN
/*
* If the IP header is not aligned, copy into abuf.
* This will never happen with BPF. It does happen raw packet
* dumps from -r.
*/
if ((long)ip & 3) {
static u_char *abuf = NULL;
@ -463,7 +463,11 @@ ip_print(register const u_char *bp, register u_int length)
break;
default:
(void)printf(" ip-proto-%d %d", nh, len);
if ((proto = getprotobynumber(nh)) != NULL)
(void)printf(" %s", proto->p_name);
else
(void)printf(" ip-proto-%d", nh);
printf(" %d", len);
break;
}
}
@ -482,11 +486,17 @@ ip_print(register const u_char *bp, register u_int length)
if (off & 0x3fff) {
/*
* if this isn't the first frag, we're missing the
* next level protocol header. print the ip addr.
* next level protocol header. print the ip addr
* and the protocol.
*/
if (off & 0x1fff)
if (off & 0x1fff) {
(void)printf("%s > %s:", ipaddr_string(&ip->ip_src),
ipaddr_string(&ip->ip_dst));
if ((proto = getprotobynumber(ip->ip_p)) != NULL)
(void)printf(" %s", proto->p_name);
else
(void)printf(" ip-proto-%d", ip->ip_p);
}
#ifndef IP_MF
#define IP_MF 0x2000
#endif /* IP_MF */

View File

@ -28,7 +28,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.36 2002/01/10 09:33:23 guy Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.36.2.2 2002/06/29 04:28:44 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -576,7 +576,7 @@ isis_print_lspid(const u_char *cp)
static int
isis_print_tlv_ip_reach (const u_char *cp, int length)
{
int bitmasks[33] = {
u_int bitmasks[33] = {
0x00000000,
0x80000000, 0xc0000000, 0xe0000000, 0xf0000000,
0xf8000000, 0xfc000000, 0xfe000000, 0xff000000,
@ -587,7 +587,8 @@ isis_print_tlv_ip_reach (const u_char *cp, int length)
0xffffff80, 0xffffffc0, 0xffffffe0, 0xfffffff0,
0xfffffff8, 0xfffffffc, 0xfffffffe, 0xffffffff
};
int mask, prefix_len;
u_int mask;
int prefix_len;
const struct isis_tlv_ip_reach *tlv_ip_reach;
tlv_ip_reach = (const struct isis_tlv_ip_reach *)cp;
@ -678,6 +679,7 @@ static int isis_print (const u_char *p, u_int length)
u_char pdu_type, max_area, type, len, tmp, alen, subl, subt, tslen, ttslen;
const u_char *optr, *pptr, *tptr;
u_char subtlv_len;
u_short packet_len,pdu_len;
u_int i,j,bit_length,byte_length,metric;
u_char prefix[4]; /* copy buffer for ipv4 prefixes */
@ -1246,10 +1248,11 @@ static int isis_print (const u_char *p, u_int length)
if (ISIS_MASK_TLV_EXT_IP_SUBTLV(j)) {
if (!TTEST2(*tptr, 1))
return (1);
printf(" (%u)",*tptr); /* no subTLV decoder supported - just print out subTLV length */
i-=*tptr;
tptr+=*tptr++;
return (1);
subtlv_len = *tptr;
printf(" (%u)",subtlv_len); /* no subTLV decoder supported - just print out subTLV length */
i -= subtlv_len;
tptr += subtlv_len + 1;
}
i-=(5+byte_length);
@ -1518,8 +1521,9 @@ static int isis_print (const u_char *p, u_int length)
printf("\n\t\t\tRestart Request bit %s, Restart Acknowledgement bit %s\n\t\t\tRemaining holding time: %us",
ISIS_MASK_RESTART_RR(*tptr) ? "set" : "clear",
ISIS_MASK_RESTART_RA(*tptr++) ? "set" : "clear",
EXTRACT_16BITS(tptr));
ISIS_MASK_RESTART_RA(*tptr) ? "set" : "clear",
EXTRACT_16BITS(tptr+1));
tptr += 3;
break;

View File

@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.89 2001/07/08 08:01:43 itojun Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.89.4.2 2002/06/01 23:51:14 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -34,9 +34,6 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/socket.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>
#include <rpc/rpc.h>
@ -718,10 +715,16 @@ nfsreq_print(register const u_char *bp, u_int length,
case NFSPROC_FSINFO:
printf(" fsinfo");
if ((dp = parsereq(rp, length)) != NULL &&
parsefh(dp, v3) != NULL)
return;
break;
case NFSPROC_PATHCONF:
printf(" pathconf");
if ((dp = parsereq(rp, length)) != NULL &&
parsefh(dp, v3) != NULL)
return;
break;
case NFSPROC_COMMIT:
@ -1029,7 +1032,6 @@ parsestatus(const u_int32_t *dp, int *er)
printf(" ERROR: %s",
tok2str(status2str, "unk %d", errnum));
nfserr = 1;
return (NULL);
}
return (dp + 1);
trunc:
@ -1111,8 +1113,10 @@ parseattrstat(const u_int32_t *dp, int verbose, int v3)
int er;
dp = parsestatus(dp, &er);
if (dp == NULL || er)
if (dp == NULL)
return (0);
if (er)
return (1);
return (parsefattr(dp, verbose, v3) != NULL);
}
@ -1122,8 +1126,10 @@ parsediropres(const u_int32_t *dp)
{
int er;
if (!(dp = parsestatus(dp, &er)) || er)
if (!(dp = parsestatus(dp, &er)))
return (0);
if (er)
return (1);
dp = parsefh(dp, 0);
if (dp == NULL)
@ -1138,8 +1144,10 @@ parselinkres(const u_int32_t *dp, int v3)
int er;
dp = parsestatus(dp, &er);
if (dp == NULL || er)
if (dp == NULL)
return(0);
if (er)
return(1);
if (v3 && !(dp = parse_post_op_attr(dp, vflag)))
return (0);
putchar(' ');
@ -1153,8 +1161,10 @@ parsestatfs(const u_int32_t *dp, int v3)
int er;
dp = parsestatus(dp, &er);
if (dp == NULL || (!v3 && er))
if (dp == NULL)
return (0);
if (!v3 && er)
return (1);
if (qflag)
return(1);
@ -1166,7 +1176,7 @@ parsestatfs(const u_int32_t *dp, int v3)
return (0);
}
TCHECK2(dp, (v3 ? NFSX_V3STATFS : NFSX_V2STATFS));
TCHECK2(*dp, (v3 ? NFSX_V3STATFS : NFSX_V2STATFS));
sfsp = (const struct nfs_statfs *)dp;
@ -1207,8 +1217,10 @@ parserddires(const u_int32_t *dp)
int er;
dp = parsestatus(dp, &er);
if (dp == NULL || er)
if (dp == NULL)
return (0);
if (er)
return (1);
if (qflag)
return (1);
@ -1244,7 +1256,7 @@ parse_pre_op_attr(const u_int32_t *dp, int verbose)
if (!ntohl(dp[0]))
return (dp + 1);
dp++;
TCHECK2(dp, 24);
TCHECK2(*dp, 24);
if (verbose > 1) {
return parse_wcc_attr(dp);
} else {
@ -1381,9 +1393,9 @@ parsefsinfo(const u_int32_t *dp)
(u_int32_t) ntohl(sfp->fs_timedelta.nfsv3_sec),
(u_int32_t) ntohl(sfp->fs_timedelta.nfsv3_nsec));
}
return (0);
trunc:
return (1);
trunc:
return (0);
}
static int
@ -1411,9 +1423,9 @@ parsepathconf(const u_int32_t *dp)
ntohl(spp->pc_chownrestricted) ? "chownres" : "",
ntohl(spp->pc_caseinsensitive) ? "igncase" : "",
ntohl(spp->pc_casepreserving) ? "keepcase" : "");
return (0);
trunc:
return (1);
trunc:
return (0);
}
static void

View File

@ -27,7 +27,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.32 2001/08/20 15:36:57 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.32.4.1 2002/07/10 07:13:37 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -157,7 +157,7 @@ ntp_print(register const u_char *cp, u_int length)
break;
case PRIM_REF:
fn_printn((char *)&(bp->refid), 4, NULL);
fn_printn((u_char *)&(bp->refid), 4, NULL);
break;
case INFO_QUERY:

View File

@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.41 2001/07/05 18:54:15 guy Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.41.4.1 2002/06/01 23:51:15 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -33,11 +33,6 @@ static const char rcsid[] =
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/ioctl.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>

View File

@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.29 2001/07/04 21:36:15 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.29.4.1 2002/05/07 18:30:19 fenner Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -586,7 +586,20 @@ pimv2_print(register const u_char *bp, register u_int len)
(void)printf(")");
break;
case 18: /* Old DR-Priority */
if (olen == 4)
(void)printf(" (OLD-DR-Priority: %d)",
EXTRACT_32BITS(&bp[4]));
else
goto unknown;
break;
case 19: /* DR-Priority */
if (olen == 0) {
(void)printf(" (OLD-bidir-capable)");
break;
}
(void)printf(" (DR-Priority: ");
if (olen != 4) {
(void)printf("!olen=%d!)", olen);
@ -616,6 +629,7 @@ pimv2_print(register const u_char *bp, register u_int len)
break;
default:
unknown:
if (vflag)
(void)printf(" [Hello option %d]", otype);
}

View File

@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.39 2000/10/07 05:53:13 itojun Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.39.6.1 2002/06/01 23:51:16 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -34,9 +34,6 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/socket.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>
#include <rpc/rpc.h>