Merge pull request #2054 from cetic/pr-check-incoming-rank

Reject parents with invalid rank
This commit is contained in:
Antonio Lignan 2017-01-13 16:08:00 +01:00 committed by GitHub
commit 3d40056f4f

View file

@ -865,7 +865,10 @@ best_parent(rpl_dag_t *dag, int fresh_only)
for(p = nbr_table_head(rpl_parents); p != NULL; p = nbr_table_next(rpl_parents, p)) { for(p = nbr_table_head(rpl_parents); p != NULL; p = nbr_table_next(rpl_parents, p)) {
/* Exclude parents from other DAGs or announcing an infinite rank */ /* Exclude parents from other DAGs or announcing an infinite rank */
if(p->dag != dag || p->rank == INFINITE_RANK) { if(p->dag != dag || p->rank == INFINITE_RANK || p->rank < ROOT_RANK(dag->instance)) {
if(p->rank < ROOT_RANK(dag->instance)) {
PRINTF("RPL: Parent has invalid rank\n");
}
continue; continue;
} }