-/* @(#) $Header: /tcpdump/master/tcpdump/ether.h,v 1.4 2000-10-03 02:54:55 itojun Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/ether.h,v 1.5 2000-10-09 02:59:39 guy Exp $ (LBL) */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
};
/*
- * Structure of a 10Mb/s Ethernet header.
+ * Structure of a DEC/Intel/Xerox or 802.3 Ethernet header.
*/
struct ether_header {
u_int8_t ether_dhost[ETHER_ADDR_LEN];
u_int8_t ether_shost[ETHER_ADDR_LEN];
u_int16_t ether_type;
};
+
+/*
+ * Length of a DEC/Intel/Xerox or 802.3 Ethernet header; note that some
+ * compilers may pad "struct ether_header" to a multiple of 4 bytes,
+ * for example, so "sizeof (struct ether_header)" may not give the right
+ * answer.
+ */
+#define ETHER_HDRLEN 14
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/fddi.h,v 1.8 1999-10-07 23:47:10 mcr Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/fddi.h,v 1.9 2000-10-09 02:59:39 guy Exp $ (LBL)
*/
/*
u_char fddi_shost[6];
};
+/*
+ * Length of an FDDI header; note that some compilers may pad
+ * "struct fddi_header" to a multiple of 4 bytes, for example, so
+ * "sizeof (struct fddi_header)" may not give the right
+ * answer.
+ */
+#define FDDI_HDRLEN 13
/* Useful values for fddi_fc (frame control) field */
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.57 2000-10-07 05:46:21 itojun Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.58 2000-10-09 02:59:39 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
ts_print(&h->ts);
- if (caplen < sizeof(struct ether_header)) {
+ if (caplen < ETHER_HDRLEN) {
printf("[|ether]");
goto out;
}
packetp = p;
snapend = p + caplen;
- length -= sizeof(struct ether_header);
- caplen -= sizeof(struct ether_header);
+ length -= ETHER_HDRLEN;
+ caplen -= ETHER_HDRLEN;
ep = (struct ether_header *)p;
- p += sizeof(struct ether_header);
+ p += ETHER_HDRLEN;
ether_type = ntohs(ep->ether_type);
} else if (ether_encap_print(ether_type, p, length, caplen) == 0) {
/* ether_type not known, print raw packet */
if (!eflag)
- ether_print((u_char *)ep, length + sizeof(*ep));
+ ether_print((u_char *)ep, length + ETHER_HDRLEN);
if (!xflag && !qflag)
default_print(p, caplen);
}
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.46 2000-10-06 04:23:11 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.47 2000-10-09 02:59:40 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
* - vj
*/
-#define FDDI_HDRLEN (sizeof(struct fddi_header))
-
static u_char fddi_bit_swap[] = {
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
#ifndef lint
static const char rcsid[] =
-"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.11 2000-10-06 04:23:13 guy Exp $ (LBL)";
+"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.12 2000-10-09 02:59:40 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
const u_char *pppoe_packet, *pppoe_payload;
eh = (struct ether_header *)packetp;
- pppoe_packet = packetp+sizeof(struct ether_header);
+ pppoe_packet = packetp+ETHER_HDRLEN;
if (pppoe_packet > snapend) {
printf("[|pppoe]");
return;