diff options
| -rw-r--r-- | CREDITS | 1 | ||||
| -rw-r--r-- | netdissect.h | 1 | ||||
| -rw-r--r-- | print-802_15_4.c | 30 | ||||
| -rw-r--r-- | print.c | 3 |
4 files changed, 35 insertions, 0 deletions
@@ -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> diff --git a/netdissect.h b/netdissect.h index fc415ed5..9a6475e1 100644 --- a/netdissect.h +++ b/netdissect.h @@ -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; 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; +} @@ -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 |
