RFC 2684 encapsulation of BPDUs.
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.179 2002-02-05 10:07:39 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.180 2002-04-07 09:50:30 guy Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
const u_char *);
extern void arcnet_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
+extern void ether_print(const u_char *, u_int, u_int);
extern void ether_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
+extern void token_print(const u_char *, u_int, u_int);
extern void token_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
+extern void fddi_print(const u_char *, u_int, u_int);
extern void fddi_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern void ieee802_11_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.13 2001-06-04 05:47:13 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.14 2002-04-07 09:50:30 guy Exp $ (LBL)
*/
/*
#define OUI_ENCAP_ETHER 0x000000 /* encapsulated Ethernet */
#define OUI_CISCO 0x00000c /* Cisco protocols */
-#define ETHERTYPE_CISCO_CDP 0x2000 /* Cisco Discovery Protocol */
#define OUI_CISCO_90 0x0000f8 /* Cisco bridging */
+#define OUI_RFC2684 0x0080c2 /* RFC 2684 bridged Ethernet */
#define OUI_APPLETALK 0x080007 /* Appletalk */
+
+/*
+ * PIDs for use with OUI_CISCO.
+ */
+#define PID_CISCO_CDP 0x2000 /* Cisco Discovery Protocol */
+
+/*
+ * PIDs for use with OUI_RFC2684.
+ */
+#define PID_RFC2684_ETH_FCS 0x0001 /* Ethernet, with FCS */
+#define PID_RFC2684_ETH_NOFCS 0x0007 /* Ethernet, without FCS */
+#define PID_RFC2684_802_4_FCS 0x0002 /* 802.4, with FCS */
+#define PID_RFC2684_802_4_NOFCS 0x0008 /* 802.4, without FCS */
+#define PID_RFC2684_802_5_FCS 0x0003 /* 802.5, with FCS */
+#define PID_RFC2684_802_5_NOFCS 0x0009 /* 802.5, without FCS */
+#define PID_RFC2684_FDDI_FCS 0x0004 /* FDDI, with FCS */
+#define PID_RFC2684_FDDI_NOFCS 0x000a /* FDDI, without FCS */
+#define PID_RFC2684_802_6_FCS 0x0005 /* 802.6, with FCS */
+#define PID_RFC2684_802_6_NOFCS 0x000b /* 802.6, without FCS */
+#define PID_RFC2684_BPDU 0x000e /* BPDUs */
+
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.66 2001-11-25 02:01:47 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.67 2002-04-07 09:50:31 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
const u_char *snapend;
static inline void
-ether_print(register const u_char *bp, u_int length)
+ether_hdr_print(register const u_char *bp, u_int length)
{
register const struct ether_header *ep;
length);
}
-/*
- * This is the top level routine of the printer. 'p' is the points
- * to the ether header of the packet, 'h->tv' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
- * is the number of bytes actually captured.
- */
void
-ether_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
+ether_print(const u_char *p, u_int length, u_int caplen)
{
- u_int caplen = h->caplen;
- u_int length = h->len;
struct ether_header *ep;
u_short ether_type;
u_short extracted_ethertype;
- ++infodelay;
- ts_print(&h->ts);
-
if (caplen < ETHER_HDRLEN) {
printf("[|ether]");
goto out;
}
if (eflag)
- ether_print(p, length);
+ ether_hdr_print(p, length);
/*
* Some printers want to get back at the ethernet addresses,
&extracted_ethertype) == 0) {
/* ether_type not known, print raw packet */
if (!eflag)
- ether_print((u_char *)ep, length + ETHER_HDRLEN);
+ ether_hdr_print((u_char *)ep, length + ETHER_HDRLEN);
if (extracted_ethertype) {
printf("(LLC %s) ",
etherproto_string(htons(extracted_ethertype)));
&extracted_ethertype) == 0) {
/* ether_type not known, print raw packet */
if (!eflag)
- ether_print((u_char *)ep, length + ETHER_HDRLEN);
+ ether_hdr_print((u_char *)ep, length + ETHER_HDRLEN);
if (!xflag && !qflag)
default_print(p, caplen);
}
default_print(p, caplen);
out:
putchar('\n');
+}
+
+/*
+ * This is the top level routine of the printer. 'p' is the points
+ * to the ether header of the packet, 'h->tv' is the timestamp,
+ * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * is the number of bytes actually captured.
+ */
+void
+ether_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
+{
+ u_int caplen = h->caplen;
+ u_int length = h->len;
+
+ ++infodelay;
+ ts_print(&h->ts);
+
+ ether_print(p, length, caplen);
+
--infodelay;
if (infoprint)
info(0);
extracted_ethertype) == 0) {
/* ether_type not known, print raw packet */
if (!eflag)
- ether_print(p - 18, length + 4);
+ ether_hdr_print(p - 18, length + 4);
if (*extracted_ethertype) {
printf("(LLC %s) ",
etherproto_string(htons(*extracted_ethertype)));
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.53 2001-11-14 16:46:34 fenner Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.54 2002-04-07 09:50:32 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
* Print the FDDI MAC header
*/
static inline void
-fddi_print(register const struct fddi_header *fddip, register u_int length,
+fddi_hdr_print(register const struct fddi_header *fddip, register u_int length,
register const u_char *fsrc, register const u_char *fdst)
{
const char *srcname, *dstname;
printf("<SMT printer not yet implemented>");
}
-/*
- * This is the top level routine of the printer. 'sp' is the points
- * to the FDDI header of the packet, 'tvp' is the timestamp,
- * 'length' is the length of the packet off the wire, and 'caplen'
- * is the number of bytes actually captured.
- */
void
-fddi_if_print(u_char *pcap, const struct pcap_pkthdr *h,
- register const u_char *p)
+fddi_print(const u_char *p, u_int length, u_int caplen)
{
- u_int caplen = h->caplen;
- u_int length = h->len;
const struct fddi_header *fddip = (const struct fddi_header *)p;
struct ether_header ehdr;
u_short extracted_ethertype;
- ++infodelay;
- ts_print(&h->ts);
-
if (caplen < FDDI_HDRLEN) {
printf("[|fddi]");
goto out;
packetp = (u_char *)&ehdr;
if (eflag)
- fddi_print(fddip, length, ESRC(&ehdr), EDST(&ehdr));
+ fddi_hdr_print(fddip, length, ESRC(&ehdr), EDST(&ehdr));
/* Skip over FDDI MAC header */
length -= FDDI_HDRLEN;
* handle intelligently
*/
if (!eflag)
- fddi_print(fddip, length + FDDI_HDRLEN,
+ fddi_hdr_print(fddip, length + FDDI_HDRLEN,
ESRC(&ehdr), EDST(&ehdr));
if (extracted_ethertype) {
printf("(LLC %s) ",
else {
/* Some kinds of FDDI packet we cannot handle intelligently */
if (!eflag)
- fddi_print(fddip, length + FDDI_HDRLEN, ESRC(&ehdr),
+ fddi_hdr_print(fddip, length + FDDI_HDRLEN, ESRC(&ehdr),
EDST(&ehdr));
if (!xflag && !qflag)
default_print(p, caplen);
default_print(p, caplen);
out:
putchar('\n');
+}
+
+/*
+ * This is the top level routine of the printer. 'sp' is the points
+ * to the FDDI header of the packet, 'tvp' is the timestamp,
+ * 'length' is the length of the packet off the wire, and 'caplen'
+ * is the number of bytes actually captured.
+ */
+void
+fddi_if_print(u_char *pcap, const struct pcap_pkthdr *h,
+ register const u_char *p)
+{
+ u_int caplen = h->caplen;
+ u_int length = h->len;
+
+ ++infodelay;
+ ts_print(&h->ts);
+
+ fddi_print(p, length, caplen);
+
--infodelay;
if (infoprint)
info(0);
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.44 2001-11-25 02:01:48 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.45 2002-04-07 09:50:33 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
break;
case OUI_CISCO:
- if (et == ETHERTYPE_CISCO_CDP) {
+ if (et == PID_CISCO_CDP) {
cdp_print(p, length, caplen, esrc, edst);
return 1;
}
break;
+
+ case OUI_RFC2684:
+ switch (et) {
+
+ case PID_RFC2684_ETH_FCS:
+ case PID_RFC2684_ETH_NOFCS:
+ /*
+ * XXX - remove the last two bytes for
+ * PID_RFC2684_ETH_FCS?
+ */
+ /*
+ * Skip the padding.
+ */
+ caplen -= 2;
+ length -= 2;
+ p += 2;
+
+ /*
+ * What remains is an Ethernet packet.
+ */
+ ether_print(p, length, caplen);
+ return (1);
+
+ case PID_RFC2684_802_5_FCS:
+ case PID_RFC2684_802_5_NOFCS:
+ /*
+ * XXX - remove the last two bytes for
+ * PID_RFC2684_ETH_FCS?
+ */
+ /*
+ * Skip the padding, but not the Access
+ * Control field.
+ */
+ caplen -= 2;
+ length -= 2;
+ p += 2;
+
+ /*
+ * What remains is an 802.5 Token Ring
+ * packet.
+ */
+ token_print(p, length, caplen);
+ return (1);
+
+ case PID_RFC2684_FDDI_FCS:
+ case PID_RFC2684_FDDI_NOFCS:
+ /*
+ * XXX - remove the last two bytes for
+ * PID_RFC2684_ETH_FCS?
+ */
+ /*
+ * Skip the padding.
+ */
+ caplen -= 3;
+ length -= 3;
+ p += 3;
+
+ /*
+ * What remains is an FDDI packet.
+ */
+ fddi_print(p, length, caplen);
+ return (1);
+
+ case PID_RFC2684_BPDU:
+ stp_print(p, length);
+ return (1);
+ }
}
}
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.13 2001-09-18 15:46:37 fenner Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.14 2002-04-07 09:50:33 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
* Print the TR MAC header
*/
static inline void
-token_print(register const struct token_header *trp, register u_int length,
+token_hdr_print(register const struct token_header *trp, register u_int length,
register const u_char *fsrc, register const u_char *fdst)
{
const char *srcname, *dstname;
"??"
};
-/*
- * This is the top level routine of the printer. 'p' is the points
- * to the TR header of the packet, 'tvp' is the timestamp,
- * 'length' is the length of the packet off the wire, and 'caplen'
- * is the number of bytes actually captured.
- */
void
-token_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
+token_print(const u_char *p, u_int length, u_int caplen)
{
- u_int caplen = h->caplen;
- u_int length = h->len;
const struct token_header *trp;
u_short extracted_ethertype;
struct ether_header ehdr;
trp = (const struct token_header *)p;
- ++infodelay;
- ts_print(&h->ts);
-
if (caplen < TOKEN_HDRLEN) {
printf("[|token-ring]");
goto out;
*ESRC(&ehdr) &= 0x7f;
if (eflag)
- token_print(trp, length, ESRC(&ehdr), EDST(&ehdr));
+ token_hdr_print(trp, length, ESRC(&ehdr), EDST(&ehdr));
route_len = RIF_LENGTH(trp);
if (vflag) {
printf(" (%s) ", largest_frame[LARGEST_FRAME(trp)]);
} else {
if (eflag)
- token_print(trp, length, ESRC(&ehdr), EDST(&ehdr));
+ token_hdr_print(trp, length, ESRC(&ehdr), EDST(&ehdr));
}
/* Skip over token ring MAC header and routing information */
&extracted_ethertype) == 0) {
/* ether_type not known, print raw packet */
if (!eflag)
- token_print(trp,
+ token_hdr_print(trp,
length + TOKEN_HDRLEN + route_len,
ESRC(&ehdr), EDST(&ehdr));
if (extracted_ethertype) {
/* Some kinds of TR packet we cannot handle intelligently */
/* XXX - dissect MAC packets if frame type is 0 */
if (!eflag)
- token_print(trp, length + TOKEN_HDRLEN + route_len,
+ token_hdr_print(trp, length + TOKEN_HDRLEN + route_len,
ESRC(&ehdr), EDST(&ehdr));
if (!xflag && !qflag)
default_print(p, caplen);
default_print(p, caplen);
out:
putchar('\n');
+}
+
+/*
+ * This is the top level routine of the printer. 'p' is the points
+ * to the TR header of the packet, 'tvp' is the timestamp,
+ * 'length' is the length of the packet off the wire, and 'caplen'
+ * is the number of bytes actually captured.
+ */
+void
+token_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
+{
+ u_int caplen = h->caplen;
+ u_int length = h->len;
+
+ ++infodelay;
+ ts_print(&h->ts);
+
+ token_print(p, length, caplen);
+
--infodelay;
if (infoprint)
info(0);