]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ether.c
Always define check_and_add_compiler_option().
[tcpdump] / print-ether.c
index e1d3b36d1b5d7ed3281c0895d4d15eb4c5aa4015..8899469ba7fafc81327d8648c6fe04690788d18f 100644 (file)
@@ -100,6 +100,7 @@ const struct tok ethertype_values[] = {
     { ETHERTYPE_GEONET,         "GeoNet"},
     { ETHERTYPE_CALM_FAST,      "CALM FAST"},
     { ETHERTYPE_AOE,            "AoE" },
+    { ETHERTYPE_ARISTA,         "Arista Vendor Specific Protocol" },
     { 0, NULL}
 };
 
@@ -193,6 +194,7 @@ ether_print_common(netdissect_options *ndo, const u_char *p, u_int length,
         * Get the length/type field, skip past it, and print it
         * if we're printing the link-layer header.
         */
+recurse:
        length_type = GET_BE_U_2(p);
 
        length -= 2;
@@ -301,6 +303,34 @@ ether_print_common(netdissect_options *ndo, const u_char *p, u_int length,
                        llc_hdrlen = -llc_hdrlen;
                }
                hdrlen += llc_hdrlen;
+       } else if (length_type == ETHERTYPE_ARISTA) {
+               if (caplen < 2) {
+                       ND_PRINT("[|arista]");
+                       return (hdrlen + caplen);
+               }
+               if (length < 2) {
+                       ND_PRINT("[|arista]");
+                       return (hdrlen + length);
+               }
+               ether_type_print(ndo, length_type);
+               ND_PRINT(", length %u: ", orig_length);
+               int bytesConsumed = arista_ethertype_print(ndo, p, length);
+               if (bytesConsumed > 0) {
+                       p += bytesConsumed;
+                       length -= bytesConsumed;
+                       caplen -= bytesConsumed;
+                       hdrlen += bytesConsumed;
+                       goto recurse;
+               } else {
+                       /* subtype/version not known, print raw packet */
+                       if (!ndo->ndo_eflag && length_type > MAX_ETHERNET_LENGTH_VAL) {
+                               ether_addresses_print(ndo, src.addr, dst.addr);
+                               ether_type_print(ndo, length_type);
+                               ND_PRINT(", length %u: ", orig_length);
+                       }
+                        if (!ndo->ndo_suppress_default_print)
+                                ND_DEFAULTPRINT(p, caplen);
+               }
        } else {
                /*
                 * It's a type field with some other value.