Merge pull request #372 from simonduq/contrib/root-old-version-reset-trickle

RPL Lite: reset trickle when hearing old versions from the root
This commit is contained in:
Simon Duquennoy 2018-04-13 16:52:08 +02:00 committed by GitHub
commit b5017d5405
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -395,9 +395,15 @@ process_dio_from_current_dag(uip_ipaddr_t *from, rpl_dio_t *dio)
return; return;
} }
/* If the DIO sender is on an older version of the DAG, ignore it. The node /* If the DIO sender is on an older version of the DAG, do not process it
will eventually hear the global repair and catch up. */ * further. The sender will eventually hear the global repair and catch up. */
if(rpl_lollipop_greater_than(curr_instance.dag.version, dio->version)) { if(rpl_lollipop_greater_than(curr_instance.dag.version, dio->version)) {
if(dio->rank == ROOT_RANK) {
/* Before returning, if the DIO was from the root, an old DAG versions
* likely incidates a root reboot. Reset our DIO timer to make sure the
* root hears our version ASAP, and in turn triggers a global repair. */
rpl_timers_dio_reset("Heard old version from root");
}
return; return;
} }
@ -412,10 +418,12 @@ process_dio_from_current_dag(uip_ipaddr_t *from, rpl_dio_t *dio)
* Must come first, as it might remove all neighbors, and we then need * Must come first, as it might remove all neighbors, and we then need
* to re-add this source of the DIO to the neighbor table */ * to re-add this source of the DIO to the neighbor table */
if(rpl_lollipop_greater_than(dio->version, curr_instance.dag.version)) { if(rpl_lollipop_greater_than(dio->version, curr_instance.dag.version)) {
if(curr_instance.dag.rank == ROOT_RANK) { /* The root should not hear newer versions */ if(curr_instance.dag.rank == ROOT_RANK) {
/* The root should not hear newer versions unless it just rebooted */
LOG_ERR("inconsistent DIO version (current: %u, received: %u), initiate global repair\n", LOG_ERR("inconsistent DIO version (current: %u, received: %u), initiate global repair\n",
curr_instance.dag.version, dio->version); curr_instance.dag.version, dio->version);
curr_instance.dag.version = dio->version; /* Update version and trigger global repair */ /* Update version and trigger global repair */
curr_instance.dag.version = dio->version;
rpl_global_repair("Inconsistent DIO version"); rpl_global_repair("Inconsistent DIO version");
} else { } else {
LOG_WARN("new DIO version (current: %u, received: %u), apply global repair\n", LOG_WARN("new DIO version (current: %u, received: %u), apply global repair\n",