mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
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
@ -1096,6 +1096,32 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
|
||||
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) {
|
||||
PRINTF("RPL: Ignoring DIO from node with infinite rank: ");
|
||||
PRINT6ADDR(from);
|
||||
@ -1103,40 +1129,18 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
|
||||
return;
|
||||
}
|
||||
|
||||
instance = rpl_get_instance(dio->instance_id);
|
||||
if(instance == NULL) {
|
||||
PRINTF("RPL: New instance detected: Joining...\n");
|
||||
rpl_join_instance(from, dio);
|
||||
return;
|
||||
}
|
||||
|
||||
dag = get_dag(dio->instance_id, &dio->dag_id);
|
||||
if(dag == NULL) {
|
||||
PRINTF("RPL: Adding new DAG to known instance.\n");
|
||||
rpl_add_dag(from, dio);
|
||||
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)) {
|
||||
PRINTF("RPL: Ignoring DIO with too low rank: %u\n",
|
||||
|
Loading…
Reference in New Issue
Block a user