fixed so that DAO NACK now is either for the path or for RPL root - if from root then do not try to switch parent since that will not help

This commit is contained in:
Joakim Eriksson 2015-09-23 09:12:35 +02:00
parent dae21fcb76
commit 8afe3fb9b7
3 changed files with 12 additions and 4 deletions

View file

@ -663,6 +663,7 @@ dao_input(void)
int learned_from;
rpl_parent_t *parent;
uip_ds6_nbr_t *nbr;
int is_root;
prefixlen = 0;
parent = NULL;
@ -695,6 +696,8 @@ dao_input(void)
sequence = buffer[pos++];
dag = instance->current_dag;
is_root = (dag->rank == ROOT_RANK(instance));
/* Is the DAG ID present? */
if(flags & RPL_DAO_D_FLAG) {
if(memcmp(&dag->dag_id, &buffer[pos], sizeof(dag->dag_id))) {
@ -829,7 +832,8 @@ dao_input(void)
if(flags & RPL_DAO_K_FLAG) {
/* signal the failure to add the node */
dao_ack_output(instance, &dao_sender_addr, sequence,
RPL_DAO_ACK_UNABLE_TO_ACCEPT);
is_root ? RPL_DAO_ACK_UNABLE_TO_ACCEPT_ROOT :
RPL_DAO_ACK_UNABLE_TO_ACCEPT);
}
goto discard;
}
@ -838,11 +842,11 @@ dao_input(void)
if(rep == NULL) {
RPL_STAT(rpl_stats.mem_overflows++);
PRINTF("RPL: Could not add a route after receiving a DAO\n");
if(flags & RPL_DAO_K_FLAG) {
/* signal the failure to add the node */
dao_ack_output(instance, &dao_sender_addr, sequence,
RPL_DAO_ACK_UNABLE_TO_ACCEPT);
is_root ? RPL_DAO_ACK_UNABLE_TO_ACCEPT_ROOT :
RPL_DAO_ACK_UNABLE_TO_ACCEPT);
}
goto discard;
}