summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguy <guy>2005-07-07 01:22:15 +0000
committerguy <guy>2005-07-07 01:22:15 +0000
commitd953299b94043156cab202c486dc5b864f71c633 (patch)
treed9178547cd73d7a9716b8dd080f202b9b7218553
parente085b97e4b488bfd158529331e20ebaeb2b79f0f (diff)
downloadtcpdump-d953299b94043156cab202c486dc5b864f71c633.tar.gz
Add a flag to suppress the "default_print()" call made in various
link-layer print routines if no other print routine claimed the packet. Test whether that flag is set rather than testing whether neither of -x or -q were specified, and have -x, -q, *and* -X set that flag, so that -X suppresses it just as -x does. That way you don't get those pckets dumped twice if -X was specified.
-rw-r--r--interface.h3
-rw-r--r--netdissect.h5
-rw-r--r--print-802_11.c4
-rw-r--r--print-ap1394.c4
-rw-r--r--print-atm.c4
-rw-r--r--print-cip.c4
-rw-r--r--print-ether.c10
-rw-r--r--print-fddi.c6
-rw-r--r--print-fr.c4
-rw-r--r--print-ipfc.c4
-rw-r--r--print-lane.c6
-rw-r--r--print-null.c4
-rw-r--r--print-pflog.c4
-rw-r--r--print-sctp.c4
-rw-r--r--print-sll.c6
-rw-r--r--print-symantec.c6
-rw-r--r--print-token.c6
-rw-r--r--tcpdump.c5
18 files changed, 47 insertions, 42 deletions
diff --git a/interface.h b/interface.h
index 2c798812..66639b06 100644
--- a/interface.h
+++ b/interface.h
@@ -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.256 2005-07-06 20:53:30 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.257 2005-07-07 01:22:15 guy Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
@@ -347,6 +347,7 @@ extern netdissect_options *gndo;
#define Xflag gndo->ndo_Xflag
#define Cflag gndo->ndo_Cflag
#define Aflag gndo->ndo_Aflag
+#define suppress_default_print gndo->ndo_suppress_default_print
#define packettype gndo->ndo_packettype
#define tcpmd5secret gndo->ndo_tcpmd5secret
#define Wflag gndo->ndo_Wflag
diff --git a/netdissect.h b/netdissect.h
index 09dc676f..cca820e4 100644
--- a/netdissect.h
+++ b/netdissect.h
@@ -21,7 +21,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.17 2005-07-06 20:53:31 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.18 2005-07-07 01:22:16 guy Exp $ (LBL)
*/
#ifndef netdissect_h
@@ -107,7 +107,8 @@ struct netdissect_options {
int ndo_Cflag; /* rotate dump files after this many bytes */
int ndo_Cflag_count; /* Keep track of which file number we're writing */
int ndo_Wflag; /* recycle output files after this number of files */
- int ndo_WflagChars;
+ int ndo_WflagChars;
+ int ndo_suppress_default_print; /* don't use default_print() for unknown packet types */
const char *ndo_dltname;
char *ndo_espsecret;
diff --git a/print-802_11.c b/print-802_11.c
index 81abc641..e7acb79e 100644
--- a/print-802_11.c
+++ b/print-802_11.c
@@ -22,7 +22,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.32 2005-04-20 19:32:16 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.33 2005-07-07 01:22:16 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -900,7 +900,7 @@ ieee802_11_print(const u_char *p, u_int length, u_int caplen)
printf("(LLC %s) ",
etherproto_string(
htons(extracted_ethertype)));
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
break;
diff --git a/print-ap1394.c b/print-ap1394.c
index 07a5df54..21e9c19c 100644
--- a/print-ap1394.c
+++ b/print-ap1394.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ap1394.c,v 1.3 2004-03-17 23:24:35 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ap1394.c,v 1.4 2005-07-07 01:22:17 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -111,7 +111,7 @@ ap1394_if_print(const struct pcap_pkthdr *h, const u_char *p)
if (!eflag)
ap1394_hdr_print((u_char *)fp, length + FIREWIRE_HDRLEN);
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
diff --git a/print-atm.c b/print-atm.c
index 919d5e07..3bcd5f2e 100644
--- a/print-atm.c
+++ b/print-atm.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.40 2005-06-20 07:37:02 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.41 2005-07-07 01:22:17 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -106,7 +106,7 @@ atm_llc_print(const u_char *p, int length, int caplen)
printf("(LLC %s) ",
etherproto_string(htons(extracted_ethertype)));
}
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
}
diff --git a/print-cip.c b/print-cip.c
index 3a7d33a5..e9d672fe 100644
--- a/print-cip.c
+++ b/print-cip.c
@@ -22,7 +22,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.25 2005-04-06 21:32:39 mcr Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.26 2005-07-07 01:22:17 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -94,7 +94,7 @@ cip_if_print(const struct pcap_pkthdr *h, const u_char *p)
printf("(LLC %s) ",
etherproto_string(htons(extracted_ethertype)));
}
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
} else {
diff --git a/print-ether.c b/print-ether.c
index 4f04915c..ace88877 100644
--- a/print-ether.c
+++ b/print-ether.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.97 2005-07-01 16:15:59 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.98 2005-07-07 01:22:17 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -136,7 +136,7 @@ ether_print(const u_char *p, u_int length, u_int caplen)
if (!eflag)
ether_hdr_print((u_char *)ep, length + ETHER_HDRLEN);
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
} else if (ether_encap_print(ether_type, p, length, caplen,
@@ -145,7 +145,7 @@ ether_print(const u_char *p, u_int length, u_int caplen)
if (!eflag)
ether_hdr_print((u_char *)ep, length + ETHER_HDRLEN);
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
}
@@ -245,7 +245,7 @@ ether_encap_print(u_short ether_type, const u_char *p,
ether_hdr_print(p - 18, length + 4);
}
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p - 18, caplen + 4);
return (1);
@@ -270,7 +270,7 @@ ether_encap_print(u_short ether_type, const u_char *p,
ether_hdr_print(p - 16, length + 2);
}
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p - 16, caplen + 2);
return (1);
diff --git a/print-fddi.c b/print-fddi.c
index 84aea552..308f8c90 100644
--- a/print-fddi.c
+++ b/print-fddi.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.64 2004-03-17 23:24:37 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.65 2005-07-07 01:22:18 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -280,7 +280,7 @@ fddi_print(const u_char *p, u_int length, u_int caplen)
printf("(LLC %s) ",
etherproto_string(htons(extracted_ethertype)));
}
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
} else if ((fddip->fddi_fc & FDDIFC_CLFF) == FDDIFC_SMT)
@@ -290,7 +290,7 @@ fddi_print(const u_char *p, u_int length, u_int caplen)
if (!eflag)
fddi_hdr_print(fddip, length + FDDI_HDRLEN, ESRC(&ehdr),
EDST(&ehdr));
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
}
diff --git a/print-fr.c b/print-fr.c
index 082847c2..ea56c6da 100644
--- a/print-fr.c
+++ b/print-fr.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.36 2005-05-27 14:53:48 hannes Exp $ (LBL)";
+ "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.37 2005-07-07 01:22:18 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -276,7 +276,7 @@ fr_print(register const u_char *p, u_int length)
if (!eflag)
fr_hdr_print(length + hdr_len, hdr_len,
dlci, flags, nlpid);
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p - hdr_len, length + hdr_len);
}
break;
diff --git a/print-ipfc.c b/print-ipfc.c
index cf3f5626..e19d9791 100644
--- a/print-ipfc.c
+++ b/print-ipfc.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ipfc.c,v 1.7 2004-03-17 23:24:37 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ipfc.c,v 1.8 2005-07-07 01:22:19 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -117,7 +117,7 @@ ipfc_print(const u_char *p, u_int length, u_int caplen)
printf("(LLC %s) ",
etherproto_string(htons(extracted_ethertype)));
}
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
}
diff --git a/print-lane.c b/print-lane.c
index 03e5652d..ab03a44a 100644
--- a/print-lane.c
+++ b/print-lane.c
@@ -22,7 +22,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.23 2004-03-17 23:24:37 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.24 2005-07-07 01:22:19 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -146,7 +146,7 @@ lane_print(const u_char *p, u_int length, u_int caplen)
printf("(LLC %s) ",
etherproto_string(htons(extracted_ethertype)));
}
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
} else if (ether_encap_print(ether_type, p, length, caplen,
@@ -154,7 +154,7 @@ lane_print(const u_char *p, u_int length, u_int caplen)
/* ether_type not known, print raw packet */
if (!eflag)
lane_hdr_print((u_char *)ep, length + sizeof(*ep));
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
}
diff --git a/print-null.c b/print-null.c
index 11f90ef3..6de6d489 100644
--- a/print-null.c
+++ b/print-null.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.55 2005-05-19 07:25:49 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.56 2005-07-07 01:22:19 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -173,7 +173,7 @@ null_if_print(const struct pcap_pkthdr *h, const u_char *p)
/* unknown AF_ value */
if (!eflag)
null_hdr_print(family, length + NULL_HDRLEN);
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
diff --git a/print-pflog.c b/print-pflog.c
index 6cd004cc..0505af9d 100644
--- a/print-pflog.c
+++ b/print-pflog.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.13 2005-04-06 21:32:41 mcr Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.14 2005-07-07 01:22:20 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -152,7 +152,7 @@ pflog_if_print(const struct pcap_pkthdr *h, register const u_char *p)
/* address family not handled, print raw packet */
if (!eflag)
pflog_print(hdr);
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
diff --git a/print-sctp.c b/print-sctp.c
index b18ab793..d38cfde2 100644
--- a/print-sctp.c
+++ b/print-sctp.c
@@ -35,7 +35,7 @@
#ifndef lint
static const char rcsid[] _U_ =
-"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.19 2005-05-06 10:53:01 guy Exp $ (NETLAB/PEL)";
+"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.20 2005-07-07 01:22:20 guy Exp $ (NETLAB/PEL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -200,7 +200,7 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
printf("[Payload");
- if (!xflag && !qflag) {
+ if (!suppress_default_print) {
payloadPtr = (const u_char *) (++dataHdrPtr);
printf(":");
if (htons(chunkDescPtr->chunkLength) <
diff --git a/print-sll.c b/print-sll.c
index c08dd83b..98958302 100644
--- a/print-sll.c
+++ b/print-sll.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.17 2005-04-26 00:16:28 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.18 2005-07-07 01:22:21 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -181,7 +181,7 @@ sll_if_print(const struct pcap_pkthdr *h, const u_char *p)
printf("(LLC %s) ",
etherproto_string(htons(extracted_ethertype)));
}
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
break;
}
@@ -190,7 +190,7 @@ sll_if_print(const struct pcap_pkthdr *h, const u_char *p)
/* ether_type not known, print raw packet */
if (!eflag)
sll_print(sllp, length + SLL_HDR_LEN);
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
diff --git a/print-symantec.c b/print-symantec.c
index ec5f02e1..ebb62cd4 100644
--- a/print-symantec.c
+++ b/print-symantec.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-symantec.c,v 1.4 2004-04-05 00:13:59 mcr Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-symantec.c,v 1.5 2005-07-07 01:22:21 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -105,7 +105,7 @@ symantec_if_print(const struct pcap_pkthdr *h, const u_char *p)
if (!eflag)
symantec_hdr_print((u_char *)sp, length + sizeof (struct symantec_header));
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
} else if (ether_encap_print(ether_type, p, length, caplen,
&extracted_ether_type) == 0) {
@@ -113,7 +113,7 @@ symantec_if_print(const struct pcap_pkthdr *h, const u_char *p)
if (!eflag)
symantec_hdr_print((u_char *)sp, length + sizeof (struct symantec_header));
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
diff --git a/print-token.c b/print-token.c
index 1ef215d2..d17e9506 100644
--- a/print-token.c
+++ b/print-token.c
@@ -25,7 +25,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.25 2004-03-17 23:24:38 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.26 2005-07-07 01:22:21 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -167,7 +167,7 @@ token_print(const u_char *p, u_int length, u_int caplen)
printf("(LLC %s) ",
etherproto_string(htons(extracted_ethertype)));
}
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
} else {
@@ -176,7 +176,7 @@ token_print(const u_char *p, u_int length, u_int caplen)
if (!eflag)
token_hdr_print(trp, length + TOKEN_HDRLEN + route_len,
ESRC(&ehdr), EDST(&ehdr));
- if (!xflag && !qflag)
+ if (!suppress_default_print)
default_print(p, caplen);
}
return (hdr_len);
diff --git a/tcpdump.c b/tcpdump.c
index 3cb39fcc..44a218da 100644
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -30,7 +30,7 @@ static const char copyright[] _U_ =
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
The Regents of the University of California. All rights reserved.\n";
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.259 2005-07-06 20:53:32 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.260 2005-07-07 01:22:21 guy Exp $ (LBL)";
#endif
/*
@@ -653,6 +653,7 @@ main(int argc, char **argv)
case 'q':
++qflag;
+ ++suppress_default_print;
break;
case 'r':
@@ -733,10 +734,12 @@ main(int argc, char **argv)
case 'x':
++xflag;
+ ++suppress_default_print;
break;
case 'X':
++Xflag;
+ ++suppress_default_print;
break;
case 'y':