From: Francois-Xavier Le Bail Date: Sun, 2 Aug 2020 07:46:30 +0000 (+0200) Subject: IEEE 802.11: Update the link-layer dissectors to void functions X-Git-Tag: tcpdump-4.99-bp~302 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/dc8a38c2899c29b29c1893ae1eeab0e26a5a1ca6 IEEE 802.11: Update the link-layer dissectors to void functions --- diff --git a/netdissect.h b/netdissect.h index 2c2ad061..32080c32 100644 --- a/netdissect.h +++ b/netdissect.h @@ -480,9 +480,9 @@ extern void enc_if_print IF_PRINTER_ARGS; extern void ether_if_print IF_PRINTER_ARGS; extern u_int fddi_if_print IF_PRINTER_ARGS; extern u_int fr_if_print IF_PRINTER_ARGS; -extern u_int ieee802_11_if_print IF_PRINTER_ARGS; -extern u_int ieee802_11_radio_avs_if_print IF_PRINTER_ARGS; -extern u_int ieee802_11_radio_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 u_int ipfc_if_print IF_PRINTER_ARGS; @@ -517,7 +517,7 @@ extern u_int ppp_bsdos_if_print IF_PRINTER_ARGS; extern u_int ppp_hdlc_if_print IF_PRINTER_ARGS; extern u_int ppp_if_print IF_PRINTER_ARGS; extern void pppoe_if_print IF_PRINTER_ARGS; -extern u_int prism_if_print IF_PRINTER_ARGS; +extern void prism_if_print IF_PRINTER_ARGS; extern void raw_if_print IF_PRINTER_ARGS; extern void sl_bsdos_if_print IF_PRINTER_ARGS; extern void sl_if_print IF_PRINTER_ARGS; diff --git a/print-802_11.c b/print-802_11.c index 270870e6..9c9e77cf 100644 --- a/print-802_11.c +++ b/print-802_11.c @@ -2265,12 +2265,12 @@ ieee802_11_print(netdissect_options *ndo, * 'h->len' is the length of the packet off the wire, and 'h->caplen' * is the number of bytes actually captured. */ -u_int +void ieee802_11_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { ndo->ndo_protocol = "802.11_if"; - return ieee802_11_print(ndo, p, h->len, h->caplen, 0, 0); + ndo->ndo_ll_hdr_len += ieee802_11_print(ndo, p, h->len, h->caplen, 0, 0); } @@ -3458,7 +3458,7 @@ ieee802_11_radio_avs_print(netdissect_options *ndo, * the AVS header, and the first 4 bytes of the header are used to * indicate whether it's a Prism header or an AVS header). */ -u_int +void prism_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { @@ -3469,33 +3469,39 @@ prism_if_print(netdissect_options *ndo, ndo->ndo_protocol = "prism_if"; if (caplen < 4) { nd_print_trunc(ndo); - return caplen; + ndo->ndo_ll_hdr_len += caplen; + return; } msgcode = GET_BE_U_4(p); if (msgcode == WLANCAP_MAGIC_COOKIE_V1 || - msgcode == WLANCAP_MAGIC_COOKIE_V2) - return ieee802_11_radio_avs_print(ndo, p, length, caplen); + msgcode == WLANCAP_MAGIC_COOKIE_V2) { + ndo->ndo_ll_hdr_len += ieee802_11_radio_avs_print(ndo, p, length, caplen); + return; + } if (caplen < PRISM_HDR_LEN) { nd_print_trunc(ndo); - return caplen; + ndo->ndo_ll_hdr_len += caplen; + return; } - return PRISM_HDR_LEN + ieee802_11_print(ndo, p + PRISM_HDR_LEN, - length - PRISM_HDR_LEN, caplen - PRISM_HDR_LEN, 0, 0); + p += PRISM_HDR_LEN; + length -= PRISM_HDR_LEN; + caplen -= PRISM_HDR_LEN; + ndo->ndo_ll_hdr_len += PRISM_HDR_LEN + ieee802_11_print(ndo, p, length, caplen, 0, 0); } /* * For DLT_IEEE802_11_RADIO; like DLT_IEEE802_11, but with an extra * header, containing information such as radio information. */ -u_int +void ieee802_11_radio_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { ndo->ndo_protocol = "802.11_radio_if"; - return ieee802_11_radio_print(ndo, p, h->len, h->caplen); + ndo->ndo_ll_hdr_len += ieee802_11_radio_print(ndo, p, h->len, h->caplen); } /* @@ -3503,10 +3509,10 @@ ieee802_11_radio_if_print(netdissect_options *ndo, * extra header, containing information such as radio information, * which we currently ignore. */ -u_int +void ieee802_11_radio_avs_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { ndo->ndo_protocol = "802.11_radio_avs_if"; - return ieee802_11_radio_avs_print(ndo, p, h->len, h->caplen); + ndo->ndo_ll_hdr_len += ieee802_11_radio_avs_print(ndo, p, h->len, h->caplen); } diff --git a/print.c b/print.c index 0eef3bb0..8af6b38f 100644 --- a/print.c +++ b/print.c @@ -103,18 +103,6 @@ static const struct uint_printer uint_printers[] = { { atm_if_print, DLT_ATM_RFC1483 }, #ifdef DLT_LTALK { ltalk_if_print, DLT_LTALK }, -#endif -#ifdef DLT_IEEE802_11_RADIO - { ieee802_11_radio_if_print, DLT_IEEE802_11_RADIO }, -#endif -#ifdef DLT_IEEE802_11 - { ieee802_11_if_print, DLT_IEEE802_11}, -#endif -#ifdef DLT_IEEE802_11_RADIO_AVS - { ieee802_11_radio_avs_if_print, DLT_IEEE802_11_RADIO_AVS }, -#endif -#ifdef DLT_PRISM_HEADER - { prism_if_print, DLT_PRISM_HEADER }, #endif { ppp_if_print, DLT_PPP }, #ifdef DLT_PPP_WITHDIRECTION @@ -156,6 +144,15 @@ static const struct void_printer void_printers[] = { { enc_if_print, DLT_ENC }, #endif { ether_if_print, DLT_EN10MB }, +#ifdef DLT_IEEE802_11 + { ieee802_11_if_print, DLT_IEEE802_11}, +#endif +#ifdef DLT_IEEE802_11_RADIO_AVS + { ieee802_11_radio_avs_if_print, DLT_IEEE802_11_RADIO_AVS }, +#endif +#ifdef DLT_IEEE802_11_RADIO + { ieee802_11_radio_if_print, DLT_IEEE802_11_RADIO }, +#endif #ifdef DLT_IPNET { ipnet_if_print, DLT_IPNET }, #endif @@ -228,6 +225,9 @@ static const struct void_printer void_printers[] = { #endif #ifdef DLT_PPP_ETHER { pppoe_if_print, DLT_PPP_ETHER }, +#endif +#ifdef DLT_PRISM_HEADER + { prism_if_print, DLT_PRISM_HEADER }, #endif { raw_if_print, DLT_RAW }, #ifdef DLT_IPV4