diff --git a/source/6LoWPAN/Thread/thread_router_bootstrap.c b/source/6LoWPAN/Thread/thread_router_bootstrap.c index 311267800bc..7729f778f1c 100644 --- a/source/6LoWPAN/Thread/thread_router_bootstrap.c +++ b/source/6LoWPAN/Thread/thread_router_bootstrap.c @@ -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); @@ -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;