* 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
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;
/*
#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
* 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)
#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
}
-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 ",
break;
default:
printf("(H) Unknown Ctrl Subtype");
+ break;
}
}
}
/*
- * 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;
}
}
{
u_int16_t fc;
u_int HEADER_LENGTH;
+ const u_int8_t *src, *dst;
u_short extracted_ethertype;
if (caplen < IEEE802_11_FC_LEN) {
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;
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;
}
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)));
*/
#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
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;
*/
#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
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) {
*/
#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
/* 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 */
#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
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);
#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
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) {
*/
#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
#include "ether.h"
-const u_char *packetp;
const u_char *snapend;
static inline void
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;
#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
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));
#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
}
/*
- * 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)
#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
* 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));
#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
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);
#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
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;
#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
}
/*
- * 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;
#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
}
/*
- * 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
}
/*
- * 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]) {
}
/*
- * 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;
#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
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);
#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
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)
#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
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;
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;
*/
#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
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;
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;
* 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;
*/
#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
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)) {