Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unbrick send_DAO by checking my_dodag #360

Merged
merged 1 commit into from Nov 23, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 11 additions & 6 deletions sys/net/rpl/rpl.c
Expand Up @@ -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;
}

Expand All @@ -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;
Expand Down