summaryrefslogtreecommitdiff
path: root/print-null.c
diff options
context:
space:
mode:
authorguy <guy>2002-12-19 09:39:10 +0000
committerguy <guy>2002-12-19 09:39:10 +0000
commit4bec97f457e593be925e92fa28d73af6a57d81cf (patch)
treefcb53f0e4e3a5749d84858f128e7f6c7e352c23e /print-null.c
parent60761585472a90c34d7de7bdf50475f0d7261b2d (diff)
downloadtcpdump-4bec97f457e593be925e92fa28d73af6a57d81cf.tar.gz
Hoist a bunch of stuff that should be done by all if_print routines into
tcpdump.c. Have if_print routines return the length of the link-layer header, so that the common code knows how to skip the link-layer header when printing the packet in hex/ASCII.
Diffstat (limited to 'print-null.c')
-rw-r--r--print-null.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/print-null.c b/print-null.c
index 064408a0..6b7ffe7b 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.46 2002-12-18 09:41:16 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.47 2002-12-19 09:39:13 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -96,17 +96,13 @@ null_print(u_int family, u_int length)
#define SWAPLONG(y) \
((((y)&0xff)<<24) | (((y)&0xff00)<<8) | (((y)&0xff0000)>>8) | (((y)>>24)&0xff))
-void
-null_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
+u_int
+null_if_print(const struct pcap_pkthdr *h, const u_char *p)
{
u_int length = h->len;
- u_int caplen = h->caplen;
const struct ip *ip;
u_int family;
- ++infodelay;
- ts_print(&h->ts);
-
memcpy((char *)&family, (char *)p, sizeof(family));
/*
@@ -120,13 +116,6 @@ null_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
if ((family & 0xFFFF0000) != 0)
family = SWAPLONG(family);
- /*
- * Some printers want to check that they're not walking off the
- * end of the packet.
- * Rather than pass it all the way down, we set this global.
- */
- snapend = p + caplen;
-
length -= NULL_HDRLEN;
ip = (struct ip *)(p + NULL_HDRLEN);
@@ -148,11 +137,6 @@ null_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
break;
}
- if (xflag)
- default_print_packet(p, caplen, NULL_HDRLEN);
- putchar('\n');
- --infodelay;
- if (infoprint)
- info(0);
+ return (NULL_HDRLEN);
}