Skip to content

Commit a8a5a90

Browse files
duplicate address detection fix (ARMmbed#1720)
updated duplicate address detection for roaming case. fixed a warning in buffer_dyn.c
1 parent 721c0b0 commit a8a5a90

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

source/6LoWPAN/Thread/thread_extension_bbr.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ static int thread_pbbr_bb_qry_cb(int8_t service_id, uint8_t source_address[16],
473473
}
474474

475475
uint32_t last_transaction_time = protocol_core_monotonic_time - ((thread_pbbr_dua_info_t *)route->info.info)->last_contact_time;
476-
uint8_t *ml_eid_ptr = &route->prefix[8];// TODO MLEID needs to be stored in own structure route->info.info and support for dealloc made
476+
uint8_t *ml_eid_ptr = ((thread_pbbr_dua_info_t *)route->info.info)->mleid_ptr;
477477

478478
// This address is valid in our MESH
479479
thread_border_router_bb_ans_send(this, source_address, addr_data_ptr, ml_eid_ptr, last_transaction_time, link_configuration_ptr->name, rloc_ptr);
@@ -515,7 +515,7 @@ static void thread_pbbr_pro_bb_ntf_process(protocol_interface_info_entry_t *cur,
515515

516516
remove_entry:
517517
tr_info("Remove dua registration for %s", trace_ipv6(addr_data_ptr));
518-
ipv6_route_delete(route->prefix, route->prefix_len, cur->id, route->info.next_hop_addr, ROUTE_THREAD_PROXIED_DUA_HOST);
518+
ipv6_route_delete(addr_data_ptr, 128, cur->id, NULL, ROUTE_THREAD_PROXIED_DUA_HOST);
519519
return;
520520
}
521521

@@ -542,7 +542,7 @@ static int thread_pbbr_dua_duplicate_address_detection(int8_t service_id, uint8_
542542
}
543543

544544
// We have pending request and received answer
545-
if (memcmp(ml_eid_ptr,tr_ptr->ml_eid, 8) == 0){
545+
if (memcmp(ml_eid_ptr,tr_ptr->ml_eid, 8) != 0 && memcmp(addr_data_ptr, tr_ptr->source_address, 16) == 0){
546546
// Different ml_eid but same address means duplicate address detected
547547
thread_resolution_client_address_error(this->interface_id, tr_ptr->source_address, tr_ptr->target_eid, tr_ptr->ml_eid);
548548
ipv6_neighbour_t *neighbour_entry;
@@ -551,7 +551,7 @@ static int thread_pbbr_dua_duplicate_address_detection(int8_t service_id, uint8_
551551
tr_debug("Remove from neigh Cache: %s", tr_ipv6(tr_ptr->target_eid));
552552
ipv6_neighbour_entry_remove(&cur->ipv6_neighbour_cache, neighbour_entry);
553553
}
554-
ipv6_route_delete(route->prefix, route->prefix_len, this->interface_id, route->info.next_hop_addr, ROUTE_THREAD_PROXIED_DUA_HOST);
554+
ipv6_route_delete(route->prefix, route->prefix_len, this->interface_id, NULL, ROUTE_THREAD_PROXIED_DUA_HOST);
555555
}
556556
return 0;
557557
}
@@ -855,18 +855,6 @@ static int thread_extension_bbr_dua_cb(int8_t service_id, uint8_t source_address
855855
thread_border_router_bb_qry_send(this,addr_data_ptr,NULL);
856856

857857
}
858-
// TODO
859-
// Save RLOC to destination cache with Last transaction time. Should these be made as sticky or should I have own table for these?
860-
// send Proactive ND with override
861-
// Send PRO_BB.ntf
862-
863-
// If new registration
864-
// Send BB.qry wait DUA_DUPL_CHECK_PERIOD == 1 second. own table needed for pending queries?
865-
// Repeat the message?
866-
// if response with different EID send error
867-
// Store the information
868-
869-
870858

871859
send_response:
872860

source/Core/buffer_dyn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ buffer_t *buffer_get_specific(uint16_t headroom, uint16_t size, uint16_t minspac
110110
#endif
111111
buf->size = total_size;
112112
} else {
113-
tr_error("buffer_get failed: alloc(%d)", sizeof(buffer_t) + total_size);
113+
tr_error("buffer_get failed: alloc(%d)", (int) sizeof(buffer_t) + total_size);
114114
}
115115

116116
protocol_stats_update(STATS_BUFFER_ALLOC, 1);

0 commit comments

Comments
 (0)