diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 25bf8273a..84c1dabee 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -32,7 +32,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rpl-dag.c,v 1.41 2010/12/13 10:59:37 joxe Exp $ + * $Id: rpl-dag.c,v 1.42 2010/12/17 15:24:25 nvt-se Exp $ */ /** * \file @@ -117,8 +117,7 @@ remove_parents(rpl_dag_t *dag, rpl_rank_t minimum_rank) static int should_send_dao(rpl_dag_t *dag, rpl_dio_t *dio, rpl_parent_t *p) { - return 1; -/* return dio->dtsn > p->dtsn && p == dag->preferred_parent;*/ + return dio->dtsn > p->dtsn && p == dag->preferred_parent; } /************************************************************************/ static int @@ -237,6 +236,8 @@ rpl_alloc_dag(uint8_t instance_id) return dag; } } + + RPL_STAT(rpl_stats.mem_overflows++); return NULL; } /************************************************************************/ @@ -372,6 +373,7 @@ rpl_dag_t * rpl_get_dag(int instance_id) { int i; + for(i = 0; i < RPL_MAX_DAG_ENTRIES; i++) { if(dag_table[i].joined && (instance_id == RPL_ANY_INSTANCE || dag_table[i].instance_id == instance_id)) { diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index 801441173..ea3ea5db4 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -32,7 +32,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rpl-icmp6.c,v 1.33 2010/12/15 19:57:40 nvt-se Exp $ + * $Id: rpl-icmp6.c,v 1.34 2010/12/17 15:24:25 nvt-se Exp $ */ /** * \file @@ -484,7 +484,7 @@ dao_input(void) PRINTF("\n"); if(lifetime == ZERO_LIFETIME) { - /* No-DAO received; invoke the route purging routine. */ + /* No-Path DAO received; invoke the route purging routine. */ rep = uip_ds6_route_lookup(&prefix); if(rep != NULL && rep->state.saved_lifetime == 0) { PRINTF("RPL: Setting expiration timer for prefix "); @@ -515,6 +515,7 @@ dao_input(void) rep = rpl_add_route(dag, &prefix, prefixlen, &dao_sender_addr); if(rep == NULL) { + RPL_STAT(rpl_stats.memory_overflows++); PRINTF("RPL: Could not add a route after receiving a DAO\n"); return; } else { diff --git a/core/net/rpl/rpl-timers.c b/core/net/rpl/rpl-timers.c index b2303ad48..9bf2cb330 100644 --- a/core/net/rpl/rpl-timers.c +++ b/core/net/rpl/rpl-timers.c @@ -32,7 +32,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rpl-timers.c,v 1.15 2010/12/15 12:12:27 nvt-se Exp $ + * $Id: rpl-timers.c,v 1.16 2010/12/17 15:24:25 nvt-se Exp $ */ /** * \file @@ -224,10 +224,11 @@ rpl_schedule_dao(rpl_dag_t *dag) if(!etimer_expired(&dag->dao_timer.etimer)) { PRINTF("RPL: DAO timer already scheduled\n"); } else { - PRINTF("RPL: Scheduling DAO timer %u ticks in the future (%u %u)\n", - (unsigned)DEFAULT_DAO_LATENCY / dag->rank, - (unsigned)DEFAULT_DAO_LATENCY, (unsigned)dag->rank); - ctimer_set(&dag->dao_timer, DEFAULT_DAO_LATENCY, + expiration_time = DEFAULT_DAO_LATENCY / 2 + + (random_rand() % (DEFAULT_DAO_LATENCY)); + PRINTF("RPL: Scheduling DAO timer %u ticks in the future\n", + (unsigned)expiration_time); + ctimer_set(&dag->dao_timer, expiration_time, handle_dao_timer, dag); } } diff --git a/core/net/rpl/rpl.h b/core/net/rpl/rpl.h index b857fd910..a1e190cda 100644 --- a/core/net/rpl/rpl.h +++ b/core/net/rpl/rpl.h @@ -30,7 +30,7 @@ * * Author: Joakim Eriksson, Nicolas Tsiftes * - * $Id: rpl.h,v 1.27 2010/12/15 13:37:34 nvt-se Exp $ + * $Id: rpl.h,v 1.28 2010/12/17 15:24:25 nvt-se Exp $ */ #ifndef RPL_H @@ -85,7 +85,8 @@ /*---------------------------------------------------------------------------*/ /* Default values for RPL constants and variables. */ -#define DEFAULT_DAO_LATENCY (CLOCK_SECOND * (1 + (random_rand() & 0xf))) +/* The default value for the DAO timer. */ +#define DEFAULT_DAO_LATENCY (CLOCK_SECOND * 8) /* Special value indicating immediate removal. */ #define ZERO_LIFETIME 0