*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.95 2005-04-06 21:32:39 mcr Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.96 2005-04-25 17:56:43 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "ethertype.h"
#include "ether.h"
-#include "llc.h"
const struct tok ethertype_values[] = {
- /* not really ethertypes but PIDs that are used
- in the SNAP printer - its more convenient
- to put them into a single tokentable */
- { PID_RFC2684_ETH_FCS, "Ethernet + FCS" },
- { PID_RFC2684_ETH_NOFCS, "Ethernet no FCS" },
- { PID_RFC2684_802_4_FCS, "802.4 + FCS" },
- { PID_RFC2684_802_4_NOFCS, "w/o FCS" },
- { PID_RFC2684_802_5_FCS, "Tokenring + FCS" },
- { PID_RFC2684_802_5_NOFCS, "Tokenring no FCS" },
- { PID_RFC2684_FDDI_FCS, "FDDI + FCS" },
- { PID_RFC2684_FDDI_NOFCS, "FDDI no FCS" },
- { PID_RFC2684_802_6_FCS, "802.6 + FCS" },
- { PID_RFC2684_802_6_NOFCS, "802.6 no FCS" },
- { PID_RFC2684_BPDU, "BPDU" },
- /* the real Ethertypes */
{ ETHERTYPE_IP, "IPv4" },
{ ETHERTYPE_MPLS, "MPLS unicast" },
{ ETHERTYPE_MPLS_MULTI, "MPLS multicast" },
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.61 2005-04-06 21:32:41 mcr Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.62 2005-04-25 17:56:43 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
{ 0, NULL }
};
+struct oui_tok {
+ u_int32_t oui;
+ const struct tok *tok;
+};
+
+static const struct tok bridged_values[] = {
+ { PID_RFC2684_ETH_FCS, "Ethernet + FCS" },
+ { PID_RFC2684_ETH_NOFCS, "Ethernet w/o FCS" },
+ { PID_RFC2684_802_4_FCS, "802.4 + FCS" },
+ { PID_RFC2684_802_4_NOFCS, "802.4 w/o FCS" },
+ { PID_RFC2684_802_5_FCS, "Token Ring + FCS" },
+ { PID_RFC2684_802_5_NOFCS, "Token Ring w/o FCS" },
+ { PID_RFC2684_FDDI_FCS, "FDDI + FCS" },
+ { PID_RFC2684_FDDI_NOFCS, "FDDI w/o FCS" },
+ { PID_RFC2684_802_6_FCS, "802.6 + FCS" },
+ { PID_RFC2684_802_6_NOFCS, "802.6 w/o FCS" },
+ { PID_RFC2684_BPDU, "BPDU" },
+ { 0, NULL },
+};
+
+static const struct oui_tok oui_to_tok[] = {
+ { 0x000000, ethertype_values },
+ { 0x0080C2, bridged_values }, /* bridged, RFC 2427 FR or RFC 2864 ATM */
+ { 0, NULL }
+};
+
/*
* Returns non-zero IFF it succeeds in printing the header
*/
orgcode = EXTRACT_24BITS(&llc.llc_orgcode[0]);
et = EXTRACT_16BITS(&llc.llc_ethertype[0]);
- if (eflag)
- (void)printf("oui %s (0x%06x), ethertype %s (0x%04x): ",
- tok2str(oui_values,"Unknown",orgcode),
- orgcode,
- tok2str(ethertype_values,"Unknown", et),
- et);
+ if (eflag) {
+ const struct tok *tok = NULL;
+ const struct oui_tok *otp;
+
+ for (otp = &oui_to_tok[0]; otp->tok != NULL; otp++) {
+ if (otp->oui == orgcode) {
+ tok = otp->tok;
+ break;
+ }
+ }
+ (void)printf("oui %s (0x%06x), %s %s (0x%04x): ",
+ tok2str(oui_values, "Unknown", orgcode),
+ orgcode,
+ (orgcode == 0x000000 ? "ethertype" : "pid"),
+ tok2str(tok, "Unknown", et),
+ et);
+ }
/*
* XXX - what *is* the right bridge pad value here?