X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/64e8f9a9ed91a3cbfa8e66367f87ef50a1d62b99..296d466cd6bbf2f7e75e15bb6a01268e88c76ed0:/print-brcmtag.c diff --git a/print-brcmtag.c b/print-brcmtag.c index ff9c5cb3..a3d15e28 100644 --- a/print-brcmtag.c +++ b/print-brcmtag.c @@ -21,14 +21,12 @@ /* \summary: Broadcom Ethernet switches tag (4 bytes) printer */ -#ifdef HAVE_CONFIG_H #include -#endif #include "netdissect-stdinc.h" +#define ND_LONGJMP_FROM_TCHECK #include "netdissect.h" -#include "ethertype.h" #include "addrtoname.h" #include "extract.h" @@ -110,7 +108,7 @@ brcm_tag_print(netdissect_options *ndo, const u_char *bp) ND_PRINT(", "); } -u_int +void brcm_tag_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { @@ -118,11 +116,12 @@ brcm_tag_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, u_int length = h->len; ndo->ndo_protocol = "brcm-tag"; - return (ether_switch_tag_print(ndo, p, length, caplen, - brcm_tag_print, BRCM_TAG_LEN)); + ndo->ndo_ll_hdr_len += + ether_switch_tag_print(ndo, p, length, caplen, + brcm_tag_print, BRCM_TAG_LEN); } -u_int +void brcm_tag_prepend_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { @@ -130,15 +129,8 @@ brcm_tag_prepend_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, u_int length = h->len; ndo->ndo_protocol = "brcm-tag-prepend"; - if (caplen < BRCM_TAG_LEN) { - nd_print_trunc(ndo); - return (caplen); - } - - if (length < BRCM_TAG_LEN) { - nd_print_trunc(ndo); - return (length); - } + ND_TCHECK_LEN(p, BRCM_TAG_LEN); + ndo->ndo_ll_hdr_len += BRCM_TAG_LEN; if (ndo->ndo_eflag) { /* Print the prepended Broadcom tag. */ @@ -151,5 +143,6 @@ brcm_tag_prepend_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, /* * Now print the Ethernet frame following it. */ - return ether_print(ndo, p, length, caplen, NULL, NULL); + ndo->ndo_ll_hdr_len += + ether_print(ndo, p, length, caplen, NULL, NULL); }