From 4208973017fe64fecf3b1c57188a005238a76337 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Fri, 3 Jun 2016 21:19:08 +0200 Subject: [PATCH] Fix DAO-ACK support for non-storing --- core/net/rpl/rpl-icmp6.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index 5bf4fc3d1..5531f6100 100644 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -1061,7 +1061,7 @@ handle_dao_retransmission(void *ptr) return; } - if(instance->of->dao_ack_callback) { + if(RPL_IS_STORING(instance) && instance->of->dao_ack_callback) { /* Inform the objective function about the timeout. */ instance->of->dao_ack_callback(parent, RPL_DAO_ACK_TIMEOUT); } @@ -1274,11 +1274,15 @@ dao_ack_input(void) return; } - parent = rpl_find_parent(instance->current_dag, &UIP_IP_BUF->srcipaddr); - if(parent == NULL) { - /* not a known instance - drop the packet and ignore */ - uip_clear_buf(); - return; + if(RPL_IS_STORING(instance)) { + parent = rpl_find_parent(instance->current_dag, &UIP_IP_BUF->srcipaddr); + if(parent == NULL) { + /* not a known instance - drop the packet and ignore */ + uip_clear_buf(); + return; + } + } else { + parent = NULL; } PRINTF("RPL: Received a DAO %s with sequence number %d (%d) and status %d from ", @@ -1294,7 +1298,7 @@ dao_ack_input(void) ctimer_stop(&instance->dao_retransmit_timer); /* Inform objective function on status of the DAO ACK */ - if(instance->of->dao_ack_callback) { + if(RPL_IS_STORING(instance) && instance->of->dao_ack_callback) { instance->of->dao_ack_callback(parent, status); } @@ -1308,7 +1312,7 @@ dao_ack_input(void) } #endif - } else { + } else if(RPL_IS_STORING(instance)) { /* this DAO ACK should be forwarded to another recently registered route */ uip_ds6_route_t *re; uip_ipaddr_t *nexthop;