diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2020-08-02 09:46:30 +0200 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2020-08-02 10:35:09 +0200 |
commit | dc8a38c2899c29b29c1893ae1eeab0e26a5a1ca6 (patch) | |
tree | c8a4aa4d75483aeca51d5f4ea5fdb23e2cf56f73 | |
parent | a4e0f7d9df751eec6e872b80ac05f3d7512d239f (diff) | |
download | tcpdump-dc8a38c2899c29b29c1893ae1eeab0e26a5a1ca6.tar.gz |
IEEE 802.11: Update the link-layer dissectors to void functions
-rw-r--r-- | netdissect.h | 8 | ||||
-rw-r--r-- | print-802_11.c | 32 | ||||
-rw-r--r-- | print.c | 24 |
3 files changed, 35 insertions, 29 deletions
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); } @@ -104,18 +104,6 @@ static const struct uint_printer uint_printers[] = { #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 { ppp_if_print, 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 @@ -229,6 +226,9 @@ static const struct void_printer void_printers[] = { #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 { raw_if_print, DLT_IPV4 }, |