summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguy <guy>2001-07-05 18:54:13 +0000
committerguy <guy>2001-07-05 18:54:13 +0000
commit176a3e498602351ae25833cf7456c1e30f7f59ae (patch)
treef6232fbc4f99e7043b1b41552a1ecbd3e534d458
parent2cfe2bf4a5bdba199215e4c92129a36271b10a64 (diff)
downloadtcpdump-176a3e498602351ae25833cf7456c1e30f7f59ae.tar.gz
Put the infodelay wrapping into the remaining "XXX_if_print()" routines.
Split the Cisco HDLC printer into "chdlc_if_print()", which does the stuff expected of a low-level print routine (printing the time stamp, printing the final newline, doing the infodelay stuff) and "chdlc_print()", which doesn't do that stuff. This lets us clean up "ppp_hdlc_if_print()" a bit - it can just print the time stamp at the beginning, and do the infodelay stuff at the end, without having to treat Cisco HDLC specially by skipping the time stamp printing. (This also ensures that the time stamp is always printed, which wasn't the case before.) Print the missing final newline in "pppoe_if_print()".
-rw-r--r--interface.h3
-rw-r--r--print-802_11.c6
-rw-r--r--print-arcnet.c6
-rw-r--r--print-atalk.c6
-rw-r--r--print-atm.c6
-rw-r--r--print-chdlc.c33
-rw-r--r--print-cip.c6
-rw-r--r--print-lane.c6
-rw-r--r--print-null.c6
-rw-r--r--print-ppp.c25
-rw-r--r--print-pppoe.c7
-rw-r--r--print-raw.c6
-rw-r--r--print-sl.c10
-rw-r--r--print-sll.c6
14 files changed, 101 insertions, 31 deletions
diff --git a/interface.h b/interface.h
index 888dd81e..1113d482 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.165 2001-07-04 22:03:13 fenner Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.166 2001-07-05 18:54:13 guy Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
@@ -249,6 +249,7 @@ extern void sl_bsdos_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
extern void chdlc_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
+extern void chdlc_print(register const u_char *, u_int, u_int);
extern void sll_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern void snmp_print(const u_char *, u_int);
extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
diff --git a/print-802_11.c b/print-802_11.c
index 3c98cf4d..3a6914f7 100644
--- a/print-802_11.c
+++ b/print-802_11.c
@@ -22,7 +22,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.4 2001-06-15 07:39:43 itojun Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.5 2001-07-05 18:54:13 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -771,6 +771,7 @@ ieee802_11_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
u_int HEADER_LENGTH;
u_short extracted_ethertype;
+ ++infodelay;
ts_print(&h->ts);
if (caplen < IEEE802_11_FC_LEN) {
@@ -851,4 +852,7 @@ ieee802_11_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
default_print(p, caplen);
out:
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}
diff --git a/print-arcnet.c b/print-arcnet.c
index b5537509..bdfe46c7 100644
--- a/print-arcnet.c
+++ b/print-arcnet.c
@@ -22,7 +22,7 @@
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.3 2001-05-22 06:23:29 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.4 2001-07-05 18:54:14 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -141,6 +141,7 @@ arcnet_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
u_int seqid = 0;
u_char arc_type;
+ ++infodelay;
ts_print(&h->ts);
if (caplen < ARC_HDRLEN) {
@@ -216,6 +217,9 @@ arcnet_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
out:
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}
/*
diff --git a/print-atalk.c b/print-atalk.c
index 19e43097..30ae8b4e 100644
--- a/print-atalk.c
+++ b/print-atalk.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.66 2001-06-18 08:52:53 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.67 2001-07-05 18:54:14 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -90,11 +90,15 @@ void
ltalk_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
{
snapend = p + h->caplen;
+ ++infodelay;
ts_print(&h->ts);
llap_print(p, h->caplen);
if(xflag)
default_print(p, h->caplen);
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}
/*
diff --git a/print-atm.c b/print-atm.c
index 7458116f..e2a2a46e 100644
--- a/print-atm.c
+++ b/print-atm.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.20 2000-12-22 22:45:09 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.21 2001-07-05 18:54:14 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -53,6 +53,7 @@ atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
u_int length = h->len;
u_short ethertype;
+ ++infodelay;
ts_print(&h->ts);
if (caplen < 8) {
@@ -141,4 +142,7 @@ atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
default_print(p, caplen);
out:
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}
diff --git a/print-chdlc.c b/print-chdlc.c
index aa1b330d..b415d4e7 100644
--- a/print-chdlc.c
+++ b/print-chdlc.c
@@ -22,7 +22,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.11 2000-10-09 01:53:19 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.12 2001-07-05 18:54:14 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -54,25 +54,38 @@ chdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
{
register u_int length = h->len;
register u_int caplen = h->caplen;
- const struct ip *ip;
- u_int proto;
+ ++infodelay;
ts_print(&h->ts);
- if (caplen < CHDLC_HDRLEN) {
- printf("[|chdlc]");
- 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.
*/
- proto = ntohs(*(u_short *)&p[2]);
packetp = p;
snapend = p + caplen;
+ chdlc_print(p, length, caplen);
+
+ putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
+}
+
+void
+chdlc_print(register const u_char *p, u_int length, u_int caplen)
+{
+ const struct ip *ip;
+ u_int proto;
+
+ if (caplen < CHDLC_HDRLEN) {
+ printf("[|chdlc]");
+ return;
+ }
+
+ proto = ntohs(*(u_short *)&p[2]);
if (eflag) {
switch (p[0]) {
case CHDLC_UNICAST:
@@ -110,8 +123,6 @@ chdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
}
if (xflag)
default_print((const u_char *)ip, caplen - CHDLC_HDRLEN);
-out:
- putchar('\n');
}
struct cisco_slarp {
diff --git a/print-cip.c b/print-cip.c
index f3afd308..45ece55f 100644
--- a/print-cip.c
+++ b/print-cip.c
@@ -22,7 +22,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.13 2001-06-08 04:48:23 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.14 2001-07-05 18:54:15 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -96,6 +96,7 @@ cip_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
u_short extracted_ethertype;
u_short *bp;
+ ++infodelay;
ts_print(&h->ts);
if (memcmp(rfcllc, p, sizeof(rfcllc))==0 && caplen < RFC1483LLC_LEN) {
@@ -155,4 +156,7 @@ cip_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
default_print(p, caplen);
out:
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}
diff --git a/print-lane.c b/print-lane.c
index 6aadad46..2836f788 100644
--- a/print-lane.c
+++ b/print-lane.c
@@ -22,7 +22,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.11 2000-12-22 22:45:11 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.12 2001-07-05 18:54:15 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -81,6 +81,7 @@ lane_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
u_short ether_type;
u_short extracted_ethertype;
+ ++infodelay;
ts_print(&h->ts);
if (caplen < sizeof(struct lecdatahdr_8023)) {
@@ -136,4 +137,7 @@ lane_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
default_print(p, caplen);
out:
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}
diff --git a/print-null.c b/print-null.c
index a602bc3a..30724ec6 100644
--- a/print-null.c
+++ b/print-null.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.40 2000-12-16 22:00:50 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.41 2001-07-05 18:54:15 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -113,6 +113,7 @@ null_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
const struct ip *ip;
u_int family;
+ ++infodelay;
ts_print(&h->ts);
memcpy((char *)&family, (char *)p, sizeof(family));
@@ -160,5 +161,8 @@ null_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
if (xflag)
default_print((const u_char *)ip, caplen - NULL_HDRLEN);
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}
diff --git a/print-ppp.c b/print-ppp.c
index 1dd2a98f..9b1f362b 100644
--- a/print-ppp.c
+++ b/print-ppp.c
@@ -31,7 +31,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.61 2001-06-11 10:33:03 itojun Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.62 2001-07-05 18:54:16 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -1032,6 +1032,7 @@ ppp_if_print(u_char *user, const struct pcap_pkthdr *h,
register u_int length = h->len;
register u_int caplen = h->caplen;
+ ++infodelay;
ts_print(&h->ts);
if (caplen < PPP_HDRLEN) {
@@ -1094,6 +1095,9 @@ ppp_if_print(u_char *user, const struct pcap_pkthdr *h,
default_print(p, caplen);
out:
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}
/*
@@ -1113,6 +1117,9 @@ ppp_hdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
register u_int caplen = h->caplen;
u_int proto;
+ ++infodelay;
+ ts_print(&h->ts);
+
if (caplen < 2) {
printf("[|ppp]");
goto out;
@@ -1134,7 +1141,6 @@ ppp_hdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
goto out;
}
- ts_print(&h->ts);
if (eflag)
printf("%02x %02x %d ", p[0], p[1], length);
p += 2;
@@ -1151,14 +1157,10 @@ ppp_hdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
case CHDLC_UNICAST:
case CHDLC_BCAST:
- /*
- * Have the Cisco HDLC print routine do all the work.
- */
- chdlc_if_print(user, h, p);
- return;
+ chdlc_print(p, length, caplen);
+ goto out;
default:
- ts_print(&h->ts);
if (eflag)
printf("%02x %02x %d ", p[0], p[1], length);
p += 2;
@@ -1177,6 +1179,9 @@ ppp_hdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
default_print(p, caplen);
out:
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}
@@ -1231,6 +1236,7 @@ ppp_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h,
const u_char *q;
int i;
+ ++infodelay;
ts_print(&h->ts);
if (caplen < PPP_BSDI_HDRLEN) {
@@ -1372,5 +1378,8 @@ printx:
default_print((const u_char *)p, caplen - hdrlength);
out:
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
#endif /* __bsdi__ */
}
diff --git a/print-pppoe.c b/print-pppoe.c
index 5369a983..c6a2cb44 100644
--- a/print-pppoe.c
+++ b/print-pppoe.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
-"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.14 2001-06-20 07:40:44 guy Exp $ (LBL)";
+"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.15 2001-07-05 18:54:17 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -100,6 +100,7 @@ pppoe_if_print(u_char *user, const struct pcap_pkthdr *h,
register u_int length = h->len;
register u_int caplen = h->caplen;
+ ++infodelay;
ts_print(&h->ts);
/*
@@ -111,6 +112,10 @@ pppoe_if_print(u_char *user, const struct pcap_pkthdr *h,
snapend = p + caplen;
pppoe_print(p, length);
+ putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}
void
diff --git a/print-raw.c b/print-raw.c
index 7502394a..979b5f8f 100644
--- a/print-raw.c
+++ b/print-raw.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.33 2000-10-06 04:23:13 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.34 2001-07-05 18:54:17 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -53,6 +53,7 @@ raw_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
u_int length = h->len;
u_int caplen = h->caplen;
+ ++infodelay;
ts_print(&h->ts);
/*
@@ -71,4 +72,7 @@ raw_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
if (xflag)
default_print(p, caplen);
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}
diff --git a/print-sl.c b/print-sl.c
index d4f7edd7..2ddad050 100644
--- a/print-sl.c
+++ b/print-sl.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.56 2000-10-10 05:06:10 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.57 2001-07-05 18:54:17 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -60,6 +60,7 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
register u_int length = h->len;
register const struct ip *ip;
+ ++infodelay;
ts_print(&h->ts);
if (caplen < SLIP_HDRLEN) {
@@ -98,6 +99,9 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
default_print((u_char *)ip, caplen - SLIP_HDRLEN);
out:
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}
@@ -108,6 +112,7 @@ sl_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
register u_int length = h->len;
register const struct ip *ip;
+ ++infodelay;
ts_print(&h->ts);
if (caplen < SLIP_HDRLEN) {
@@ -137,6 +142,9 @@ sl_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
default_print((u_char *)ip, caplen - SLIP_HDRLEN);
out:
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}
static void
diff --git a/print-sll.c b/print-sll.c
index d8661a9e..836140fd 100644
--- a/print-sll.c
+++ b/print-sll.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.5 2001-06-08 04:48:23 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.6 2001-07-05 18:54:18 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -110,6 +110,7 @@ sll_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
u_short ether_type;
u_short extracted_ethertype;
+ ++infodelay;
ts_print(&h->ts);
if (caplen < SLL_HDR_LEN) {
@@ -239,4 +240,7 @@ sll_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
default_print(p, caplen);
out:
putchar('\n');
+ --infodelay;
+ if (infoprint)
+ info(0);
}