]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Fix printouts for unrecognized packet types.
authorGuy Harris <[email protected]>
Tue, 28 Apr 2015 17:50:50 +0000 (10:50 -0700)
committerGuy Harris <[email protected]>
Tue, 28 Apr 2015 17:50:50 +0000 (10:50 -0700)
For unrecognized LLC packets, don't print the raw packet if we've been
told to suppress that.

For unrecognized Ethertype packets, print the Ethertype if we haven't
already done so.

print-medsa.c

index dbdf356bf913e1cef848340dec3e88e120977346..e9ec317b242587f9a546b74b40f3735f34c5b30f 100644 (file)
@@ -158,9 +158,11 @@ medsa_print(netdissect_options *ndo,
        ether_type = EXTRACT_16BITS(&medsa->ether_type);
        if (ether_type <= ETHERMTU) {
                /* Try to print the LLC-layer header & higher layers */
-               if (llc_print(ndo, bp, length, caplen, ESRC(ep), EDST(ep)) < 0)
-                       /* ether_type not known, print raw packet */
-                       ND_DEFAULTPRINT(bp, caplen);
+               if (llc_print(ndo, bp, length, caplen, ESRC(ep), EDST(ep)) < 0) {
+                       /* packet type not known, print raw packet */
+                       if (!ndo->ndo_suppress_default_print)
+                               ND_DEFAULTPRINT(bp, caplen);
+               }
        } else {
                if (ndo->ndo_eflag)
                        ND_PRINT((ndo, "ethertype %s (0x%04x) ",
@@ -170,6 +172,12 @@ medsa_print(netdissect_options *ndo,
 
                if (ethertype_print(ndo, ether_type, bp, length, caplen) == 0) {
                        /* ether_type not known, print raw packet */
+                       if (!ndo->ndo_eflag)
+                               ND_PRINT((ndo, "ethertype %s (0x%04x) ",
+                                         tok2str(ethertype_values, "Unknown",
+                                                 ether_type),
+                                         ether_type));
+
                        if (!ndo->ndo_suppress_default_print)
                                ND_DEFAULTPRINT(bp, caplen);
                }