@@ -297,22 +297,19 @@ static bool thread_border_router_local_network_data_prefix_match(thread_network_
297
297
return true;
298
298
}
299
299
300
- static void thread_border_router_children_network_data_check_and_clean (uint8_t interface_id , uint16_t child_id )
300
+ static void thread_border_router_child_network_data_clean (uint8_t interface_id , uint16_t child_id )
301
301
{
302
302
uint8_t addr16_buf [2 ];
303
303
304
- if (thread_is_router_addr (child_id )) {
305
- // Do not check routers
304
+ common_write_16_bit (child_id , addr16_buf );
305
+ if (mle_class_get_by_link_address (interface_id , addr16_buf , ADDR_802_15_4_SHORT )) {
306
+ /* Child is available in mle, do nothing */
306
307
return ;
307
308
}
308
309
309
- common_write_16_bit (child_id , addr16_buf );
310
-
311
- if (!mle_class_get_by_link_address (interface_id , addr16_buf , ADDR_802_15_4_SHORT )) {
312
- // Child is not our child => network data contains data from lost children, remove it
313
- tr_debug ("Remove nwk data from lost child: %04x" , child_id );
314
- thread_management_client_network_data_unregister (interface_id , child_id );
315
- }
310
+ // Child is not our child => network data contains data from lost children, remove it
311
+ tr_debug ("Remove nwk data from lost child: %04x" , child_id );
312
+ thread_management_client_network_data_unregister (interface_id , child_id );
316
313
}
317
314
318
315
static void thread_border_router_lost_children_nwk_data_validate (protocol_interface_info_entry_t * cur , uint16_t router_short_addr )
@@ -331,15 +328,15 @@ static void thread_border_router_lost_children_nwk_data_validate(protocol_interf
331
328
ns_list_foreach (thread_network_server_data_entry_t , curRoute , & curLP -> routeList ) {
332
329
if (thread_addr_is_child (router_short_addr , curRoute -> routerID )) {
333
330
// Router children found
334
- thread_border_router_children_network_data_check_and_clean (cur -> id , curRoute -> routerID );
331
+ thread_border_router_child_network_data_clean (cur -> id , curRoute -> routerID );
335
332
}
336
333
}
337
334
338
335
/* Go through all BR's */
339
336
ns_list_foreach (thread_network_server_data_entry_t , curBR , & curLP -> borderRouterList ) {
340
337
if (thread_addr_is_child (router_short_addr , curBR -> routerID )) {
341
338
// Router children found
342
- thread_border_router_children_network_data_check_and_clean (cur -> id , curBR -> routerID );
339
+ thread_border_router_child_network_data_clean (cur -> id , curBR -> routerID );
343
340
}
344
341
}
345
342
}
@@ -349,7 +346,7 @@ static void thread_border_router_lost_children_nwk_data_validate(protocol_interf
349
346
ns_list_foreach (thread_network_data_service_server_entry_t , server , & service -> server_list ) {
350
347
if (thread_addr_is_child (router_short_addr , server -> router_id )) {
351
348
// Router children found
352
- thread_border_router_children_network_data_check_and_clean (cur -> id , server -> router_id );
349
+ thread_border_router_child_network_data_clean (cur -> id , server -> router_id );
353
350
}
354
351
}
355
352
}
0 commit comments