From: Francois-Xavier Le Bail Date: Sun, 2 Aug 2020 09:24:45 +0000 (+0200) Subject: IEEE 802.15.4: Update the link-layer dissectors to void functions X-Git-Tag: tcpdump-4.99-bp~300 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/006004fdda8721eeb86e191e4dd0cfc8a77d1e3d IEEE 802.15.4: Update the link-layer dissectors to void functions --- diff --git a/netdissect.h b/netdissect.h index 32080c32..a563a521 100644 --- a/netdissect.h +++ b/netdissect.h @@ -483,8 +483,8 @@ extern u_int fr_if_print IF_PRINTER_ARGS; extern void ieee802_11_if_print IF_PRINTER_ARGS; extern void ieee802_11_radio_avs_if_print IF_PRINTER_ARGS; extern void ieee802_11_radio_if_print IF_PRINTER_ARGS; -extern u_int ieee802_15_4_if_print IF_PRINTER_ARGS; -extern u_int ieee802_15_4_tap_if_print IF_PRINTER_ARGS; +extern void ieee802_15_4_if_print IF_PRINTER_ARGS; +extern void ieee802_15_4_tap_if_print IF_PRINTER_ARGS; extern u_int ipfc_if_print IF_PRINTER_ARGS; extern void ipoib_if_print IF_PRINTER_ARGS; extern void ipnet_if_print IF_PRINTER_ARGS; diff --git a/print-802_15_4.c b/print-802_15_4.c index cb0d76e8..c7d6c3f4 100644 --- a/print-802_15_4.c +++ b/print-802_15_4.c @@ -2492,18 +2492,18 @@ ieee802_15_4_print(netdissect_options *ndo, * Main function to print packets. */ -u_int +void ieee802_15_4_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { u_int caplen = h->caplen; ndo->ndo_protocol = "802.15.4_if"; - return ieee802_15_4_print(ndo, p, caplen); + ndo->ndo_ll_hdr_len += ieee802_15_4_print(ndo, p, caplen); } /* For DLT_IEEE802_15_4_TAP */ /* https://github.com/jkcko/ieee802.15.4-tap */ -u_int +void ieee802_15_4_tap_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { @@ -2513,20 +2513,22 @@ ieee802_15_4_tap_if_print(netdissect_options *ndo, ndo->ndo_protocol = "802.15.4_tap"; if (h->caplen < 4) { nd_print_trunc(ndo); - return h->caplen; + ndo->ndo_ll_hdr_len += h->caplen; + return; } version = GET_U_1(p); length = GET_LE_U_2(p + 2); if (version != 0 || length < 4) { nd_print_invalid(ndo); - return 0; + return; } if (h->caplen < length) { nd_print_trunc(ndo); - return h->caplen; + ndo->ndo_ll_hdr_len += h->caplen; + return; } - return ieee802_15_4_print(ndo, p+length, h->caplen-length) + length; + ndo->ndo_ll_hdr_len += ieee802_15_4_print(ndo, p+length, h->caplen-length) + length; } diff --git a/print.c b/print.c index 8af6b38f..84df9a1a 100644 --- a/print.c +++ b/print.c @@ -53,15 +53,6 @@ struct void_printer { }; static const struct uint_printer uint_printers[] = { -#ifdef DLT_IEEE802_15_4 - { ieee802_15_4_if_print, DLT_IEEE802_15_4 }, -#endif -#ifdef DLT_IEEE802_15_4_NOFCS - { ieee802_15_4_if_print, DLT_IEEE802_15_4_NOFCS }, -#endif -#ifdef DLT_IEEE802_15_4_TAP - { ieee802_15_4_tap_if_print, DLT_IEEE802_15_4_TAP }, -#endif #ifdef DLT_CIP { cip_if_print, DLT_CIP }, #endif @@ -153,6 +144,15 @@ static const struct void_printer void_printers[] = { #ifdef DLT_IEEE802_11_RADIO { ieee802_11_radio_if_print, DLT_IEEE802_11_RADIO }, #endif +#ifdef DLT_IEEE802_15_4 + { ieee802_15_4_if_print, DLT_IEEE802_15_4 }, +#endif +#ifdef DLT_IEEE802_15_4_NOFCS + { ieee802_15_4_if_print, DLT_IEEE802_15_4_NOFCS }, +#endif +#ifdef DLT_IEEE802_15_4_TAP + { ieee802_15_4_tap_if_print, DLT_IEEE802_15_4_TAP }, +#endif #ifdef DLT_IPNET { ipnet_if_print, DLT_IPNET }, #endif