ccontikicontiki-ng

Contiki ng cant find reference to rpl_set_root()


Im trying to run code that was written for contiki3.x on contiki-ng, I get a compilation error stating undefined reference to `rpl_set_root', eventhough I include "net/routing/rpl-classic/rpl.h". Wen i open the source code rpl-classic/rpl.h and rpl-classic/rpl.c i can see the dunction clearly being there

The following code produces the compilation error.

uip_ds6_addr_add(&ipaddr, 0, ADDR_MANUAL);

root_if = uip_ds6_addr_lookup(&ipaddr);
if(root_if != NULL) {
  rpl_dag_t *dag;
  dag = rpl_set_root(RPL_DEFAULT_INSTANCE,(uip_ip6addr_t *)&ipaddr);
  uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
  rpl_set_prefix(dag, &ipaddr, 64);

} else {
  printf("No DAG created\n");
}

Solution

  • By default Contiki-NG has RPL-lite enabled, which does not have this function.

    To switch to RPL classic, add this line to application's Makefile:

    MAKE_ROUTING = MAKE_ROUTING_RPL_CLASSIC
    

    Then make clean and build the application again.