Updated DAG version processing to occur even for infinite rank DIOs. This makes it possible for the RPL root to infer the DAG version number from a network that hasn't had a root for a while, and where the rank has increased to infinity.
This commit is contained in:
parent
db7cb567f5
commit
15deb37e64
1 changed files with 26 additions and 22 deletions
|
@ -1096,6 +1096,32 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dag = get_dag(dio->instance_id, &dio->dag_id);
|
||||||
|
instance = rpl_get_instance(dio->instance_id);
|
||||||
|
|
||||||
|
if(dag != NULL && instance != NULL) {
|
||||||
|
if(lollipop_greater_than(dio->version, dag->version)) {
|
||||||
|
if(dag->rank == ROOT_RANK(instance)) {
|
||||||
|
PRINTF("RPL: Root received inconsistent DIO version number\n");
|
||||||
|
dag->version = dio->version;
|
||||||
|
RPL_LOLLIPOP_INCREMENT(dag->version);
|
||||||
|
rpl_reset_dio_timer(instance);
|
||||||
|
} else {
|
||||||
|
global_repair(from, dag, dio);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lollipop_greater_than(dag->version, dio->version)) {
|
||||||
|
/* The DIO sender is on an older version of the DAG. */
|
||||||
|
PRINTF("RPL: old version received => inconsistency detected\n");
|
||||||
|
if(dag->joined) {
|
||||||
|
rpl_reset_dio_timer(instance);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(dio->rank == INFINITE_RANK) {
|
if(dio->rank == INFINITE_RANK) {
|
||||||
PRINTF("RPL: Ignoring DIO from node with infinite rank: ");
|
PRINTF("RPL: Ignoring DIO from node with infinite rank: ");
|
||||||
PRINT6ADDR(from);
|
PRINT6ADDR(from);
|
||||||
|
@ -1103,40 +1129,18 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
instance = rpl_get_instance(dio->instance_id);
|
|
||||||
if(instance == NULL) {
|
if(instance == NULL) {
|
||||||
PRINTF("RPL: New instance detected: Joining...\n");
|
PRINTF("RPL: New instance detected: Joining...\n");
|
||||||
rpl_join_instance(from, dio);
|
rpl_join_instance(from, dio);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dag = get_dag(dio->instance_id, &dio->dag_id);
|
|
||||||
if(dag == NULL) {
|
if(dag == NULL) {
|
||||||
PRINTF("RPL: Adding new DAG to known instance.\n");
|
PRINTF("RPL: Adding new DAG to known instance.\n");
|
||||||
rpl_add_dag(from, dio);
|
rpl_add_dag(from, dio);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lollipop_greater_than(dio->version, dag->version)) {
|
|
||||||
if(dag->rank == ROOT_RANK(instance)) {
|
|
||||||
PRINTF("RPL: Root received inconsistent DIO version number\n");
|
|
||||||
dag->version = dio->version;
|
|
||||||
RPL_LOLLIPOP_INCREMENT(dag->version);
|
|
||||||
rpl_reset_dio_timer(instance);
|
|
||||||
} else {
|
|
||||||
global_repair(from, dag, dio);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(lollipop_greater_than(dag->version, dio->version)) {
|
|
||||||
/* The DIO sender is on an older version of the DAG. */
|
|
||||||
PRINTF("RPL: old version received => inconsistency detected\n");
|
|
||||||
if(dag->joined) {
|
|
||||||
rpl_reset_dio_timer(instance);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(dio->rank < ROOT_RANK(instance)) {
|
if(dio->rank < ROOT_RANK(instance)) {
|
||||||
PRINTF("RPL: Ignoring DIO with too low rank: %u\n",
|
PRINTF("RPL: Ignoring DIO with too low rank: %u\n",
|
||||||
|
|
Loading…
Reference in a new issue