Merge pull request #915 from cetic/pr-rpl-default-route-infinite

Allow rpl default route lifetime to be infinite
This commit is contained in:
Nicolas Tsiftes 2015-05-26 16:26:58 +02:00
commit be891c0554
2 changed files with 18 additions and 3 deletions

View File

@ -105,6 +105,22 @@
#define RPL_MAX_DAG_PER_INSTANCE 2
#endif /* RPL_CONF_MAX_DAG_PER_INSTANCE */
/*
* RPL Default route lifetime
* The RPL route lifetime is used for the downward routes and for the default
* route. In a high density network with DIO suppression activated it may happen
* that a node will never send a DIO once the DIO interval becomes high as it
* has heard DIO from many neighbors already. As the default route to the
* preferred parent has a lifetime reset by receiving DIO from the parent, it
* means that the default route can be destroyed after a while. Setting the
* default route with infinite lifetime secures the upstream route.
*/
#ifdef RPL_CONF_DEFAULT_ROUTE_INFINITE_LIFETIME
#define RPL_DEFAULT_ROUTE_INFINITE_LIFETIME RPL_CONF_DEFAULT_ROUTE_INFINITE_LIFETIME
#else
#define RPL_DEFAULT_ROUTE_INFINITE_LIFETIME 0
#endif /* RPL_CONF_DEFAULT_ROUTE_INFINITE_LIFETIME */
/*
*
*/

View File

@ -481,8 +481,7 @@ rpl_set_default_route(rpl_instance_t *instance, uip_ipaddr_t *from)
PRINT6ADDR(from);
PRINTF("\n");
instance->def_route = uip_ds6_defrt_add(from,
RPL_LIFETIME(instance,
instance->default_lifetime));
RPL_DEFAULT_ROUTE_INFINITE_LIFETIME ? 0 : RPL_LIFETIME(instance, instance->default_lifetime));
if(instance->def_route == NULL) {
return 0;
}
@ -1398,7 +1397,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
}
/* We received a new DIO from our preferred parent.
* Call uip_ds6_defrt_add to set a fresh value for the lifetime counter */
uip_ds6_defrt_add(from, RPL_LIFETIME(instance, instance->default_lifetime));
uip_ds6_defrt_add(from, RPL_DEFAULT_ROUTE_INFINITE_LIFETIME ? 0 : RPL_LIFETIME(instance, instance->default_lifetime));
}
p->dtsn = dio->dtsn;
}