From: Francois-Xavier Le Bail Date: Sat, 28 Mar 2020 19:56:02 +0000 (+0100) Subject: ARCNET: Update the link-layer dissectors to void functions X-Git-Tag: tcpdump-4.99-bp~475 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/ddefbd82c9b42b1feb26144d3228acef45abce9e ARCNET: Update the link-layer dissectors to void functions --- diff --git a/netdissect.h b/netdissect.h index 401d62d7..1be9c162 100644 --- a/netdissect.h +++ b/netdissect.h @@ -464,8 +464,8 @@ extern if_printer_t lookup_printer(netdissect_options *, int); /* The DLT printer routines */ extern void ap1394_if_print IF_PRINTER_ARGS; -extern u_int arcnet_if_print IF_PRINTER_ARGS; -extern u_int arcnet_linux_if_print IF_PRINTER_ARGS; +extern void arcnet_if_print IF_PRINTER_ARGS; +extern void arcnet_linux_if_print IF_PRINTER_ARGS; extern u_int atm_if_print IF_PRINTER_ARGS; extern void bt_if_print IF_PRINTER_ARGS; extern u_int brcm_tag_if_print IF_PRINTER_ARGS; diff --git a/print-arcnet.c b/print-arcnet.c index 7077c109..0fa64b29 100644 --- a/print-arcnet.c +++ b/print-arcnet.c @@ -178,7 +178,7 @@ arcnet_print(netdissect_options *ndo, const u_char *bp, u_int length, int phds, * 'h->len' is the length of the packet off the wire, and 'h->caplen' * is the number of bytes actually captured. */ -u_int +void arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { u_int caplen = h->caplen; @@ -193,7 +193,8 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch ndo->ndo_protocol = "arcnet_if"; if (caplen < ARC_HDRLEN) { nd_print_trunc(ndo); - return (caplen); + ndo->ndo_ll_header_length += caplen; + return; } ap = (const struct arc_header *)p; @@ -216,7 +217,8 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch arcnet_print(ndo, p, length, 0, 0, 0); ND_PRINT(" phds"); nd_print_trunc(ndo); - return (caplen); + ndo->ndo_ll_header_length += caplen; + return; } flag = GET_U_1(ap->arc_flag); @@ -225,7 +227,8 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch arcnet_print(ndo, p, length, 0, 0, 0); ND_PRINT(" phds extended"); nd_print_trunc(ndo); - return (caplen); + ndo->ndo_ll_header_length += caplen; + return; } flag = GET_U_1(ap->arc_flag2); seqid = GET_BE_U_2(ap->arc_seqid2); @@ -251,13 +254,14 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch /* * This is a middle fragment. */ - return (archdrlen); + ndo->ndo_ll_header_length += archdrlen; + return; } if (!arcnet_encap_print(ndo, arc_type, p, length, caplen)) ND_DEFAULTPRINT(p, caplen); - return (archdrlen); + ndo->ndo_ll_header_length += archdrlen; } /* @@ -270,7 +274,7 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch * reassembled packets rather than raw frames, and headers have an * extra "offset" field between the src/dest and packet type. */ -u_int +void arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { u_int caplen = h->caplen; @@ -283,7 +287,8 @@ arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, cons ndo->ndo_protocol = "arcnet_linux_if"; if (caplen < ARC_LINUX_HDRLEN) { nd_print_trunc(ndo); - return (caplen); + ndo->ndo_ll_header_length += caplen; + return; } ap = (const struct arc_linux_header *)p; @@ -294,7 +299,8 @@ arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, cons archdrlen = ARC_LINUX_HDRNEWLEN; if (caplen < ARC_LINUX_HDRNEWLEN) { nd_print_trunc(ndo); - return (caplen); + ndo->ndo_ll_header_length += caplen; + return; } break; case ARCTYPE_IP_OLD: @@ -317,7 +323,7 @@ arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, cons if (!arcnet_encap_print(ndo, arc_type, p, length, caplen)) ND_DEFAULTPRINT(p, caplen); - return (archdrlen); + ndo->ndo_ll_header_length += archdrlen; } /* diff --git a/print.c b/print.c index 4f5de270..5998c6d9 100644 --- a/print.c +++ b/print.c @@ -83,10 +83,6 @@ static const struct uint_printer uint_printers[] = { #endif #ifdef DLT_LANE8023 { lane_if_print, DLT_LANE8023 }, -#endif - { arcnet_if_print, DLT_ARCNET }, -#ifdef DLT_ARCNET_LINUX - { arcnet_linux_if_print, DLT_ARCNET_LINUX }, #endif #ifdef DLT_IPOIB { ipoib_if_print, DLT_IPOIB }, @@ -216,6 +212,10 @@ static const struct uint_printer uint_printers[] = { static const struct void_printer void_printers[] = { #ifdef DLT_APPLE_IP_OVER_IEEE1394 { ap1394_if_print, DLT_APPLE_IP_OVER_IEEE1394 }, +#endif + { arcnet_if_print, DLT_ARCNET }, +#ifdef DLT_ARCNET_LINUX + { arcnet_linux_if_print, DLT_ARCNET_LINUX }, #endif #ifdef DLT_BLUETOOTH_HCI_H4_WITH_PHDR { bt_if_print, DLT_BLUETOOTH_HCI_H4_WITH_PHDR},