Skip to content

Commit dda8164

Browse files
thread address handling updated. (ARMmbed#1496)
1 parent 1dc21a1 commit dda8164

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

source/6LoWPAN/Thread/thread_extension_bbr.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -516,15 +516,23 @@ static int thread_pbbr_bb_ans_cb(int8_t service_id, uint8_t source_address[16],
516516
duplicate_dua_tr_t *tr_ptr = thread_border_router_dup_tr_find(this->interface_id,addr_data_ptr);
517517
if (tr_ptr) {
518518
// 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);
525532
}
533+
} else {
534+
ipv6_route_delete(route->prefix, route->prefix_len, this->interface_id, route->info.next_hop_addr, ROUTE_THREAD_PROXIED_HOST);
526535
}
527-
ipv6_route_delete(route->prefix, route->prefix_len, this->interface_id, route->info.next_hop_addr, ROUTE_THREAD_PROXIED_HOST);
528536

529537
// If delayed DUA registration entry is present send duplicate error code to DUA.response
530538
return 0;
@@ -665,9 +673,9 @@ static int thread_extension_bbr_dua_cb(int8_t service_id, uint8_t source_address
665673
}
666674
*/
667675
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) &&
669677
!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
671679
bbr_status = THREAD_BBR_STATUS_NOT_PRIMARY_BBR;
672680
goto send_response;
673681
}

0 commit comments

Comments
 (0)