]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ether.c
Clean up printing of LLC packets.
[tcpdump] / print-ether.c
index f3f43c1e49247bfe0ec9e716d772925c65e0dfde..26c5c97c9c3005dddb83e6299e22c6e4329e603f 100644 (file)
@@ -19,7 +19,6 @@
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -76,11 +75,13 @@ const struct tok ethertype_values[] = {
     { ETHERTYPE_GRE_ISO,        "GRE-OSI" },
     { ETHERTYPE_CFM_OLD,        "CFM (old)" },
     { ETHERTYPE_CFM,            "CFM" },
+    { ETHERTYPE_IEEE1905_1,     "IEEE1905.1" },
     { ETHERTYPE_LLDP,           "LLDP" },
     { ETHERTYPE_TIPC,           "TIPC"},
     { ETHERTYPE_GEONET_OLD,     "GeoNet (old)"},
     { ETHERTYPE_GEONET,         "GeoNet"},
     { ETHERTYPE_CALM_FAST,      "CALM FAST"},
+    { ETHERTYPE_AOE,            "AoE" },
     { 0, NULL}
 };
 
@@ -89,7 +90,7 @@ ether_hdr_print(netdissect_options *ndo,
                 const u_char *bp, u_int length)
 {
        register const struct ether_header *ep;
-       u_int16_t ether_type;
+       uint16_t ether_type;
 
        ep = (const struct ether_header *)bp;
 
@@ -129,7 +130,6 @@ ether_print(netdissect_options *ndo,
        struct ether_header *ep;
        u_int orig_length;
        u_short ether_type;
-       u_short extracted_ether_type;
 
        if (caplen < ETHER_HDRLEN || length < ETHER_HDRLEN) {
                ND_PRINT((ndo, "[|ether]"));
@@ -156,15 +156,8 @@ recurse:
         */
        if (ether_type <= ETHERMTU) {
                /* Try to print the LLC-layer header & higher layers */
-               if (llc_print(ndo, p, length, caplen, ESRC(ep), EDST(ep),
-                   &extracted_ether_type) == 0) {
+               if (llc_print(ndo, p, length, caplen, ESRC(ep), EDST(ep)) == 0) {
                        /* ether_type not known, print raw packet */
-                       if (!ndo->ndo_eflag) {
-                               if (print_encap_header != NULL)
-                                       (*print_encap_header)(ndo, encap_header_arg);
-                               ether_hdr_print(ndo, (u_char *)ep, orig_length);
-                       }
-
                        if (!ndo->ndo_suppress_default_print)
                                ND_DEFAULTPRINT(p, caplen);
                }
@@ -181,12 +174,9 @@ recurse:
                        return;
                }
                if (ndo->ndo_eflag) {
-                       u_int16_t tag = EXTRACT_16BITS(p);
+                       uint16_t tag = EXTRACT_16BITS(p);
 
-                       ND_PRINT((ndo, "vlan %u, p %u%s, ",
-                           tag & 0xfff,
-                           tag >> 13,
-                           (tag & 0x1000) ? ", CFI" : ""));
+                       ND_PRINT((ndo, "%s, ", ieee8021q_tci_string(tag)));
                }
 
                ether_type = EXTRACT_16BITS(p + 2);
@@ -207,15 +197,8 @@ recurse:
                 * there's an LLC header and payload.
                 */
                /* Try to print the LLC-layer header & higher layers */
-               if (llc_print(ndo, p, length, caplen, ESRC(ep), EDST(ep),
-                   &extracted_ether_type) == 0) {
+               if (llc_print(ndo, p, length, caplen, ESRC(ep), EDST(ep)) == 0) {
                        /* ether_type not known, print raw packet */
-                       if (!ndo->ndo_eflag) {
-                               if (print_encap_header != NULL)
-                                       (*print_encap_header)(ndo, encap_header_arg);
-                               ether_hdr_print(ndo, (u_char *)ep, orig_length);
-                       }
-
                        if (!ndo->ndo_suppress_default_print)
                                ND_DEFAULTPRINT(p, caplen);
                }
@@ -324,11 +307,9 @@ ethertype_print(netdissect_options *ndo,
                ip_print(ndo, p, length);
                return (1);
 
-#ifdef INET6
        case ETHERTYPE_IPV6:
                ip6_print(ndo, p, length);
                return (1);
-#endif /*INET6*/
 
        case ETHERTYPE_ARP:
        case ETHERTYPE_REVARP:
@@ -423,10 +404,15 @@ ethertype_print(netdissect_options *ndo,
                 calm_fast_print(ndo, p-14, p, length);
                 return (1);
 
+       case ETHERTYPE_AOE:
+               aoe_print(ndo, p, length);
+               return (1);
+
        case ETHERTYPE_LAT:
        case ETHERTYPE_SCA:
        case ETHERTYPE_MOPRC:
        case ETHERTYPE_MOPDL:
+       case ETHERTYPE_IEEE1905_1:
                /* default_print for now */
        default:
                return (0);