packet-snifferscontikineighbourscooja

How to overhear a neighbor mote Tx/Rx in Contiki?


I want to know in RPL networks, after a node sends one packet to another node (for example RPL-Collect/udp-sender), how to know that intended node will forward this packet or not? I think overhearing neighbors transmission is needed, but is the another simple way to implemented this scenario in Contiki/Cooja?


Solution

  • To overhear packets in addition to normal operation you need to do several things:

    1. Ensure that the radio is turned on and in the right channel. If you're using always-on CSMA or ContikiMAC you don't need to do anything special. Same for TSCH minimal schedule. Otherwise for TSCH you need to schedule a Rx cell with the right channel offset and in the right timeslot.

    2. Somehow hack into the MAC layer to print or account packets not addressed to you - normally the MAC layer silently drops such packets.

    3. Ensure hardware frame filtering is turned off (the radio is in promiscious mode).

    Example:

    radio_value_t radio_rx_mode;
    /* Entering promiscuous mode so that the radio accepts all frames */
    NETSTACK_RADIO.get_value(RADIO_PARAM_RX_MODE, &radio_rx_mode);
    NETSTACK_RADIO.set_value(RADIO_PARAM_RX_MODE, radio_rx_mode & (~RADIO_RX_MODE_ADDRESS_FILTER));
    

    If you just need to overhear packets and don't need the normal operation things and simpler. You can use SenSniff then.