contikicoojacontiki-ng

Contiki-ng: sniff neighbour packets in Cooja and respond/send like normal node


I run the example of rpl-udp with udp-server and udp-client. I want to enable udp-client to sniff packets from neighbour nodes, but at the same time allow it to behave like a normal node. How is that possible? I added the NETSTACK_RADIO.set_value(RADIO_PARAM_RX_MODE, 0) which disables the RADIO_RX_MODE_ADDRESS_FILTER (makes it 0) but when I simulate in Cooja (using z1) the nodes don't sniff all packets. Also, I get many duplicate warnings like below:

00:57.609 ID:7 [WARN: CSMA] drop duplicate link layer packet from c10c.0000.0000.0004, seqno 114

Is there any other flag to allow sniff of all packets and reduce the duplicate packets?

Thanks for the help!

Edit: I tried this solution here https://sourceforge.net/p/contiki/mailman/message/34888182/ but I face the same problem (have many retransmissions and duplicate packets).


Solution

  • You cannot do that, there is no promiscious mode for Contiki-NG MAC protocols. The packets addressed to other nodes are filtered out at the CSMA level, even if the radio receives them.

    The way to implement sniffer is to either to work with NETSTACK_RADIO directly, to make your own MAC, or to hack the input_packet function of the CSMA MAC.