Skip to content

Commit 2378dad

Browse files
author
Arto Kinnunen
authored
Discard late Child ID responses (#1630)
Child ID response can be accepted only from neighbor that was selected as parent in the latest parent scan. A device needs to discard child ID responses from old parents that are responding late. Old rloc can be released from network data when new rloc is received.
1 parent 3e8b4ce commit 2378dad

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

source/6LoWPAN/Thread/thread_host_bootstrap.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,7 @@ static void thread_mle_child_request_receive_cb(int8_t interface_id, mle_message
752752
switch (mle_msg->message_type) {
753753

754754
case MLE_COMMAND_CHILD_ID_RESPONSE: {
755+
uint8_t src_mac64[8];
755756
uint8_t shortAddress[2];
756757
uint16_t childId;
757758
mle_tlv_info_t routeTlv, addressRegisteredTlv, networkDataTlv;
@@ -763,12 +764,21 @@ static void thread_mle_child_request_receive_cb(int8_t interface_id, mle_message
763764

764765
tr_info("Received Child ID Response");
765766

767+
// Validate that response is coming from the scanned parent candidate
768+
memcpy(src_mac64, (mle_msg->packet_src_address + 8), 8);
769+
src_mac64[0] ^= 2;
770+
if (memcmp(src_mac64, scan_result->mac64, 8) != 0) {
771+
tr_debug("Drop Child ID response from previous request");
772+
return;
773+
}
774+
766775
// Clear old data
767776
if (cur->thread_info->releaseRouterId) {
768777
thread_bootstrap_clear_neighbor_entries(cur);
769-
cur->thread_info->localServerDataBase.release_old_address = true;
770778
}
771779

780+
cur->thread_info->localServerDataBase.release_old_address = true;
781+
772782
thread_clean_all_routers_from_neighbor_list(cur->id);
773783
thread_leader_service_stop(interface_id);
774784
thread_leader_service_leader_data_free(cur->thread_info);

source/6LoWPAN/Thread/thread_network_data_storage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ typedef struct thread_network_local_data_cache_entry_s {
184184
thread_network_data_prefix_list_t prefix_list; /*!< Local parsed or generated service list */
185185
thread_network_data_service_list_t service_list;
186186
uint16_t registered_rloc16;/*!< Address used for latest registration */
187-
bool release_old_address:1;/*!< true if release of old address is needed */
187+
bool release_old_address:1;/*!< true if network data can be released from old address */
188188
bool publish_active:1;/*!< true when publish is active */
189189
bool publish_pending:1;/*!< true when publish attempt made during active publish */
190190
} thread_network_local_data_cache_entry_t;

0 commit comments

Comments
 (0)