@@ -949,6 +949,11 @@ static int thread_attach_parent_response_build(protocol_interface_info_entry_t *
949
949
950
950
void thread_router_bootstrap_child_information_clear (protocol_interface_info_entry_t * cur )
951
951
{
952
+
953
+ /*the default routerShortAddress if nothing is requested is 0xfffe so eliminate this case
954
+ Also make sure that the child info (from previous partition if any)
955
+ is cleared if no router address is got from leader */
956
+
952
957
if (!cur -> thread_info ) {
953
958
return ;
954
959
}
@@ -976,6 +981,26 @@ void thread_router_bootstrap_child_information_clear(protocol_interface_info_ent
976
981
}
977
982
978
983
}
984
+ static void thread_router_bootstrap_invalid_child_information_clear (protocol_interface_info_entry_t * cur , uint16_t router_rloc )
985
+ {
986
+
987
+ tr_debug ("Thread Short address changed old: %x new: %x" , cur -> thread_info -> routerShortAddress , router_rloc );
988
+
989
+ mle_neigh_table_list_t * entry_list = mle_class_active_list_get (cur -> id );
990
+ if (!entry_list ) {
991
+ return ;
992
+ }
993
+
994
+ // scrub neighbours with child addresses that are not ours
995
+ ns_list_foreach_safe (mle_neigh_table_entry_t , table_entry , entry_list ) {
996
+ if (table_entry -> short_adr < 0xfffe &&
997
+ !thread_is_router_addr (table_entry -> short_adr ) &&
998
+ thread_router_addr_from_addr (table_entry -> short_adr ) != router_rloc ) {
999
+ ipv6_neighbour_delete_registered_by_eui64 (& cur -> ipv6_neighbour_cache , table_entry -> mac64 );
1000
+ mle_class_remove_entry (cur -> id , table_entry );
1001
+ }
1002
+ }
1003
+ }
979
1004
980
1005
static void thread_bootstrap_client_router_id_cb (int8_t interface_id , int8_t status , uint16_t router_rloc , const uint8_t router_mask_ptr [9 ])
981
1006
{
@@ -1011,13 +1036,8 @@ static void thread_bootstrap_client_router_id_cb(int8_t interface_id, int8_t sta
1011
1036
parent_router_id = cur -> thread_info -> thread_endnode_parent -> router_id ;
1012
1037
}
1013
1038
1014
- tr_info ("Thread Short address changed old: %x new: %x" , cur -> thread_info -> routerShortAddress , router_rloc );
1015
- /*the default routerShortAddress if nothing is requested is 0xfffe so eliminate this case
1016
- Also make sure that the child info (from previous partition if any)
1017
- is cleared if the router address requested is not what is got from leader */
1018
- if ( cur -> thread_info -> routerShortAddress != router_rloc ) {
1019
- thread_router_bootstrap_child_information_clear (cur );
1020
- }
1039
+ thread_router_bootstrap_invalid_child_information_clear (cur ,router_rloc );
1040
+
1021
1041
// Release network data from old address
1022
1042
cur -> thread_info -> localServerDataBase .release_old_address = true;
1023
1043
0 commit comments