Skip to content

Commit

Permalink
RLOC was updated before clearing child info (ARMmbed#1547)
Browse files Browse the repository at this point in the history
based on old RLOC. Fix first clears the child info based
on old RLOC before updating RLOC.
  • Loading branch information
deepakvenugopal authored Jan 30, 2018
1 parent a666056 commit edd7599
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions source/6LoWPAN/Thread/thread_router_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1011,10 +1011,19 @@ static void thread_bootstrap_client_router_id_cb(int8_t interface_id, int8_t sta
parent_router_id = cur->thread_info->thread_endnode_parent->router_id;
}

tr_info("Thread Short address changed old: %x new: %x", cur->thread_info->routerShortAddress, router_rloc);
/*the default routerShortAddress if nothing is requested is 0xfffe so eliminate this case
Also make sure that the child info (from previous partition if any)
is cleared if the router address requested is not what is got from leader */
if ( cur->thread_info->routerShortAddress != router_rloc) {
thread_router_bootstrap_child_information_clear(cur);
}
// Release network data from old address
cur->thread_info->localServerDataBase.release_old_address = true;

//ADD New ML16
// This should be used thread_bootstrap_update_ml16_address(cur, router_rloc);
thread_clean_old_16_bit_address_based_addresses(cur);

mac_helper_mac16_address_set(cur, router_rloc);
cur->thread_info->routerShortAddress = router_rloc;
memcpy(ml16, cur->thread_info->threadPrivatePrefixInfo.ulaPrefix, 8);
Expand All @@ -1028,16 +1037,6 @@ static void thread_bootstrap_client_router_id_cb(int8_t interface_id, int8_t sta
return;
}

tr_info("Thread Short address changed old: %x new: %x", cur->thread_info->routerShortAddress, router_rloc);
/*the default routerShortAddress if nothing is requested is 0xfffe so eliminate this case
Also make sure that the child info (from previous partition if any)
is cleared if the router address requested is not what is got from leader */
if (cur->thread_info->routerShortAddress != router_rloc) {
thread_router_bootstrap_child_information_clear(cur);
}
// Release network data from old address
cur->thread_info->localServerDataBase.release_old_address = true;

// /* XXX Is short_src_adr ever reset? Is it undefined if info not in msg? */
tr_debug("Route seq %d Router mask: %s", routeId, trace_array(router_mask_ptr, 8));
cur->thread_info->routing.router_id_sequence_valid = false;
Expand Down

0 comments on commit edd7599

Please sign in to comment.