diff --git a/core/net/rpl/rpl-icmp6.c b/core/net/rpl/rpl-icmp6.c index 14af70293..0c16920cd 100755 --- a/core/net/rpl/rpl-icmp6.c +++ b/core/net/rpl/rpl-icmp6.c @@ -701,26 +701,17 @@ dao_output(rpl_parent_t *n, uint8_t lifetime) rpl_instance_t *instance; unsigned char *buffer; uint8_t prefixlen; - uip_ipaddr_t addr; uip_ipaddr_t prefix; int pos; /* Destination Advertisement Object */ + if(get_global_addr(&prefix) == 0) { PRINTF("RPL: No global address set for this node - suppressing DAO\n"); return; } - if(n == NULL) { - dag = rpl_get_any_dag(); - if(dag == NULL) { - PRINTF("RPL: Did not join a DAG before sending DAO\n"); - return; - } - } else { - dag = n->dag; - } - + dag = n->dag; instance = dag->instance; #ifdef RPL_DEBUG_DAO_OUTPUT @@ -765,23 +756,13 @@ dao_output(rpl_parent_t *n, uint8_t lifetime) buffer[pos++] = 0; /* path seq - ignored */ buffer[pos++] = lifetime; - if(n == NULL) { - uip_create_linklocal_rplnodes_mcast(&addr); - } else { - uip_ipaddr_copy(&addr, &n->addr); - } - PRINTF("RPL: Sending DAO with prefix "); PRINT6ADDR(&prefix); PRINTF(" to "); - if(n != NULL) { - PRINT6ADDR(&n->addr); - } else { - PRINTF("multicast address"); - } + PRINT6ADDR(&n->addr); PRINTF("\n"); - uip_icmp6_send(&addr, ICMP6_RPL, RPL_CODE_DAO, pos); + uip_icmp6_send(&n->addr, ICMP6_RPL, RPL_CODE_DAO, pos); } /*---------------------------------------------------------------------------*/ static void