From aaf5deabe268a1f43d211f2d01f5b8f63ac081b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dawans?= Date: Tue, 5 Feb 2013 15:18:56 +0100 Subject: [PATCH 1/3] Allow user configuration of RPL Lifetime and Lifetime Unit --- core/net/rpl/rpl-private.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/net/rpl/rpl-private.h b/core/net/rpl/rpl-private.h index 71f634409..3c5c293d2 100644 --- a/core/net/rpl/rpl-private.h +++ b/core/net/rpl/rpl-private.h @@ -113,10 +113,18 @@ #define RPL_ZERO_LIFETIME 0 /* Default route lifetime unit. */ +#ifndef RPL_CONF_DEFAULT_LIFETIME_UNIT #define RPL_DEFAULT_LIFETIME_UNIT 0xffff +#else +#define RPL_DEFAULT_LIFETIME_UNIT RPL_CONF_DEFAULT_LIFETIME_UNIT +#endif /* Default route lifetime as a multiple of the lifetime unit. */ +#ifndef RPL_CONF_DEFAULT_LIFETIME #define RPL_DEFAULT_LIFETIME 0xff +#else +#define RPL_DEFAULT_LIFETIME RPL_CONF_DEFAULT_LIFETIME +#endif #define RPL_LIFETIME(instance, lifetime) \ ((unsigned long)(instance)->lifetime_unit * (lifetime)) From b6c54faf9def94f67ad277ea5a1490e3cee26c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dawans?= Date: Tue, 5 Feb 2013 15:43:13 +0100 Subject: [PATCH 2/3] Adds default route lifetime update in RPL DIO processing --- core/net/rpl/rpl-dag.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 2f92498a7..16ab54eaf 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -1223,6 +1223,9 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio) RPL_LOLLIPOP_INCREMENT(instance->dtsn_out); rpl_schedule_dao(instance); } + /* 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)); } p->dtsn = dio->dtsn; } From e02d480ff520e700b364193646a2aae7499d6a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dawans?= Date: Fri, 8 Feb 2013 16:43:09 +0100 Subject: [PATCH 3/3] Moved RPL Lifetime configuration to rpl-conf.h --- core/net/rpl/rpl-conf.h | 19 +++++++++++++++++++ core/net/rpl/rpl-private.h | 14 -------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/core/net/rpl/rpl-conf.h b/core/net/rpl/rpl-conf.h index 693272b13..7d3662474 100644 --- a/core/net/rpl/rpl-conf.h +++ b/core/net/rpl/rpl-conf.h @@ -165,4 +165,23 @@ #define RPL_INIT_LINK_METRIC NEIGHBOR_INFO_ETX2FIX(RPL_CONF_INIT_LINK_METRIC) #endif +/* + * Default route lifetime unit. This is the granularity of time + * used in RPL lifetime values, in seconds. + */ +#ifndef RPL_CONF_DEFAULT_LIFETIME_UNIT +#define RPL_DEFAULT_LIFETIME_UNIT 0xffff +#else +#define RPL_DEFAULT_LIFETIME_UNIT RPL_CONF_DEFAULT_LIFETIME_UNIT +#endif + +/* + * Default route lifetime as a multiple of the lifetime unit. + */ +#ifndef RPL_CONF_DEFAULT_LIFETIME +#define RPL_DEFAULT_LIFETIME 0xff +#else +#define RPL_DEFAULT_LIFETIME RPL_CONF_DEFAULT_LIFETIME +#endif + #endif /* RPL_CONF_H */ diff --git a/core/net/rpl/rpl-private.h b/core/net/rpl/rpl-private.h index 3c5c293d2..a8f884ee1 100644 --- a/core/net/rpl/rpl-private.h +++ b/core/net/rpl/rpl-private.h @@ -112,20 +112,6 @@ /* Special value indicating immediate removal. */ #define RPL_ZERO_LIFETIME 0 -/* Default route lifetime unit. */ -#ifndef RPL_CONF_DEFAULT_LIFETIME_UNIT -#define RPL_DEFAULT_LIFETIME_UNIT 0xffff -#else -#define RPL_DEFAULT_LIFETIME_UNIT RPL_CONF_DEFAULT_LIFETIME_UNIT -#endif - -/* Default route lifetime as a multiple of the lifetime unit. */ -#ifndef RPL_CONF_DEFAULT_LIFETIME -#define RPL_DEFAULT_LIFETIME 0xff -#else -#define RPL_DEFAULT_LIFETIME RPL_CONF_DEFAULT_LIFETIME -#endif - #define RPL_LIFETIME(instance, lifetime) \ ((unsigned long)(instance)->lifetime_unit * (lifetime))