Skip to content

Commit 5b70440

Browse files
announce reattach fix (ARMmbed#1873)
Thread device attempts to reattach using parent request after hearing an announce
1 parent fc11a7a commit 5b70440

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

source/6LoWPAN/Thread/thread_bootstrap.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2149,6 +2149,12 @@ static bool thread_bootstrap_sync_after_reset_start(protocol_interface_info_entr
21492149
uint16_t my_short_address;
21502150
uint8_t parent_mac64[8];
21512151

2152+
// link sync is allowed only once in bootstrap start and we might get here in other cases also
2153+
if (!cur->thread_info->link_sync_allowed) {
2154+
return false;
2155+
}
2156+
cur->thread_info->link_sync_allowed = false;
2157+
21522158
int link_info_err = thread_nvm_store_link_info_get(parent_mac64, &my_short_address);
21532159
if ( link_info_err!= THREAD_NVM_FILE_SUCCESS) {
21542160
tr_warning("thread_nvm_store_link_info_get returned %d", link_info_err);
@@ -2157,7 +2163,7 @@ static bool thread_bootstrap_sync_after_reset_start(protocol_interface_info_entr
21572163
link_info_err = thread_nvm_store_link_info_clear();
21582164
if ( link_info_err!= THREAD_NVM_FILE_SUCCESS) {
21592165
tr_warning("thread_nvm_store_link_info_clear returned %d", link_info_err);
2160-
}
2166+
}
21612167
if (thread_is_router_addr(my_short_address)) {
21622168
thread_info(cur)->routerShortAddress = my_short_address;
21632169
thread_dynamic_storage_build_mle_table(cur->id);

source/6LoWPAN/Thread/thread_common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ int8_t thread_bootstrap_up(protocol_interface_info_entry_t *cur)
226226
ret_val = nwk_6lowpan_up(cur);
227227

228228
cur->nwk_nd_re_scan_count = 0;
229+
cur->thread_info->link_sync_allowed = true;
229230

230231
return ret_val;
231232
}

source/6LoWPAN/Thread/thread_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ typedef struct thread_info_s {
328328
bool networkDataRequested: 1;
329329
bool end_device_link_synch: 1;
330330
bool router_mc_addrs_registered: 1;
331+
bool link_sync_allowed:1;
331332
bool leader_synced:1; // flag used by leader after restart
332333
} thread_info_t;
333334

0 commit comments

Comments
 (0)