Merge tcpdump 3.4
PR: bin/7877
This commit is contained in:
parent
90dc276c84
commit
699fc31439
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=39300
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -23,7 +23,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: addrtoname.c,v 1.54 96/12/05 22:10:19 leres Exp $ (LBL)";
|
||||
"@(#) $Header: addrtoname.c,v 1.61 97/06/15 13:20:18 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -45,6 +45,12 @@ struct rtentry;
|
||||
#include <netdb.h>
|
||||
#include <pcap.h>
|
||||
#include <pcap-namedb.h>
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -54,6 +60,8 @@ struct rtentry;
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "llc.h"
|
||||
#include "savestr.h"
|
||||
#include "setsignal.h"
|
||||
|
||||
/* Forwards */
|
||||
static RETSIGTYPE nohostname(int);
|
||||
@ -208,16 +216,18 @@ getname(const u_char *ap)
|
||||
/*
|
||||
* Only print names when:
|
||||
* (1) -n was not given.
|
||||
* (2) Address is foreign and -f was given. If -f was not
|
||||
* present, f_netmask and f_local are 0 and the second
|
||||
* test will succeed.
|
||||
* (3) The host portion is not 0 (i.e., a network address).
|
||||
* (4) The host portion is not broadcast.
|
||||
* (2) Address is foreign and -f was given. (If -f was not
|
||||
* give, f_netmask and f_local are 0 and the test
|
||||
* evaluates to true)
|
||||
* (3) -a was given or the host portion is not all ones
|
||||
* nor all zeros (i.e. not a network or broadcast address)
|
||||
*/
|
||||
if (!nflag && (addr & f_netmask) == f_localnet
|
||||
&& (addr &~ netmask) != 0 && (addr | netmask) != 0xffffffff) {
|
||||
if (!nflag &&
|
||||
(addr & f_netmask) == f_localnet &&
|
||||
(aflag ||
|
||||
!((addr & ~netmask) == 0 || (addr | netmask) == 0xffffffff))) {
|
||||
if (!setjmp(getname_env)) {
|
||||
(void)signal(SIGALRM, nohostname);
|
||||
(void)setsignal(SIGALRM, nohostname);
|
||||
(void)alarm(20);
|
||||
hp = gethostbyaddr((char *)&addr, 4, AF_INET);
|
||||
(void)alarm(0);
|
||||
@ -307,7 +317,7 @@ lookup_nsap(register const u_char *nsap)
|
||||
tp->e_nsap = (u_char *)malloc(nlen + 1);
|
||||
if (tp->e_nsap == NULL)
|
||||
error("lookup_nsap: malloc");
|
||||
memcpy(tp->e_nsap, nsap, nlen + 1);
|
||||
memcpy((char *)tp->e_nsap, (char *)nsap, nlen + 1);
|
||||
tp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp));
|
||||
if (tp->e_nxt == NULL)
|
||||
error("lookup_nsap: calloc");
|
||||
@ -697,7 +707,7 @@ init_llcsaparray(void)
|
||||
* of the local network. mask is its subnet mask.
|
||||
*/
|
||||
void
|
||||
init_addrtoname(int fflag, u_int32_t localnet, u_int32_t mask)
|
||||
init_addrtoname(u_int32_t localnet, u_int32_t mask)
|
||||
{
|
||||
netmask = mask;
|
||||
if (fflag) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Header: nfsfh.h,v 1.5 96/08/20 14:33:23 leres Exp $
|
||||
* $Header: nfsfh.h,v 1.6 96/12/16 03:40:31 leres Exp $
|
||||
*
|
||||
* nfsfh.h - NFS file handle definitions (for portable use)
|
||||
*
|
||||
@ -29,6 +29,6 @@ typedef struct {
|
||||
} my_fsid;
|
||||
|
||||
#define fsid_eq(a,b) ((a.fsid_code == b.fsid_code) &&\
|
||||
dev_eq(a.fsid_dev, b.fsid_dev))
|
||||
dev_eq(a.Fsid_dev, b.Fsid_dev))
|
||||
|
||||
extern void Parse_fh(caddr_t *, int, my_fsid *, ino_t *, char **, char **, int);
|
||||
|
@ -9,14 +9,16 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: parsenfsfh.c,v 1.12 96/12/10 23:25:50 leres Exp $ (LBL)";
|
||||
"@(#) $Header: parsenfsfh.c,v 1.14 97/06/15 13:20:27 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -313,13 +315,14 @@ int ourself; /* true if file handle was generated on this host */
|
||||
if (sizeof(*fsidp) >= 14) {
|
||||
if (sizeof(*fsidp) > 14)
|
||||
memset((char *)fsidp, 0, sizeof(*fsidp));
|
||||
memcpy((char *)fsidp, fh, 14); /* just use the whole thing */
|
||||
/* just use the whole thing */
|
||||
memcpy((char *)fsidp, (char *)fh, 14);
|
||||
}
|
||||
else {
|
||||
u_int32_t tempa[4]; /* at least 16 bytes, maybe more */
|
||||
|
||||
memset((char *)tempa, 0, sizeof(tempa));
|
||||
memcpy((char *)tempa, fh, 14); /* ensure alignment */
|
||||
memcpy((char *)tempa, (char *)fh, 14); /* ensure alignment */
|
||||
fsidp->Fsid_dev.Minor = tempa[0] + (tempa[1]<<1);
|
||||
fsidp->Fsid_dev.Major = tempa[2] + (tempa[3]<<1);
|
||||
fsidp->fsid_code = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-arp.c,v 1.41 96/10/27 14:54:50 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-arp.c,v 1.43 97/06/15 13:20:27 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -38,6 +38,9 @@ struct rtentry;
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-atalk.c,v 1.45 96/12/10 23:24:07 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-atalk.c,v 1.48 97/05/28 12:50:58 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -55,6 +55,7 @@ struct rtentry;
|
||||
#include "ethertype.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
#include "appletalk.h"
|
||||
#include "savestr.h"
|
||||
|
||||
static struct tok type2str[] = {
|
||||
{ ddpRTMP, "rtmp" },
|
||||
@ -412,11 +413,11 @@ print_cstring(register const char *cp, register const u_char *ep)
|
||||
length = *cp++;
|
||||
|
||||
/* Spec says string can be at most 32 bytes long */
|
||||
if (length < 0 || length > 32) {
|
||||
(void)printf("[len=%d]", length);
|
||||
if (length > 32) {
|
||||
(void)printf("[len=%u]", length);
|
||||
return (0);
|
||||
}
|
||||
while (--length >= 0) {
|
||||
while ((int)--length >= 0) {
|
||||
if (cp >= (char *)ep) {
|
||||
fputs(tstr, stdout);
|
||||
return (0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996
|
||||
* Copyright (c) 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -20,7 +20,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-atm.c,v 1.8 96/09/26 23:36:41 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-atm.c,v 1.9 97/05/28 12:52:40 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -48,9 +48,9 @@ struct rtentry;
|
||||
#include <stdio.h>
|
||||
#include <pcap.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ethertype.h"
|
||||
#include "interface.h"
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' is the points
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -22,7 +22,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-bootp.c,v 1.43 96/09/26 23:36:42 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-bootp.c,v 1.46 98/07/18 13:33:58 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -39,6 +39,9 @@ struct rtentry;
|
||||
#include <net/ethernet.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -145,6 +148,7 @@ bootp_print(register const u_char *cp, u_int length,
|
||||
fputs(tstr + 1, stdout);
|
||||
return;
|
||||
}
|
||||
putchar('"');
|
||||
}
|
||||
TCHECK2(bp->bp_sname[0], 1); /* check first char only */
|
||||
if (*bp->bp_file) {
|
||||
@ -154,6 +158,7 @@ bootp_print(register const u_char *cp, u_int length,
|
||||
fputs(tstr + 1, stdout);
|
||||
return;
|
||||
}
|
||||
putchar('"');
|
||||
}
|
||||
|
||||
/* Decode the vendor buffer */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-domain.c,v 1.37 96/12/10 23:21:06 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-domain.c,v 1.39 97/06/13 12:56:28 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -44,8 +44,12 @@ struct rtentry;
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcpip.h>
|
||||
|
||||
#ifdef NOERROR
|
||||
#undef NOERROR /* Solaris sucks */
|
||||
#endif
|
||||
#ifdef NOERROR
|
||||
#undef T_UNSPEC /* SINIX does too */
|
||||
#endif
|
||||
#include <arpa/nameser.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -216,6 +220,18 @@ static struct tok type2str[] = {
|
||||
{ T_GPOS, "GPOS" },
|
||||
{ T_AAAA, "AAAA" },
|
||||
{ T_LOC , "LOC " },
|
||||
#ifndef T_UINFO
|
||||
#define T_UINFO 100
|
||||
#endif
|
||||
{ T_UINFO, "UINFO" },
|
||||
#ifndef T_UID
|
||||
#define T_UID 101
|
||||
#endif
|
||||
{ T_UID, "UID" },
|
||||
#ifndef T_GID
|
||||
#define T_GID 102
|
||||
#endif
|
||||
{ T_GID, "GID" },
|
||||
{ T_UNSPEC, "UNSPEC" },
|
||||
{ T_UNSPECA, "UNSPECA" },
|
||||
{ T_AXFR, "AXFR" },
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -20,7 +20,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-ether.c,v 1.43 96/09/26 23:36:43 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-ether.c,v 1.44 97/05/26 17:18:13 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-fddi.c,v 1.33 96/12/10 23:20:49 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-fddi.c,v 1.36 97/05/26 17:13:35 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FDDI
|
||||
@ -45,7 +45,6 @@ struct rtentry;
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <pcap.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -58,7 +57,7 @@ struct rtentry;
|
||||
/*
|
||||
* Some FDDI interfaces use bit-swapped addresses.
|
||||
*/
|
||||
#if defined(ultrix) || defined(__alpha)
|
||||
#if defined(ultrix) || defined(__alpha) || defined(__bsdi)
|
||||
int fddi_bitswap = 0;
|
||||
#else
|
||||
int fddi_bitswap = 1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-ip.c,v 1.62 96/12/10 23:20:31 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-ip.c,v 1.66 97/05/28 12:51:43 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -37,6 +37,9 @@ static const char rcsid[] =
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcpip.h>
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -445,18 +448,15 @@ ip_print(register const u_char *bp, register u_int length)
|
||||
igmp_print(cp, len, (const u_char *)ip);
|
||||
break;
|
||||
|
||||
#ifndef IPPROTO_IPIP
|
||||
#define IPPROTO_IPIP 4
|
||||
#endif
|
||||
case IPPROTO_IPIP:
|
||||
/* ip-in-ip encapsulation */
|
||||
case 4:
|
||||
/* DVMRP multicast tunnel (ip-in-ip encapsulation) */
|
||||
if (vflag)
|
||||
(void)printf("%s > %s: ",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
ipaddr_string(&ip->ip_dst));
|
||||
ip_print(cp, len);
|
||||
if (! vflag) {
|
||||
printf(" (encap)");
|
||||
printf(" (ipip)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-isoclns.c,v 1.14 96/12/10 23:26:56 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-isoclns.c,v 1.15 96/12/31 21:27:41 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -283,7 +283,7 @@ esis_print(const u_char *p, u_int length)
|
||||
printf(" bad pkt!");
|
||||
else {
|
||||
printf(" too short for esis header %d:", li);
|
||||
while (--length >= 0)
|
||||
while (--length != 0)
|
||||
printf("%02X", *p++);
|
||||
}
|
||||
return;
|
||||
@ -663,7 +663,8 @@ osi_cksum(register const u_char *p, register int len, u_char *off)
|
||||
if ((off[0] == 0) && (off[1] == 0))
|
||||
return 0;
|
||||
|
||||
while (--len >= 0) {
|
||||
off[0] = off[1] = 0;
|
||||
while ((int)--len >= 0) {
|
||||
c0 += *p++;
|
||||
c0 %= 255;
|
||||
c1 += c0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-llc.c,v 1.22 96/12/10 23:23:37 leres Exp $";
|
||||
"@(#) $Header: print-llc.c,v 1.24 97/01/01 20:56:48 leres Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -34,7 +34,6 @@ static const char rcsid[] =
|
||||
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-nfs.c,v 1.63 96/12/10 23:18:07 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-nfs.c,v 1.65 97/08/17 13:24:22 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -247,7 +247,7 @@ nfsreply_print(register const u_char *bp, u_int length,
|
||||
ip = (const struct ip *)bp2;
|
||||
|
||||
if (!nflag)
|
||||
(void)printf("%s.nfs > %s.%x: reply %s %d",
|
||||
(void)printf("%s.nfs > %s.%u: reply %s %d",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
(u_int32_t)ntohl(rp->rm_xid),
|
||||
@ -255,7 +255,7 @@ nfsreply_print(register const u_char *bp, u_int length,
|
||||
"ok":"ERR",
|
||||
length);
|
||||
else
|
||||
(void)printf("%s.%x > %s.%x: reply %s %d",
|
||||
(void)printf("%s.%u > %s.%u: reply %s %d",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
NFS_PORT,
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
@ -383,13 +383,13 @@ nfsreq_print(register const u_char *bp, u_int length,
|
||||
rp = (const struct rpc_msg *)bp;
|
||||
ip = (const struct ip *)bp2;
|
||||
if (!nflag)
|
||||
(void)printf("%s.%x > %s.nfs: %d",
|
||||
(void)printf("%s.%u > %s.nfs: %d",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
(u_int32_t)ntohl(rp->rm_xid),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
length);
|
||||
else
|
||||
(void)printf("%s.%x > %s.%x: %d",
|
||||
(void)printf("%s.%u > %s.%u: %d",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
(u_int32_t)ntohl(rp->rm_xid),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
@ -758,7 +758,7 @@ xid_map_find(const struct rpc_msg *rp, const struct ip *ip, u_int32_t *proc,
|
||||
} while (i != xid_map_hint);
|
||||
|
||||
/* search failed */
|
||||
return (-1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-ntp.c,v 1.25 96/11/05 13:30:37 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-ntp.c,v 1.26 97/06/13 12:56:37 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -47,7 +47,9 @@ struct rtentry;
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#ifdef MODEMASK
|
||||
#undef MODEMASK /* Solaris sucks */
|
||||
#endif
|
||||
#include "ntp.h"
|
||||
|
||||
static void p_sfix(const struct s_fixedpt *);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-null.c,v 1.22 96/12/10 23:18:58 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-null.c,v 1.24 97/05/28 12:52:47 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -50,15 +50,19 @@ struct rtentry;
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "addrtoname.h"
|
||||
#include "interface.h"
|
||||
|
||||
#define NULL_HDRLEN 4
|
||||
#include "addrtoname.h"
|
||||
|
||||
#ifndef AF_NS
|
||||
#define AF_NS 6 /* XEROX NS protocols */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The DLT_NULL packet header is 4 bytes long. It contains a network
|
||||
* order 32 bit integer that specifies the family, e.g. AF_INET
|
||||
*/
|
||||
#define NULL_HDRLEN 4
|
||||
|
||||
static void
|
||||
null_print(const u_char *p, const struct ip *ip, u_int length)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -21,10 +21,9 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-ppp.c,v 1.24 96/12/10 23:23:12 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-ppp.c,v 1.26 97/06/12 14:21:29 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef PPP
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
@ -44,7 +43,6 @@ struct rtentry;
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <pcap.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <net/ethernet.h>
|
||||
@ -53,6 +51,7 @@ struct rtentry;
|
||||
#include <net/ppp_defs.h>
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ppp.h"
|
||||
|
||||
struct protonames {
|
||||
u_short protocol;
|
||||
@ -196,6 +195,7 @@ static int handle_chap(const u_char *p, int length);
|
||||
static int handle_ipcp(const u_char *p, int length);
|
||||
static int handle_pap(const u_char *p, int length);
|
||||
|
||||
/* Standard PPP printer */
|
||||
void
|
||||
ppp_hdlc_print(const u_char *p, int length)
|
||||
{
|
||||
@ -532,17 +532,80 @@ ppp_if_print(u_char *user, const struct pcap_pkthdr *h,
|
||||
out:
|
||||
putchar('\n');
|
||||
}
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <stdio.h>
|
||||
/* proto type to string mapping */
|
||||
static struct tok ptype2str[] = {
|
||||
{ PPP_VJC, "VJC" },
|
||||
{ PPP_VJNC, "VJNC" },
|
||||
{ PPP_OSI, "OSI" },
|
||||
{ PPP_LCP, "LCP" },
|
||||
{ PPP_IPCP, "IPCP" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#include "interface.h"
|
||||
#define PPP_BSDI_HDRLEN 24
|
||||
|
||||
/* BSD/OS specific PPP printer */
|
||||
void
|
||||
ppp_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
ppp_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h,
|
||||
register const u_char *p)
|
||||
{
|
||||
error("not configured for ppp");
|
||||
/* NOTREACHED */
|
||||
register u_int length = h->len;
|
||||
register u_int caplen = h->caplen;
|
||||
register int hdrlength;
|
||||
u_short ptype;
|
||||
|
||||
ts_print(&h->ts);
|
||||
|
||||
if (caplen < PPP_BSDI_HDRLEN) {
|
||||
printf("[|ppp]");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Some printers want to get back at the link level addresses,
|
||||
* and/or check that they're not walking off the end of the packet.
|
||||
* Rather than pass them all the way down, we set these globals.
|
||||
*/
|
||||
packetp = p;
|
||||
snapend = p + caplen;
|
||||
hdrlength = 0;
|
||||
|
||||
if (p[0] == PPP_ADDRESS && p[1] == PPP_CONTROL) {
|
||||
if (eflag)
|
||||
printf("%02x %02x ", p[0], p[1]);
|
||||
p += 2;
|
||||
hdrlength = 2;
|
||||
}
|
||||
|
||||
if (eflag)
|
||||
printf("%d ", length);
|
||||
/* Retrieve the protocol type */
|
||||
if (*p & 01) {
|
||||
/* Compressed protocol field */
|
||||
ptype = *p;
|
||||
if (eflag)
|
||||
printf("%02x ", ptype);
|
||||
p++;
|
||||
hdrlength += 1;
|
||||
} else {
|
||||
/* Un-compressed protocol field */
|
||||
ptype = ntohs(*(u_short *)p);
|
||||
if (eflag)
|
||||
printf("%04x ", ptype);
|
||||
p += 2;
|
||||
hdrlength += 2;
|
||||
}
|
||||
|
||||
length -= hdrlength;
|
||||
|
||||
if (ptype == PPP_IP)
|
||||
ip_print(p, length);
|
||||
else
|
||||
printf("%s ", tok2str(ptype2str, "proto-#%d", ptype));
|
||||
|
||||
if (xflag)
|
||||
default_print((const u_char *)p, caplen - hdrlength);
|
||||
out:
|
||||
putchar('\n');
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1989, 1990, 1991, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1989, 1990, 1991, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-sl.c,v 1.41 96/12/10 23:19:42 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-sl.c,v 1.42 97/06/12 14:21:35 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NET_SLIP_H
|
||||
@ -54,7 +54,6 @@ struct rtentry;
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <pcap.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "interface.h"
|
||||
@ -75,6 +74,8 @@ static void compressed_sl_print(const u_char *, const struct ip *, u_int, int);
|
||||
#define CHDR_LEN (SLC_BPFHDR - SLC_BPFHDRLEN)
|
||||
#endif
|
||||
|
||||
/* XXX needs more hacking to work right */
|
||||
|
||||
void
|
||||
sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
@ -111,6 +112,45 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sl_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
register u_int caplen = h->caplen;
|
||||
register u_int length = h->len;
|
||||
register const struct ip *ip;
|
||||
|
||||
ts_print(&h->ts);
|
||||
|
||||
if (caplen < SLIP_HDRLEN) {
|
||||
printf("[|slip]");
|
||||
goto out;
|
||||
}
|
||||
/*
|
||||
* Some printers want to get back at the link level addresses,
|
||||
* and/or check that they're not walking off the end of the packet.
|
||||
* Rather than pass them all the way down, we set these globals.
|
||||
*/
|
||||
packetp = p;
|
||||
snapend = p + caplen;
|
||||
|
||||
length -= SLIP_HDRLEN;
|
||||
|
||||
ip = (struct ip *)(p + SLIP_HDRLEN);
|
||||
|
||||
#ifdef notdef
|
||||
if (eflag)
|
||||
sliplink_print(p, ip, length);
|
||||
#endif
|
||||
|
||||
ip_print((u_char *)ip, length);
|
||||
|
||||
if (xflag)
|
||||
default_print((u_char *)ip, caplen - SLIP_HDRLEN);
|
||||
out:
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
static void
|
||||
sliplink_print(register const u_char *p, register const struct ip *ip,
|
||||
register u_int length)
|
||||
@ -247,6 +287,7 @@ compressed_sl_print(const u_char *chdr, const struct ip *ip,
|
||||
#include <stdio.h>
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
void
|
||||
sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
@ -254,4 +295,12 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
error("not configured for slip");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
void
|
||||
sl_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
|
||||
error("not configured for slip");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
#endif
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-sunrpc.c,v 1.25 96/09/26 23:36:49 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-sunrpc.c,v 1.26 96/12/31 21:27:43 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -119,7 +119,7 @@ progstr(prog)
|
||||
{
|
||||
register struct rpcent *rp;
|
||||
static char buf[32];
|
||||
static lastprog = 0;
|
||||
static int lastprog = 0;
|
||||
|
||||
if (lastprog != 0 && prog == lastprog)
|
||||
return (buf);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: print-udp.c,v 1.58 96/12/10 23:22:07 leres Exp $ (LBL)";
|
||||
"@(#) $Header: print-udp.c,v 1.60 97/07/27 21:58:48 leres Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -35,9 +35,16 @@ static const char rcsid[] =
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
|
||||
#ifdef NOERROR
|
||||
#undef NOERROR /* Solaris sucks */
|
||||
#endif
|
||||
#ifdef T_UNSPEC
|
||||
#undef T_UNSPEC /* SINIX does too */
|
||||
#endif
|
||||
#include <arpa/nameser.h>
|
||||
#ifdef SEGSIZE
|
||||
#undef SEGSIZE
|
||||
#endif
|
||||
#include <arpa/tftp.h>
|
||||
|
||||
#include <rpc/rpc.h>
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" @(#) $Header: tcpdump.1,v 1.65 96/11/29 01:03:01 leres Exp $ (LBL)
|
||||
.\" @(#) $Header: tcpdump.1,v 1.67 97/06/30 16:31:50 leres Exp $ (LBL)
|
||||
.\"
|
||||
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996
|
||||
.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
@ -20,14 +20,14 @@
|
||||
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
.\"
|
||||
.TH TCPDUMP 1 "29 November 1996"
|
||||
.TH TCPDUMP 1 "30 June 1997"
|
||||
.SH NAME
|
||||
tcpdump \- dump traffic on a network
|
||||
.SH SYNOPSIS
|
||||
.na
|
||||
.B tcpdump
|
||||
[
|
||||
.B \-deflnNOpqStvx
|
||||
.B \-adeflnNOpqStvx
|
||||
] [
|
||||
.B \-c
|
||||
.I count
|
||||
@ -72,7 +72,7 @@ that match the boolean \fIexpression\fP.
|
||||
To run
|
||||
.I tcpdump
|
||||
you must have read access to
|
||||
.I /dev/net
|
||||
.I /dev/nit
|
||||
or
|
||||
.IR /dev/bpf* .
|
||||
.B Under Solaris with dlpi:
|
||||
@ -94,6 +94,9 @@ You must have read access to
|
||||
.IR /dev/bpf* .
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-a
|
||||
Attempt to convert network and broadcast addresses to names.
|
||||
.TP
|
||||
.B \-c
|
||||
Exit after receiving \fIcount\fP packets.
|
||||
.TP
|
||||
|
Loading…
Reference in New Issue
Block a user