]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ether.c
Add a nd_print_trunc() call
[tcpdump] / print-ether.c
index 373103dcc0e3dc2ecd53500ebee658b828188952..887a8eee91b140da1a188a208c256e8b7089dbad 100644 (file)
@@ -148,7 +148,8 @@ ether_hdr_print(netdissect_options *ndo,
 u_int
 ether_print(netdissect_options *ndo,
             const u_char *p, u_int length, u_int caplen,
-            void (*print_encap_header)(netdissect_options *ndo, const u_char *), const u_char *encap_header_arg)
+            void (*print_encap_header)(netdissect_options *ndo, const u_char *),
+            const u_char *encap_header_arg)
 {
        const struct ether_header *ehp;
        u_int orig_length;
@@ -162,10 +163,6 @@ ether_print(netdissect_options *ndo,
                nd_print_trunc(ndo);
                return (caplen);
        }
-       if (length < ETHER_HDRLEN) {
-               nd_print_trunc(ndo);
-               return (length);
-       }
 
        if (ndo->ndo_eflag) {
                if (print_encap_header != NULL)
@@ -209,13 +206,10 @@ recurse:
                 * the enclosed type field.
                 */
                if (caplen < 4) {
-                       ND_PRINT("[|vlan]");
+                       ndo->ndo_protocol = "vlan";
+                       nd_print_trunc(ndo);
                        return (hdrlen + caplen);
                }
-               if (length < 4) {
-                       ND_PRINT("[|vlan]");
-                       return (hdrlen + length);
-               }
                if (ndo->ndo_eflag) {
                        uint16_t tag = EXTRACT_BE_U_2(p);
 
@@ -296,7 +290,7 @@ netanalyzer_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
         * Fail if we don't have enough data for the Hilscher pseudo-header.
         */
        ndo->ndo_protocol = "netanalyzer_if";
-       if (h->len < 4 || h->caplen < 4) {
+       if (h->caplen < 4) {
                nd_print_trunc(ndo);
                return (h->caplen);
        }
@@ -325,7 +319,7 @@ netanalyzer_transparent_if_print(netdissect_options *ndo,
         * preamble, and SOF.
         */
        ndo->ndo_protocol = "netanalyzer_transparent_if";
-       if (h->len < 12 || h->caplen < 12) {
+       if (h->caplen < 12) {
                nd_print_trunc(ndo);
                return (h->caplen);
        }
@@ -383,7 +377,8 @@ ethertype_print(netdissect_options *ndo,
 
        case ETHERTYPE_ISO:
                if (length == 0 || caplen == 0) {
-                       ND_PRINT(" [|osi]");
+                       ndo->ndo_protocol = "isoclns";
+                       nd_print_trunc(ndo);
                        return (1);
                }
                isoclns_print(ndo, p + 1, length - 1);