]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Handle DLT_IEEE802_15_4_TAP. 734/head
authorJames Ko <[email protected]>
Fri, 15 Feb 2019 20:27:46 +0000 (12:27 -0800)
committerJames Ko <[email protected]>
Wed, 20 Feb 2019 17:08:03 +0000 (09:08 -0800)
https://github.com/jkcko/ieee802.15.4-tap

CREDITS
netdissect.h
print-802_15_4.c
print.c

diff --git a/CREDITS b/CREDITS
index cc16b7d1e7a6ced8a60c37501a5bbd9c16e47807..276b29e8d5589e95ab4c7bf8140fc7908dfb7be4 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -93,6 +93,7 @@ Additional people who have contributed patches (in alphabetical order):
     Jacek Tobiasz                 <Jacek dot Tobiasz at atm dot com dot pl>
     Jakob Schlyter                <jakob at openbsd dot org>
     Jamal Hadi Salim              <hadi at cyberus dot ca>
+    James Ko                      <jck at exegin dot com>
     Jan Oravec                    <wsx at wsx6 dot net>
     Jason R. Thorpe               <thorpej at netbsd dot org>
     Jefferson Ogata               <jogata at nodc dot noaa dot gov>
index fc415ed54192229902bf4d608a9000b2ca6243ad..9a6475e13a5ca25ecb5564576f4c3943e592971e 100644 (file)
@@ -447,6 +447,7 @@ 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 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;
 extern u_int ipnet_if_print IF_PRINTER_ARGS;
 extern u_int juniper_atm1_if_print IF_PRINTER_ARGS;
index f9f05d2f3f5d20055042f2b5bc142b2d5dca34e4..d2cc5981aff2d51f5ca98e1e5f937fdd0ccd3e4a 100644 (file)
@@ -230,3 +230,33 @@ ieee802_15_4_if_print(netdissect_options *ndo,
        ndo->ndo_protocol = "802.15.4_if";
        return ieee802_15_4_print(ndo, p, h->caplen);
 }
+
+/* For DLT_IEEE802_15_4_TAP */
+/* https://github.com/jkcko/ieee802.15.4-tap */
+u_int
+ieee802_15_4_tap_if_print(netdissect_options *ndo,
+                          const struct pcap_pkthdr *h, const u_char *p)
+{
+       uint8_t version;
+       uint16_t length;
+
+       ndo->ndo_protocol = "802.15.4_tap";
+       if (h->caplen < 4) {
+               nd_print_trunc(ndo);
+               return h->caplen;
+       }
+
+       version = EXTRACT_U_1(p);
+       length = EXTRACT_LE_U_2(p+2);
+       if (version != 0 || length < 4) {
+               nd_print_invalid(ndo);
+               return 0;
+       }
+
+       if (h->caplen < length) {
+               nd_print_trunc(ndo);
+               return h->caplen;
+       }
+
+       return ieee802_15_4_print(ndo, p+length, h->caplen-length) + length;
+}
diff --git a/print.c b/print.c
index 9ee88eb1758d1206b256043c8b0c47dd7e388f26..37ae91a89eda1ba4ec4aab19e874214c6e581112 100644 (file)
--- a/print.c
+++ b/print.c
@@ -57,6 +57,9 @@ static const struct printer printers[] = {
 #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_PPI
        { ppi_if_print,         DLT_PPI },
 #endif