From 81dbf4a0b05092760d0ff0cdd48c692e4769ba99 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Le Bail Date: Sun, 12 Jul 2020 22:27:33 +0200 Subject: Update more link-layer dissectors to void functions brcm_tag_if_print() brcm_tag_prepend_if_print() dsa_if_print() edsa_if_print() ether_if_print() netanalyzer_if_print() netanalyzer_transparent_if_print() Update ether_print(), ether_common_print() and ether_switch_tag_print() to void functions. Add a flag parameter to ether_print(), ether_common_print() and ether_switch_tag_print() to increment the link-layer header length field of the netdissect_options when needed. The calls use TRUE when the return value of the funtions was used. The calls with FALSE avoid increments when the calls are nested. Moreover: Remove trailing "_if" from some protocol names. --- print-brcmtag.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'print-brcmtag.c') diff --git a/print-brcmtag.c b/print-brcmtag.c index da8b8a52..61521365 100644 --- a/print-brcmtag.c +++ b/print-brcmtag.c @@ -110,7 +110,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 +118,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 += 0; + ether_switch_tag_print(ndo, p, length, caplen, + brcm_tag_print, BRCM_TAG_LEN, TRUE); } -u_int +void brcm_tag_prepend_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { @@ -131,8 +132,9 @@ brcm_tag_prepend_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, ndo->ndo_protocol = "brcm-tag-prepend"; if (caplen < BRCM_TAG_LEN) { + ndo->ndo_ll_hdr_len += caplen; nd_print_trunc(ndo); - return (caplen); + return; } if (ndo->ndo_eflag) { @@ -146,5 +148,5 @@ 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); + ether_print(ndo, p, length, caplen, NULL, NULL, TRUE); } -- cgit v1.2.1