Make RPL route lifetime RFC compliant
This commit is contained in:
parent
c1f11cfaa9
commit
d866e6bd34
|
@ -145,8 +145,14 @@
|
||||||
/* Special value indicating immediate removal. */
|
/* Special value indicating immediate removal. */
|
||||||
#define RPL_ZERO_LIFETIME 0
|
#define RPL_ZERO_LIFETIME 0
|
||||||
|
|
||||||
|
/* Special value indicating infinite lifetime. */
|
||||||
|
#define RPL_INFINITE_LIFETIME 0xFF
|
||||||
|
|
||||||
|
#define RPL_ROUTE_INFINITE_LIFETIME 0xFFFFFFFF
|
||||||
|
|
||||||
#define RPL_LIFETIME(instance, lifetime) \
|
#define RPL_LIFETIME(instance, lifetime) \
|
||||||
((unsigned long)(instance)->lifetime_unit * (lifetime))
|
(((lifetime) == RPL_INFINITE_LIFETIME) ? RPL_ROUTE_INFINITE_LIFETIME : (unsigned long)(instance)->lifetime_unit * (lifetime))
|
||||||
|
|
||||||
|
|
||||||
#ifndef RPL_CONF_MIN_HOPRANKINC
|
#ifndef RPL_CONF_MIN_HOPRANKINC
|
||||||
/* RFC6550 defines the default MIN_HOPRANKINC as 256.
|
/* RFC6550 defines the default MIN_HOPRANKINC as 256.
|
||||||
|
|
|
@ -238,7 +238,7 @@ set_dao_lifetime_timer(rpl_instance_t *instance)
|
||||||
|
|
||||||
/* Set up another DAO within half the expiration time, if such a
|
/* Set up another DAO within half the expiration time, if such a
|
||||||
time has been configured */
|
time has been configured */
|
||||||
if(instance->lifetime_unit != 0xffff && instance->default_lifetime != 0xff) {
|
if(instance->default_lifetime != RPL_INFINITE_LIFETIME) {
|
||||||
clock_time_t expiration_time;
|
clock_time_t expiration_time;
|
||||||
expiration_time = (clock_time_t)instance->default_lifetime *
|
expiration_time = (clock_time_t)instance->default_lifetime *
|
||||||
(clock_time_t)instance->lifetime_unit *
|
(clock_time_t)instance->lifetime_unit *
|
||||||
|
|
|
@ -122,7 +122,7 @@ rpl_purge_routes(void)
|
||||||
r = uip_ds6_route_head();
|
r = uip_ds6_route_head();
|
||||||
|
|
||||||
while(r != NULL) {
|
while(r != NULL) {
|
||||||
if(r->state.lifetime >= 1) {
|
if(r->state.lifetime >= 1 && r->state.lifetime != RPL_ROUTE_INFINITE_LIFETIME) {
|
||||||
/*
|
/*
|
||||||
* If a route is at lifetime == 1, set it to 0, scheduling it for
|
* If a route is at lifetime == 1, set it to 0, scheduling it for
|
||||||
* immediate removal below. This achieves the same as the original code,
|
* immediate removal below. This achieves the same as the original code,
|
||||||
|
|
Loading…
Reference in a new issue