From b782cda83760ab1a630b69b2aa3d5af521469cfe Mon Sep 17 00:00:00 2001 From: Laurent Deru Date: Mon, 11 Dec 2017 17:19:51 +0100 Subject: [PATCH] Do RPL probing on all the known DAG --- os/net/rpl-classic/rpl-ns.h | 1 + os/net/rpl-classic/rpl-timers.c | 20 +++++++++++++++++++- os/net/rpl-classic/rpl.h | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/os/net/rpl-classic/rpl-ns.h b/os/net/rpl-classic/rpl-ns.h index f6ae4c2c6..dcc7e584a 100644 --- a/os/net/rpl-classic/rpl-ns.h +++ b/os/net/rpl-classic/rpl-ns.h @@ -56,6 +56,7 @@ typedef struct rpl_ns_node { struct rpl_ns_node *next; uint32_t lifetime; + rpl_dag_t *dag; /* Store only IPv6 link identifiers as all nodes in the DAG share the same prefix */ unsigned char link_identifier[8]; struct rpl_ns_node *parent; diff --git a/os/net/rpl-classic/rpl-timers.c b/os/net/rpl-classic/rpl-timers.c index b89a1258d..9d3db3d22 100644 --- a/os/net/rpl-classic/rpl-timers.c +++ b/os/net/rpl-classic/rpl-timers.c @@ -457,11 +457,29 @@ get_probing_target(rpl_dag_t *dag) return probing_target; } /*---------------------------------------------------------------------------*/ +static rpl_dag_t * +get_next_dag(rpl_instance_t *instance) +{ + rpl_dag_t *dag = NULL; + int new_dag = instance->last_dag; + do { + new_dag++; + if(new_dag >= RPL_MAX_DAG_PER_INSTANCE) { + new_dag = 0; + } + if(instance->dag_table[new_dag].used) { + dag = &instance->dag_table[new_dag]; + } + } while(new_dag != instance->last_dag && dag == NULL); + instance->last_dag = new_dag; + return dag; +} +/*---------------------------------------------------------------------------*/ static void handle_probing_timer(void *ptr) { rpl_instance_t *instance = (rpl_instance_t *)ptr; - rpl_parent_t *probing_target = RPL_PROBING_SELECT_FUNC(instance->current_dag); + rpl_parent_t *probing_target = RPL_PROBING_SELECT_FUNC(get_next_dag(instance)); uip_ipaddr_t *target_ipaddr = rpl_parent_get_ipaddr(probing_target); /* Perform probing */ diff --git a/os/net/rpl-classic/rpl.h b/os/net/rpl-classic/rpl.h index 185bcbef2..2fe9f1dbf 100644 --- a/os/net/rpl-classic/rpl.h +++ b/os/net/rpl-classic/rpl.h @@ -252,6 +252,7 @@ struct rpl_instance { #if RPL_WITH_PROBING struct ctimer probing_timer; rpl_parent_t *urgent_probing_target; + int last_dag; #endif /* RPL_WITH_PROBING */ struct ctimer dio_timer; struct ctimer dao_timer;