From 7855ba20ba0203876c2df726d71dc02df27488e5 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Sun, 29 Nov 2015 21:50:16 +0100 Subject: [PATCH] RPL: Check acceptable_rank even after first obtaining a parent. Added comment on a slight departure from RFC6550. --- core/net/rpl/rpl-dag.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/net/rpl/rpl-dag.c b/core/net/rpl/rpl-dag.c index 447be3df2..e5ff63923 100644 --- a/core/net/rpl/rpl-dag.c +++ b/core/net/rpl/rpl-dag.c @@ -791,8 +791,12 @@ rpl_select_dag(rpl_instance_t *instance, rpl_parent_t *p) /* Update the DAG rank. */ best_dag->rank = rpl_rank_via_parent(best_dag->preferred_parent); if(last_parent == NULL || best_dag->rank < best_dag->min_rank) { + /* This is a slight departure from RFC6550: if we had no preferred parent before, + * reset min_rank. This helps recovering from temporary bad link conditions. */ best_dag->min_rank = best_dag->rank; - } else if(!acceptable_rank(best_dag, best_dag->rank)) { + } + + if(!acceptable_rank(best_dag, best_dag->rank)) { PRINTF("RPL: New rank unacceptable!\n"); rpl_set_preferred_parent(instance->current_dag, NULL); if(instance->mop != RPL_MOP_NO_DOWNWARD_ROUTES && last_parent != NULL) {