I am doing some work on worm-attack detection in RPL. In RPL, the communication between the clients might be multiple hops, with the packets going through many nodes.
However, only the receiver gets a tcpip_event
on reception of the packet. The nodes that the route passes through do not get this event. Is there any way to detect the packet on the intermediate nodes?
You cannot get a notification or callback when a packet is forwarded. However, you can get a callback when a packet is received or sent by the lower layers.
In Contiki, use the function
rime_sniffer_add
for that. Checkapps/powertrace/powertrace.c
for an example.In Contiki-NG the function has been renamed to
netstack_sniffer_add
.Usage example:
Declare the sniffer like this, in the global scope:
Then add the sniffer from your code, once, at the start of the application execution:
The functions
input_packet
andoutput_packets
are callbacks defined by you and can be used to examine the packets; for example, like this: