]> The Tcpdump Group git mirrors - tcpdump/commitdiff
IEEE 802.11: Update the link-layer dissectors to void functions
authorFrancois-Xavier Le Bail <[email protected]>
Sun, 2 Aug 2020 07:46:30 +0000 (09:46 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sun, 2 Aug 2020 08:35:09 +0000 (10:35 +0200)
netdissect.h
print-802_11.c
print.c

index 2c2ad06163a40008dbcd2bcc8dcaf12c0996dec4..32080c32318b7a904b85aaa6c55b6078b4fe3244 100644 (file)
@@ -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;
index 270870e61a8ebc205ae232eee52dd66fe5c8e58e..9c9e77cf510d4c8e0aafab83e0875373f9f4b2ad 100644 (file)
@@ -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 0eef3bb0dc42dfc4ec4512c2eb4670c8da3f6872..8af6b38fd87c14faba7d6272efd13be764ab7d7f 100644 (file)
--- 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