]> The Tcpdump Group git mirrors - tcpdump/commitdiff
IEEE 802.15.4: Update the link-layer dissectors to void functions
authorFrancois-Xavier Le Bail <[email protected]>
Sun, 2 Aug 2020 09:24:45 +0000 (11:24 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sun, 2 Aug 2020 09:24:45 +0000 (11:24 +0200)
netdissect.h
print-802_15_4.c
print.c

index 32080c32318b7a904b85aaa6c55b6078b4fe3244..a563a521d260557808632040d726db5747339bb9 100644 (file)
@@ -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;
index cb0d76e86a1b28d7daf1bc5a19a6071f21f26dd7..c7d6c3f498417918a141bb5b86d5cb8b69f86cdb 100644 (file)
@@ -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 8af6b38fd87c14faba7d6272efd13be764ab7d7f..84df9a1ae6def4755cc9f1894fc11b0c24417fa6 100644 (file)
--- 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