1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 22:13:52 +01:00

unbrick send_DAO by checking my_dodag

This commit is contained in:
Ludwig Ortmann 2013-11-21 18:32:24 +01:00
parent 7c979751e5
commit 6939d6f07b

View File

@ -345,9 +345,19 @@ void send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime,
mutex_lock(&rpl_send_mutex);
rpl_dodag_t *my_dodag;
my_dodag = rpl_get_my_dodag();
if ((my_dodag = rpl_get_my_dodag()) == NULL) {
DEBUG("send_DAO: I have no my_dodag\n");
mutex_unlock(&rpl_send_mutex);
return;
}
if (destination == NULL) {
if (my_dodag->my_preferred_parent == NULL) {
DEBUG("send_DAO: my_dodag has no my_preferred_parent\n");
mutex_unlock(&rpl_send_mutex);
return;
}
destination = &my_dodag->my_preferred_parent->addr;
}
@ -361,11 +371,6 @@ void send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime,
icmp_send_buf->code = ICMP_CODE_DAO;
icmp_send_buf->checksum = ~icmpv6_csum(IPV6_PROTO_NUM_ICMPV6);
if (my_dodag == NULL) {
mutex_unlock(&rpl_send_mutex);
return;
}
rpl_send_dao_buf = get_rpl_send_dao_buf();
memset(rpl_send_dao_buf, 0, sizeof(*rpl_send_dao_buf));
rpl_send_dao_buf->rpl_instanceid = my_dodag->instance->id;