summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface.h5
-rw-r--r--print-802_11.c100
-rw-r--r--print-arcnet.c9
-rw-r--r--print-atm.c22
-rw-r--r--print-bootp.c15
-rw-r--r--print-chdlc.c9
-rw-r--r--print-cip.c9
-rw-r--r--print-ether.c10
-rw-r--r--print-fddi.c17
-rw-r--r--print-fr.c9
-rw-r--r--print-ipfc.c16
-rw-r--r--print-lane.c9
-rw-r--r--print-null.c9
-rw-r--r--print-pflog.c9
-rw-r--r--print-ppp.c25
-rw-r--r--print-pppoe.c9
-rw-r--r--print-raw.c9
-rw-r--r--print-sl.c18
-rw-r--r--print-sll.c60
-rw-r--r--print-token.c17
20 files changed, 165 insertions, 221 deletions
diff --git a/interface.h b/interface.h
index e48cf7ed..36e9229c 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.200 2002-12-13 00:40:34 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.201 2002-12-18 08:53:18 guy Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
@@ -129,8 +129,7 @@ extern char *program_name; /* used to generate self-identifying messages */
extern int32_t thiszone; /* seconds offset from gmt to local time */
extern int snaplen;
-/* global pointers to beginning and end of current packet (during printing) */
-extern const u_char *packetp;
+/* global pointer to end of current packet (during printing) */
extern const u_char *snapend;
/*
diff --git a/print-802_11.c b/print-802_11.c
index cf414d43..1650912d 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.16 2002-12-17 09:13:45 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.17 2002-12-18 08:53:19 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -590,7 +590,9 @@ static int ctrl_body_print(u_int16_t fc, const u_char *p)
* 1 | 1 | RA | TA | DA | SA
*/
-static void data_header_print(u_int16_t fc, const u_char *p)
+static void
+data_header_print(u_int16_t fc, const u_char *p, const u_int8_t **srcp,
+ const u_int8_t **dstp)
{
#define ADDR1 (p + 4)
#define ADDR2 (p + 10)
@@ -598,23 +600,49 @@ static void data_header_print(u_int16_t fc, const u_char *p)
#define ADDR4 (p + 24)
if (!FC_TO_DS(fc)) {
- if (!FC_FROM_DS(fc))
+ if (!FC_FROM_DS(fc)) {
+ if (srcp != NULL)
+ *srcp = ADDR2;
+ if (dstp != NULL)
+ *dstp = ADDR1;
+ if (!eflag)
+ return;
printf("DA:%s SA:%s BSSID:%s ",
etheraddr_string(ADDR1), etheraddr_string(ADDR2),
etheraddr_string(ADDR3));
- else
+ } else {
+ if (srcp != NULL)
+ *srcp = ADDR3;
+ if (dstp != NULL)
+ *dstp = ADDR1;
+ if (!eflag)
+ return;
printf("DA:%s BSSID:%s SA:%s ",
etheraddr_string(ADDR1), etheraddr_string(ADDR2),
etheraddr_string(ADDR3));
+ }
} else {
- if (!FC_FROM_DS(fc))
+ if (!FC_FROM_DS(fc)) {
+ if (srcp != NULL)
+ *srcp = ADDR2;
+ if (dstp != NULL)
+ *dstp = ADDR3;
+ if (!eflag)
+ return;
printf("BSSID:%s SA:%s DA:%s ",
etheraddr_string(ADDR1), etheraddr_string(ADDR2),
etheraddr_string(ADDR3));
- else
+ } else {
+ if (srcp != NULL)
+ *srcp = ADDR4;
+ if (dstp != NULL)
+ *dstp = ADDR3;
+ if (!eflag)
+ return;
printf("RA:%s TA:%s DA:%s SA:%s ",
etheraddr_string(ADDR1), etheraddr_string(ADDR2),
etheraddr_string(ADDR3), etheraddr_string(ADDR4));
+ }
}
#undef ADDR1
@@ -624,17 +652,35 @@ static void data_header_print(u_int16_t fc, const u_char *p)
}
-static void mgmt_header_print(const u_char *p)
+static void
+mgmt_header_print(const u_char *p, const u_int8_t **srcp,
+ const u_int8_t **dstp)
{
const struct mgmt_header_t *hp = (const struct mgmt_header_t *) p;
+ if (srcp != NULL)
+ *srcp = hp->sa;
+ if (dstp != NULL)
+ *dstp = hp->da;
+ if (!eflag)
+ return;
+
printf("BSSID:%s DA:%s SA:%s ",
etheraddr_string((hp)->bssid), etheraddr_string((hp)->da),
etheraddr_string((hp)->sa));
}
-static void ctrl_header_print(u_int16_t fc, const u_char *p)
+static void
+ctrl_header_print(u_int16_t fc, const u_char *p, const u_int8_t **srcp,
+ const u_int8_t **dstp)
{
+ if (srcp != NULL)
+ *srcp = NULL;
+ if (dstp != NULL)
+ *dstp = NULL;
+ if (!eflag)
+ return;
+
switch (FC_SUBTYPE(fc)) {
case CTRL_PS_POLL:
printf("BSSID:%s TA:%s ",
@@ -666,6 +712,7 @@ static void ctrl_header_print(u_int16_t fc, const u_char *p)
break;
default:
printf("(H) Unknown Ctrl Subtype");
+ break;
}
}
@@ -718,27 +765,32 @@ static int GetHeaderLength(u_int16_t fc)
}
/*
- * Print the 802.11 MAC header
+ * Print the 802.11 MAC header if eflag is set, and set "*srcp" and "*dstp"
+ * to point to the source and destination MAC addresses in any case if
+ * "srcp" and "dstp" aren't null.
*/
static inline void
-ieee_802_11_hdr_print(u_int16_t fc, const u_char *p)
+ieee_802_11_hdr_print(u_int16_t fc, const u_char *p, const u_int8_t **srcp,
+ const u_int8_t **dstp)
{
switch (FC_TYPE(fc)) {
case T_MGMT:
- mgmt_header_print(p);
+ mgmt_header_print(p, srcp, dstp);
break;
case T_CTRL:
- ctrl_header_print(fc, p);
+ ctrl_header_print(fc, p, srcp, dstp);
break;
case T_DATA:
- data_header_print(fc, p);
+ data_header_print(fc, p, srcp, dstp);
break;
default:
printf("(header) unknown IEEE802.11 frame type (%d)",
FC_TYPE(fc));
+ *srcp = NULL;
+ *dstp = NULL;
break;
}
}
@@ -748,6 +800,7 @@ ieee802_11_print(const u_char *p, u_int length, u_int caplen)
{
u_int16_t fc;
u_int HEADER_LENGTH;
+ const u_int8_t *src, *dst;
u_short extracted_ethertype;
if (caplen < IEEE802_11_FC_LEN) {
@@ -763,15 +816,13 @@ ieee802_11_print(const u_char *p, u_int length, u_int caplen)
return;
}
- if (eflag)
- ieee_802_11_hdr_print(fc, p);
+ ieee_802_11_hdr_print(fc, p, &src, &dst);
/*
- * Some printers want to get back at the ethernet 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.
+ * 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.
*/
- packetp = p;
snapend = p + caplen;
length -= HEADER_LENGTH;
@@ -780,8 +831,8 @@ ieee802_11_print(const u_char *p, u_int length, u_int caplen)
switch (FC_TYPE(fc)) {
case T_MGMT:
- if (!mgmt_body_print(fc, (const struct mgmt_header_t *)packetp,
- p)) {
+ if (!mgmt_body_print(fc,
+ (const struct mgmt_header_t *)(p - HEADER_LENGTH), p)) {
printf("[|802.11]");
return;
}
@@ -802,14 +853,15 @@ ieee802_11_print(const u_char *p, u_int length, u_int caplen)
return;
}
} else {
- if (llc_print(p, length, caplen, packetp + 10,
- packetp + 4, &extracted_ethertype) == 0) {
+ if (llc_print(p, length, caplen, dst, src,
+ &extracted_ethertype) == 0) {
/*
* Some kinds of LLC packet we cannot
* handle intelligently
*/
if (!eflag)
- ieee_802_11_hdr_print(fc, p - HEADER_LENGTH);
+ ieee_802_11_hdr_print(fc, p - HEADER_LENGTH,
+ NULL, NULL);
if (extracted_ethertype) {
printf("(LLC %s) ",
etherproto_string(htons(extracted_ethertype)));
diff --git a/print-arcnet.c b/print-arcnet.c
index 56f7f1e3..30e42a81 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.10 2002-09-05 21:25:37 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.11 2002-12-18 08:53:19 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -168,11 +168,10 @@ arcnet_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
arcnet_print(p, length, phds, flag, seqid);
/*
- * Some printers want to get back at the ethernet 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.
+ * 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.
*/
- packetp = p;
snapend = p + caplen;
length -= archdrlen;
diff --git a/print-atm.c b/print-atm.c
index b1e59850..77977b25 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.30 2002-12-11 06:55:08 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.31 2002-12-18 08:53:19 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -49,27 +49,9 @@ static const char rcsid[] =
static void
atm_llc_print(const u_char *p, int length, int caplen)
{
- struct ether_header ehdr;
u_short extracted_ethertype;
- /*
- * Fake up an Ethernet header for the benefit of printers that
- * insist on "packetp" pointing to an Ethernet header.
- */
- memset(&ehdr, '\0', sizeof ehdr);
-
- /*
- * Some printers want to get back at the ethernet addresses.
- * Rather than pass it all the way down, we set this global.
- *
- * Actually, the only printers that use packetp are print-arp.c
- * and print-bootp.c, and they assume that packetp points to an
- * Ethernet header. The right thing to do is to fix them to know
- * which link type is in use when they excavate. XXX
- */
- packetp = (u_char *)&ehdr;
-
- if (!llc_print(p, length, caplen, ESRC(&ehdr), EDST(&ehdr),
+ if (!llc_print(p, length, caplen, NULL, NULL,
&extracted_ethertype)) {
/* ether_type not known, print raw packet */
if (extracted_ethertype) {
diff --git a/print-bootp.c b/print-bootp.c
index ed7c76ab..ebf4739d 100644
--- a/print-bootp.c
+++ b/print-bootp.c
@@ -22,7 +22,7 @@
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.68 2002-12-11 07:13:58 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.69 2002-12-18 08:53:20 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -123,19 +123,8 @@ bootp_print(register const u_char *cp, u_short sport, u_short dport, u_int lengt
/* Client's Ethernet address */
if (bp->bp_htype == 1 && bp->bp_hlen == 6) {
- register const struct ether_header *eh;
- register const char *e;
-
TCHECK2(bp->bp_chaddr[0], 6);
- eh = (const struct ether_header *)packetp;
- if (bp->bp_op == BOOTREQUEST)
- e = (const char *)ESRC(eh);
- else if (bp->bp_op == BOOTREPLY)
- e = (const char *)EDST(eh);
- else
- e = NULL;
- if ( bp->bp_chaddr != NULL )
- printf("\n\t Client Ethernet Address: %s", etheraddr_string(bp->bp_chaddr));
+ printf("\n\t Client Ethernet Address: %s", etheraddr_string(bp->bp_chaddr));
}
TCHECK2(bp->bp_sname[0], 1); /* check first char only */
diff --git a/print-chdlc.c b/print-chdlc.c
index f958ca4f..41a4d521 100644
--- a/print-chdlc.c
+++ b/print-chdlc.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.24 2002-12-11 07:13:58 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.25 2002-12-18 08:53:20 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -54,11 +54,10 @@ chdlc_if_print(u_char *user _U_, const struct pcap_pkthdr *h,
ts_print(&h->ts);
/*
- * 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.
+ * 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.
*/
- packetp = p;
snapend = p + caplen;
chdlc_print(p, length, caplen);
diff --git a/print-cip.c b/print-cip.c
index e986e52c..27986986 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.19 2002-09-05 21:25:38 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.20 2002-12-18 08:53:20 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -85,11 +85,10 @@ cip_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
cip_print(length);
/*
- * Some printers want to get back at the ethernet 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.
+ * 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.
*/
- packetp = p;
snapend = p + caplen;
if (memcmp(rfcllc, p, sizeof(rfcllc)) == 0) {
diff --git a/print-ether.c b/print-ether.c
index 5909f4c6..2d392730 100644
--- a/print-ether.c
+++ b/print-ether.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.73 2002-09-05 21:25:40 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.74 2002-12-18 08:53:21 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -38,7 +38,6 @@ static const char rcsid[] =
#include "ether.h"
-const u_char *packetp;
const u_char *snapend;
static inline void
@@ -76,11 +75,10 @@ ether_print(const u_char *p, u_int length, u_int caplen)
ether_hdr_print(p, length);
/*
- * Some printers want to get back at the ethernet 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.
+ * 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.
*/
- packetp = p;
snapend = p + caplen;
length -= ETHER_HDRLEN;
diff --git a/print-fddi.c b/print-fddi.c
index c97134a6..762feaca 100644
--- a/print-fddi.c
+++ b/print-fddi.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.58 2002-09-05 21:25:40 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.59 2002-12-18 08:53:21 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -249,23 +249,18 @@ fddi_print(const u_char *p, u_int length, u_int caplen)
printf("[|fddi]");
return;
}
+
/*
* Get the FDDI addresses into a canonical form
*/
extract_fddi_addrs(fddip, (char *)ESRC(&ehdr), (char *)EDST(&ehdr));
+
/*
- * 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.
+ * 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;
- /*
- * Actually, the only printers that use packetp are print-arp.c
- * and print-bootp.c, and they assume that packetp points to an
- * Ethernet header. The right thing to do is to fix them to know
- * which link type is in use when they excavate. XXX
- */
- packetp = (u_char *)&ehdr;
if (eflag)
fddi_hdr_print(fddip, length, ESRC(&ehdr), EDST(&ehdr));
diff --git a/print-fr.c b/print-fr.c
index 13dc8f9b..f639dc62 100644
--- a/print-fr.c
+++ b/print-fr.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.8 2002-12-11 07:14:00 guy Exp $ (LBL)";
+ "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.9 2002-12-18 08:53:21 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -231,11 +231,10 @@ fr_if_print(u_char *user _U_, const struct pcap_pkthdr *h,
}
/*
- * 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.
+ * 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.
*/
- packetp = p;
snapend = p + caplen;
if (eflag)
diff --git a/print-ipfc.c b/print-ipfc.c
index bcad6c39..a33cfbdf 100644
--- a/print-ipfc.c
+++ b/print-ipfc.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ipfc.c,v 1.1 2002-10-18 09:17:48 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ipfc.c,v 1.2 2002-12-18 08:53:21 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -92,19 +92,13 @@ ipfc_print(const u_char *p, u_int length, u_int caplen)
* Get the network addresses into a canonical form
*/
extract_ipfc_addrs(ipfcp, (char *)ESRC(&ehdr), (char *)EDST(&ehdr));
+
/*
- * 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.
+ * 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;
- /*
- * Actually, the only printers that use packetp are print-arp.c
- * and print-bootp.c, and they assume that packetp points to an
- * Ethernet header. The right thing to do is to fix them to know
- * which link type is in use when they excavate. XXX
- */
- packetp = (u_char *)&ehdr;
if (eflag)
ipfc_hdr_print(ipfcp, length, ESRC(&ehdr), EDST(&ehdr));
diff --git a/print-lane.c b/print-lane.c
index c319e30d..fe0afb4b 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.17 2002-12-11 07:14:04 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.18 2002-12-18 08:53:22 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -122,11 +122,10 @@ lane_print(const u_char *p, u_int length, u_int caplen)
lane_hdr_print(p, length);
/*
- * Some printers want to get back at the ethernet 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.
+ * 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.
*/
- packetp = p + 2; /* skip the LECID */
snapend = p + caplen;
length -= sizeof(struct lecdatahdr_8023);
diff --git a/print-null.c b/print-null.c
index cfd41e66..cdbb3734 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.44 2002-09-05 21:25:44 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.45 2002-12-18 08:53:22 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -121,11 +121,10 @@ null_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
family = SWAPLONG(family);
/*
- * 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.
+ * 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.
*/
- packetp = p;
snapend = p + caplen;
length -= NULL_HDRLEN;
diff --git a/print-pflog.c b/print-pflog.c
index b8485ea5..f122a5a3 100644
--- a/print-pflog.c
+++ b/print-pflog.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.4 2002-09-05 21:25:44 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.5 2002-12-18 08:53:22 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -113,11 +113,10 @@ pflog_if_print(u_char *user _U_, const struct pcap_pkthdr *h,
}
/*
- * 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.
+ * 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.
*/
- packetp = p;
snapend = p + caplen;
hdr = (const struct pfloghdr *)p;
diff --git a/print-ppp.c b/print-ppp.c
index 8b418a14..6103be4b 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.77 2002-11-03 23:04:07 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.78 2002-12-18 08:53:23 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -1056,11 +1056,10 @@ ppp_if_print(u_char *user _U_, const struct pcap_pkthdr *h,
}
/*
- * 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;
+ * 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;
#if 0
@@ -1141,11 +1140,10 @@ ppp_hdlc_if_print(u_char *user _U_, const struct pcap_pkthdr *h,
}
/*
- * 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.
+ * 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.
*/
- packetp = p;
snapend = p + caplen;
switch (p[0]) {
@@ -1222,11 +1220,10 @@ ppp_bsdos_if_print(u_char *user _U_, const struct pcap_pkthdr *h _U_,
}
/*
- * 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.
+ * 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.
*/
- packetp = p;
snapend = p + caplen;
hdrlength = 0;
diff --git a/print-pppoe.c b/print-pppoe.c
index 3456225b..3d78f4ce 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.18 2002-09-05 21:25:45 guy Exp $ (LBL)";
+"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.19 2002-12-18 08:53:23 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -101,11 +101,10 @@ pppoe_if_print(u_char *user _U_, const struct pcap_pkthdr *h,
ts_print(&h->ts);
/*
- * 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.
+ * 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.
*/
- packetp = p;
snapend = p + caplen;
hdr_len = pppoe_print(p, length);
diff --git a/print-raw.c b/print-raw.c
index c8cba8f7..88a276f6 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.37 2002-09-05 21:25:46 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.38 2002-12-18 08:53:23 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -51,11 +51,10 @@ raw_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
ts_print(&h->ts);
/*
- * 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.
+ * 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.
*/
- packetp = p;
snapend = p + caplen;
if (eflag)
diff --git a/print-sl.c b/print-sl.c
index 4fec3d09..75056462 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.59 2002-09-05 21:25:47 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.60 2002-12-18 08:53:24 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -62,12 +62,12 @@ sl_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
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.
+ * 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.
*/
- packetp = p;
snapend = p + caplen;
length -= SLIP_HDRLEN;
@@ -114,12 +114,12 @@ sl_bsdos_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p
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.
+ * 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.
*/
- packetp = p;
snapend = p + caplen;
length -= SLIP_HDRLEN;
diff --git a/print-sll.c b/print-sll.c
index 7454d334..2cd90f72 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.9 2002-09-05 21:25:48 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.10 2002-12-18 08:53:24 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -98,8 +98,6 @@ sll_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
u_int caplen = h->caplen;
u_int length = h->len;
register const struct sll_header *sllp;
- u_short pkttype;
- struct ether_header ehdr;
u_short ether_type;
u_short extracted_ethertype;
@@ -118,61 +116,15 @@ sll_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
sllp = (const struct sll_header *)p;
- /*
- * Fake up an Ethernet header for the benefit of printers that
- * insist on "packetp" pointing to an Ethernet header.
- */
- pkttype = ntohs(sllp->sll_pkttype);
-
- /* The source address is in the packet header */
- memcpy(ehdr.ether_shost, sllp->sll_addr, ETHER_ADDR_LEN);
-
- if (pkttype != LINUX_SLL_OUTGOING) {
- /*
- * We received this packet.
- *
- * We don't know the destination address, so
- * we fake it - all 0's except that the
- * bottommost bit of the bottommost octet
- * is set for a unicast packet, all 0's except
- * that the bottommost bit of the uppermost
- * octet is set for a multicast packet, all
- * 1's for a broadcast packet.
- */
- if (pkttype == LINUX_SLL_BROADCAST)
- memset(ehdr.ether_dhost, 0xFF, ETHER_ADDR_LEN);
- else {
- memset(ehdr.ether_dhost, 0, ETHER_ADDR_LEN);
- if (pkttype == LINUX_SLL_MULTICAST)
- ehdr.ether_dhost[0] = 1;
- else
- ehdr.ether_dhost[ETHER_ADDR_LEN-1] = 1;
- }
- } else {
- /*
- * We sent this packet; we don't know whether it's
- * broadcast, multicast, or unicast, so just make
- * the destination address all 0's.
- */
- memset(ehdr.ether_dhost, 0, ETHER_ADDR_LEN);
- }
-
if (eflag)
sll_print(sllp, length);
/*
- * Some printers want to get back at the ethernet 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.
+ * 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;
- /*
- * Actually, the only printers that use packetp are print-arp.c
- * and print-bootp.c, and they assume that packetp points to an
- * Ethernet header. The right thing to do is to fix them to know
- * which link type is in use when they excavate. XXX
- */
- packetp = (u_char *)&ehdr;
length -= SLL_HDR_LEN;
caplen -= SLL_HDR_LEN;
@@ -203,8 +155,8 @@ sll_if_print(u_char *user _U_, const struct pcap_pkthdr *h, const u_char *p)
* 802.2.
* Try to print the LLC-layer header & higher layers.
*/
- if (llc_print(p, length, caplen, ESRC(&ehdr),
- EDST(&ehdr), &extracted_ethertype) == 0)
+ if (llc_print(p, length, caplen, NULL, NULL,
+ &extracted_ethertype) == 0)
goto unknown; /* unknown LLC type */
break;
diff --git a/print-token.c b/print-token.c
index 81a30249..5070e5b9 100644
--- a/print-token.c
+++ b/print-token.c
@@ -25,7 +25,7 @@
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.19 2002-09-05 21:25:50 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.20 2002-12-18 08:53:24 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -112,23 +112,18 @@ token_print(const u_char *p, u_int length, u_int caplen)
printf("[|token-ring]");
return hdr_len;
}
+
/*
* Get the TR addresses into a canonical form
*/
extract_token_addrs(trp, (char*)ESRC(&ehdr), (char*)EDST(&ehdr));
+
/*
- * Some printers want to get back at the ethernet 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.
+ * 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;
- /*
- * Actually, the only printers that use packetp are print-arp.c
- * and print-bootp.c, and they assume that packetp points to an
- * Ethernet header. The right thing to do is to fix them to know
- * which link type is in use when they excavate. XXX
- */
- packetp = (u_char *)&ehdr;
/* Adjust for source routing information in the MAC header */
if (IS_SOURCE_ROUTED(trp)) {