Search code examples
ciotcontiki

Contiki OS - Selective Forward Attack, trying to edit uip6.c


I am trying to implement an intrusion detection system(IDS) for IoT, and now I want to implement a selective forward attack to test the IDS.

To do this, I want to drop all packets that are not destined for that specific node or is not RPL control messages.

Currently, I have found out that the datapackets are forwarded in the file /core/net/ipv6/uip6.c. However, because I want some nodes to be "nice" nodes and some nodes to be malicious, I am struggeling to understand how to modify the uip6.c file for only the malicious file. I have tried to create seperate files, but I can not import the modified uip6.c file (I also created an modified uip.h file in net/ip/uip.h). Even though I in the malicious node include the modified uip.h file and not the original, the malicious node still forward the message from the original uip6.c file. Can someone explain why or explain other possibilites to how I can implement a selective forward attack?

Thanks!


Solution

  • I ended up using a attack_flag, that was set to one if the button was pressed. If the attack_flag was 1, do not forward the packet in uip6.c. So in another program, you can set an attack_flag-variable, for instance, when the button is pressed.