@@ -516,15 +516,23 @@ static int thread_pbbr_bb_ans_cb(int8_t service_id, uint8_t source_address[16],
516
516
duplicate_dua_tr_t * tr_ptr = thread_border_router_dup_tr_find (this -> interface_id ,addr_data_ptr );
517
517
if (tr_ptr ) {
518
518
// We have pending request and received answer
519
- thread_resolution_client_address_error (this -> interface_id , tr_ptr -> source_address , tr_ptr -> target_eid , tr_ptr -> ml_eid );
520
- ipv6_neighbour_t * neighbour_entry ;
521
- neighbour_entry = ipv6_neighbour_lookup (& cur -> ipv6_neighbour_cache , tr_ptr -> target_eid );
522
- if (neighbour_entry ) {
523
- tr_debug ("Remove from neigh Cache: %s" , tr_ipv6 (tr_ptr -> target_eid ));
524
- ipv6_neighbour_entry_remove (& cur -> ipv6_neighbour_cache , neighbour_entry );
519
+ if (memcmp (ml_eid_ptr ,tr_ptr -> ml_eid , 8 ) != 0 ){
520
+ // Different ml_eid but same address means duplicate address detected
521
+ thread_resolution_client_address_error (this -> interface_id , tr_ptr -> source_address , tr_ptr -> target_eid , tr_ptr -> ml_eid );
522
+ ipv6_neighbour_t * neighbour_entry ;
523
+ neighbour_entry = ipv6_neighbour_lookup (& cur -> ipv6_neighbour_cache , tr_ptr -> target_eid );
524
+ if (neighbour_entry ) {
525
+ tr_debug ("Remove from neigh Cache: %s" , tr_ipv6 (tr_ptr -> target_eid ));
526
+ ipv6_neighbour_entry_remove (& cur -> ipv6_neighbour_cache , neighbour_entry );
527
+ }
528
+ ipv6_route_delete (route -> prefix , route -> prefix_len , this -> interface_id , route -> info .next_hop_addr , ROUTE_THREAD_PROXIED_HOST );
529
+ } else {
530
+ // Roaming case lets inform other pbbr that we have newest
531
+ thread_border_router_bb_ans_send (this , source_address , tr_ptr -> target_eid , tr_ptr -> ml_eid , 0 , link_configuration_ptr -> name );
525
532
}
533
+ } else {
534
+ ipv6_route_delete (route -> prefix , route -> prefix_len , this -> interface_id , route -> info .next_hop_addr , ROUTE_THREAD_PROXIED_HOST );
526
535
}
527
- ipv6_route_delete (route -> prefix , route -> prefix_len , this -> interface_id , route -> info .next_hop_addr , ROUTE_THREAD_PROXIED_HOST );
528
536
529
537
// If delayed DUA registration entry is present send duplicate error code to DUA.response
530
538
return 0 ;
@@ -665,9 +673,9 @@ static int thread_extension_bbr_dua_cb(int8_t service_id, uint8_t source_address
665
673
}
666
674
*/
667
675
protocol_interface_info_entry_t * cur = protocol_stack_interface_info_get_by_id (this -> interface_id );
668
- if (0 != thread_extension_primary_bbr_get (cur , bbr_rloc_addr , NULL , NULL , NULL ) ||
676
+ if (0 == thread_extension_primary_bbr_get (cur , bbr_rloc_addr , NULL , NULL , NULL ) &&
669
677
!addr_get_entry (cur ,bbr_rloc_addr )) {
670
- // Primary BBR not present or I am not BBR
678
+ // Primary pBBR present and I am not the pBBR
671
679
bbr_status = THREAD_BBR_STATUS_NOT_PRIMARY_BBR ;
672
680
goto send_response ;
673
681
}
0 commit comments