summaryrefslogtreecommitdiff
path: root/print-802_15_4.c
diff options
context:
space:
mode:
authorJames Ko <jck@exegin.com>2019-02-15 12:27:46 -0800
committerJames Ko <jck@exegin.com>2019-02-20 09:08:03 -0800
commit5cf83c2fce732a9b6439ad766ef0bae1deec2003 (patch)
tree2f7d74daf9a993a664e7fc64b3136ebcee04af55 /print-802_15_4.c
parentb4101b53148d6b894649d8f852c87b6c140d87e3 (diff)
downloadtcpdump-5cf83c2fce732a9b6439ad766ef0bae1deec2003.tar.gz
Handle DLT_IEEE802_15_4_TAP.
https://github.com/jkcko/ieee802.15.4-tap
Diffstat (limited to 'print-802_15_4.c')
-rw-r--r--print-802_15_4.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/print-802_15_4.c b/print-802_15_4.c
index f9f05d2f..d2cc5981 100644
--- a/print-802_15_4.c
+++ b/print-802_15_4.c
@@ -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;
+}