Merged in antmerlino/apps (pull request #123)

i8shark: Adds CONFIG_IEEE802154_I8SHARK_XBEE_APPHDR option to remove XBee's application header before sending to Wireshark. This option will corrupt any traffic received that does not include this application header.

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Anthony Merlino 2017-11-22 21:37:11 +00:00 committed by Gregory Nutt
parent 0861f821fb
commit 96acb66d6a
2 changed files with 27 additions and 0 deletions

View File

@ -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

View File

@ -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 */