diff --git a/wireless/ieee802154/i8shark/Kconfig b/wireless/ieee802154/i8shark/Kconfig index 9adf4e831..bb6a2a65d 100644 --- a/wireless/ieee802154/i8shark/Kconfig +++ b/wireless/ieee802154/i8shark/Kconfig @@ -22,4 +22,16 @@ config IEEE802154_I8SHARK_HOST_IPADDR hex "Host IP address where Wireshark is running" default 0x0a000001 +config IEEE802154_I8SHARK_XBEE_APPHDR + bool "XBee App Header compensation" + default n + ---help--- + XBee radios use an optional "application header" to support duplicate + frame detection. Wireshark does not know about this header and it causes + packets not to be recognized appropriately (6LoWPAN etc.). This option + blindly chops the first 2 bytes of payload from all incoming frames to + remove the header. This option can only be used when sniffing XBee-only + networks, as any frames not containing the application header will have + 2 arbitrary bytes removed from it. + endif diff --git a/wireless/ieee802154/i8shark/i8shark_main.c b/wireless/ieee802154/i8shark/i8shark_main.c index 7532f6037..b46ee67c3 100644 --- a/wireless/ieee802154/i8shark/i8shark_main.c +++ b/wireless/ieee802154/i8shark/i8shark_main.c @@ -415,8 +415,23 @@ static int i8shark_daemon(int argc, FAR char *argv[]) /* The ZEP header is filled, now copy the frame in */ +#ifdef CONFIG_IEEE802154_I8SHARK_XBEE_APPHDR + memcpy(&zepframe[ind], frame.payload, frame.offset); + ind += frame.offset; + + /* XBee radios use a 2 byte "application header" to support duplicate packet + * detection. Wireshark doesn't know how to handle this data, so we provide + * a configuration option that drops the first 2 bytes of the payload portion + * of the frame for all sniffed frames + */ + + memcpy(&zepframe[ind], (frame.payload + frame.offset + 2), + (frame.length - frame.offset - 2)); + ind += frame.length - frame.offset - 2; +#else memcpy(&zepframe[ind], frame.payload, frame.length); ind += frame.length; +#endif /* Send the encapsulated frame to Wireshark over UDP */