Merge pull request #301 from adamdunkels/hotfix-rpl-max-dio

RPL bugfix: don't ignore infinite rank DIOs
This commit is contained in:
Nicolas Tsiftes 2013-07-26 06:48:26 -07:00
commit d228cb57a5

View File

@ -630,7 +630,7 @@ rpl_select_dag(rpl_instance_t *instance, rpl_parent_t *p)
instance->of->update_metric_container(instance);
/* Update the DAG rank. */
best_dag->rank = instance->of->calculate_rank(best_dag->preferred_parent, 0);
if(best_dag->rank < best_dag->min_rank) {
if(last_parent == NULL || best_dag->rank < best_dag->min_rank) {
best_dag->min_rank = best_dag->rank;
} else if(!acceptable_rank(best_dag, best_dag->rank)) {
PRINTF("RPL: New rank unacceptable!\n");
@ -1029,11 +1029,13 @@ rpl_recalculate_ranks(void)
* than RPL protocol messages. This periodical recalculation is called
* from a timer in order to keep the stack depth reasonably low.
*/
for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES; instance < end; ++instance) {
for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES;
instance < end; ++instance) {
if(instance->used) {
for(i = 0; i < RPL_MAX_DAG_PER_INSTANCE; i++) {
if(instance->dag_table[i].used) {
for(p = list_head(instance->dag_table[i].parents); p != NULL; p = p->next) {
for(p = list_head(instance->dag_table[i].parents);
p != NULL; p = p->next) {
if(p->updated) {
p->updated = 0;
if(!rpl_process_parent_event(instance, p)) {
@ -1145,13 +1147,6 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
}
}
if(dio->rank == INFINITE_RANK) {
PRINTF("RPL: Ignoring DIO from node with infinite rank: ");
PRINT6ADDR(from);
PRINTF("\n");
return;
}
if(instance == NULL) {
PRINTF("RPL: New instance detected: Joining...\n");
rpl_join_instance(from, dio);