X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/56e6581c34ceec5469b9f37c19b31a36b0256f3c..8aa4617181138d2bd09ac37b164b39e99c5f3d3c:/print-ether.c diff --git a/print-ether.c b/print-ether.c index aed2bea8..1158b794 100644 --- a/print-ether.c +++ b/print-ether.c @@ -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; @@ -159,13 +160,9 @@ ether_print(netdissect_options *ndo, ndo->ndo_protocol = "ether"; if (caplen < ETHER_HDRLEN) { - ND_PRINT("[|ether]"); + nd_print_trunc(ndo); return (caplen); } - if (length < ETHER_HDRLEN) { - ND_PRINT("[|ether]"); - return (length); - } if (ndo->ndo_eflag) { if (print_encap_header != NULL) @@ -212,10 +209,6 @@ recurse: ND_PRINT("[|vlan]"); 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,8 +289,8 @@ 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) { - ND_PRINT("[|netanalyzer]"); + if (h->caplen < 4) { + nd_print_trunc(ndo); return (h->caplen); } @@ -325,8 +318,8 @@ netanalyzer_transparent_if_print(netdissect_options *ndo, * preamble, and SOF. */ ndo->ndo_protocol = "netanalyzer_transparent_if"; - if (h->len < 12 || h->caplen < 12) { - ND_PRINT("[|netanalyzer-transparent]"); + if (h->caplen < 12) { + nd_print_trunc(ndo); return (h->caplen); }