Do not force DIO reset on certain events where it is not needed.
This commit is contained in:
parent
b405571e32
commit
ea73f1d767
|
@ -561,7 +561,7 @@ rpl_select_dodag(rpl_instance_t * instance, rpl_parent_t *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(best_dag == NULL) {
|
if(best_dag == NULL) {
|
||||||
/* No parent found : the calling function handle this problem. */
|
/* No parent found: the calling function handle this problem. */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ rpl_select_dodag(rpl_instance_t * instance, rpl_parent_t *p)
|
||||||
/* Remove routes installed by DAOs. */
|
/* Remove routes installed by DAOs. */
|
||||||
rpl_remove_routes(instance->current_dag);
|
rpl_remove_routes(instance->current_dag);
|
||||||
|
|
||||||
PRINTF("RPL: New preferred DODAG : ");
|
PRINTF("RPL: New preferred DODAG: ");
|
||||||
PRINT6ADDR(&best_dag->dag_id);
|
PRINT6ADDR(&best_dag->dag_id);
|
||||||
PRINTF("\n");
|
PRINTF("\n");
|
||||||
|
|
||||||
|
@ -986,7 +986,7 @@ rpl_local_repair(rpl_instance_t *instance)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl_reset_dio_timer(instance,1);
|
rpl_reset_dio_timer(instance, 0);
|
||||||
|
|
||||||
RPL_STAT(rpl_stats.local_repairs++);
|
RPL_STAT(rpl_stats.local_repairs++);
|
||||||
}
|
}
|
||||||
|
@ -1105,14 +1105,14 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
|
||||||
|
|
||||||
instance = rpl_get_instance(dio->instance_id);
|
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 = rpl_get_dodag(dio->instance_id,&dio->dag_id);
|
dag = rpl_get_dodag(dio->instance_id,&dio->dag_id);
|
||||||
if(dag == NULL) {
|
if(dag == NULL) {
|
||||||
PRINTF("RPL : Adding new dodag to known instance.\n");
|
PRINTF("RPL: Adding new dodag to known instance.\n");
|
||||||
rpl_add_dodag(from,dio);
|
rpl_add_dodag(from,dio);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1122,7 +1122,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
|
||||||
PRINTF("RPL: Root received inconsistent DIO version number\n");
|
PRINTF("RPL: Root received inconsistent DIO version number\n");
|
||||||
dag->version = dio->version;
|
dag->version = dio->version;
|
||||||
RPL_LOLLIPOP_INCREMENT(dag->version);
|
RPL_LOLLIPOP_INCREMENT(dag->version);
|
||||||
rpl_reset_dio_timer(instance, 1);
|
rpl_reset_dio_timer(instance, 0);
|
||||||
} else {
|
} else {
|
||||||
global_repair(from, dag, dio);
|
global_repair(from, dag, dio);
|
||||||
}
|
}
|
||||||
|
@ -1132,7 +1132,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
|
||||||
/* Inconsistency detected - someone is still on old version */
|
/* Inconsistency detected - someone is still on old version */
|
||||||
PRINTF("RPL: old version received => inconsistency detected\n");
|
PRINTF("RPL: old version received => inconsistency detected\n");
|
||||||
if(dag->joined) {
|
if(dag->joined) {
|
||||||
rpl_reset_dio_timer(instance, 1);
|
rpl_reset_dio_timer(instance, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1140,7 +1140,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
|
||||||
|
|
||||||
if(dio->rank == INFINITE_RANK) {
|
if(dio->rank == INFINITE_RANK) {
|
||||||
if(dag->joined) {
|
if(dag->joined) {
|
||||||
rpl_reset_dio_timer(instance, 1);
|
rpl_reset_dio_timer(instance, 0);
|
||||||
}
|
}
|
||||||
} else if(dio->rank < ROOT_RANK(instance)) {
|
} else 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",
|
||||||
|
@ -1199,7 +1199,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
|
||||||
PRINTF("RPL current state: Prefered DODAG: ");
|
PRINTF("RPL current state: Prefered DODAG: ");
|
||||||
PRINT6ADDR(&instance->current_dag->dag_id);
|
PRINT6ADDR(&instance->current_dag->dag_id);
|
||||||
PRINTF(", rank: %u, min_rank: %u, ",instance->current_dag->rank,instance->current_dag->min_rank);
|
PRINTF(", rank: %u, min_rank: %u, ",instance->current_dag->rank,instance->current_dag->min_rank);
|
||||||
PRINTF("p->rank : %u, p->mc.obj.etx : %u, p->link_metric : %u, instance->mc.obj.etx %u\n", p->rank, p->mc.obj.etx, p->link_metric,instance->mc.obj.etx);
|
PRINTF("p->rank: %u, p->mc.obj.etx: %u, p->link_metric: %u, instance->mc.obj.etx %u\n", p->rank, p->mc.obj.etx, p->link_metric,instance->mc.obj.etx);
|
||||||
|
|
||||||
/* We have allocated a candidate parent; process the DIO further. */
|
/* We have allocated a candidate parent; process the DIO further. */
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ rpl_verify_header(int uip_ext_opt_offset)
|
||||||
|
|
||||||
instance = rpl_get_instance(UIP_EXT_HDR_OPT_RPL_BUF->instance);
|
instance = rpl_get_instance(UIP_EXT_HDR_OPT_RPL_BUF->instance);
|
||||||
if(instance == NULL) {
|
if(instance == NULL) {
|
||||||
PRINTF("RPL: Unknown instance : %u\n",
|
PRINTF("RPL: Unknown instance: %u\n",
|
||||||
UIP_EXT_HDR_OPT_RPL_BUF->instance);
|
UIP_EXT_HDR_OPT_RPL_BUF->instance);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ rpl_verify_header(int uip_ext_opt_offset)
|
||||||
if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_DOWN) {
|
if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_DOWN) {
|
||||||
PRINTF("RPL: Packet going down :\n");
|
PRINTF("RPL: Packet going down :\n");
|
||||||
if(UIP_EXT_HDR_OPT_RPL_BUF->senderrank > instance->current_dag->rank) {
|
if(UIP_EXT_HDR_OPT_RPL_BUF->senderrank > instance->current_dag->rank) {
|
||||||
PRINTF("RPL: Loop detected : Sender rank > our rank\n");
|
PRINTF("RPL: Loop detected: Sender rank > our rank\n");
|
||||||
if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_RANK_ERR) {
|
if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_RANK_ERR) {
|
||||||
PRINTF("RPL: Loop detected !\n");
|
PRINTF("RPL: Loop detected !\n");
|
||||||
/* We should try to repair it, not implemented for the moment */
|
/* We should try to repair it, not implemented for the moment */
|
||||||
|
@ -103,7 +103,7 @@ rpl_verify_header(int uip_ext_opt_offset)
|
||||||
} else {
|
} else {
|
||||||
PRINTF("RPL: Packet going up :");
|
PRINTF("RPL: Packet going up :");
|
||||||
if(UIP_EXT_HDR_OPT_RPL_BUF->senderrank < instance->current_dag->rank) {
|
if(UIP_EXT_HDR_OPT_RPL_BUF->senderrank < instance->current_dag->rank) {
|
||||||
PRINTF("RPL: Rank error : Sender rank < our rank\n");
|
PRINTF("RPL: Rank error: Sender rank < our rank\n");
|
||||||
if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_RANK_ERR) {
|
if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_RANK_ERR) {
|
||||||
PRINTF("RPL: Loop detected !\n");
|
PRINTF("RPL: Loop detected !\n");
|
||||||
/* We should try to repair it, not implemented for the moment */
|
/* We should try to repair it, not implemented for the moment */
|
||||||
|
@ -236,7 +236,7 @@ rpl_add_header(rpl_instance_t *instance, int down)
|
||||||
uip_ext_opt_offset = 2;
|
uip_ext_opt_offset = 2;
|
||||||
|
|
||||||
if(instance == NULL || !instance->used || !instance->current_dag->joined) {
|
if(instance == NULL || !instance->used || !instance->current_dag->joined) {
|
||||||
PRINTF("Unable to add RPL hop-by-hop extension header : incorrect instance\n");
|
PRINTF("Unable to add RPL hop-by-hop extension header: incorrect instance\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,7 +233,7 @@ dio_input(void)
|
||||||
|
|
||||||
PRINTF("RPL: Incoming DIO DODAG ");
|
PRINTF("RPL: Incoming DIO DODAG ");
|
||||||
PRINT6ADDR(&dio.dag_id);
|
PRINT6ADDR(&dio.dag_id);
|
||||||
PRINTF(" preference : %u\n",dio.preference);
|
PRINTF(", preference: %u\n", dio.preference);
|
||||||
|
|
||||||
/* Check if there are any DIO suboptions. */
|
/* Check if there are any DIO suboptions. */
|
||||||
for(; i < buffer_length; i += len) {
|
for(; i < buffer_length; i += len) {
|
||||||
|
|
|
@ -178,7 +178,8 @@ void
|
||||||
rpl_reset_dio_timer(rpl_instance_t *instance, uint8_t force)
|
rpl_reset_dio_timer(rpl_instance_t *instance, uint8_t force)
|
||||||
{
|
{
|
||||||
#if !RPL_LEAF_ONLY
|
#if !RPL_LEAF_ONLY
|
||||||
/* only reset if not just reset or started */
|
/* Do not reset if we are already on the minimum interval,
|
||||||
|
unless forced to do so. */
|
||||||
if(force || instance->dio_intcurrent > instance->dio_intmin) {
|
if(force || instance->dio_intcurrent > instance->dio_intmin) {
|
||||||
instance->dio_counter = 0;
|
instance->dio_counter = 0;
|
||||||
instance->dio_intcurrent = instance->dio_intmin;
|
instance->dio_intcurrent = instance->dio_intmin;
|
||||||
|
@ -197,8 +198,8 @@ handle_dao_timer(void *ptr)
|
||||||
|
|
||||||
instance = (rpl_instance_t *)ptr;
|
instance = (rpl_instance_t *)ptr;
|
||||||
|
|
||||||
if (!dio_send_ok && uip_ds6_get_link_local(ADDR_PREFERRED) == NULL) {
|
if(!dio_send_ok && uip_ds6_get_link_local(ADDR_PREFERRED) == NULL) {
|
||||||
PRINTF("RPL: Postpone DAO transmission... \n");
|
PRINTF("RPL: Postpone DAO transmission\n");
|
||||||
ctimer_set(&instance->dao_timer, CLOCK_SECOND, handle_dao_timer, instance);
|
ctimer_set(&instance->dao_timer, CLOCK_SECOND, handle_dao_timer, instance);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue