Skip to content

Commit

Permalink
announce reattach fix (ARMmbed#1873)
Browse files Browse the repository at this point in the history
Thread device attempts to reattach using parent request
after hearing an announce
  • Loading branch information
deepakvenugopal authored Oct 23, 2018
1 parent fc11a7a commit 5b70440
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion source/6LoWPAN/Thread/thread_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2149,6 +2149,12 @@ static bool thread_bootstrap_sync_after_reset_start(protocol_interface_info_entr
uint16_t my_short_address;
uint8_t parent_mac64[8];

// link sync is allowed only once in bootstrap start and we might get here in other cases also
if (!cur->thread_info->link_sync_allowed) {
return false;
}
cur->thread_info->link_sync_allowed = false;

int link_info_err = thread_nvm_store_link_info_get(parent_mac64, &my_short_address);
if ( link_info_err!= THREAD_NVM_FILE_SUCCESS) {
tr_warning("thread_nvm_store_link_info_get returned %d", link_info_err);
Expand All @@ -2157,7 +2163,7 @@ static bool thread_bootstrap_sync_after_reset_start(protocol_interface_info_entr
link_info_err = thread_nvm_store_link_info_clear();
if ( link_info_err!= THREAD_NVM_FILE_SUCCESS) {
tr_warning("thread_nvm_store_link_info_clear returned %d", link_info_err);
}
}
if (thread_is_router_addr(my_short_address)) {
thread_info(cur)->routerShortAddress = my_short_address;
thread_dynamic_storage_build_mle_table(cur->id);
Expand Down
1 change: 1 addition & 0 deletions source/6LoWPAN/Thread/thread_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ int8_t thread_bootstrap_up(protocol_interface_info_entry_t *cur)
ret_val = nwk_6lowpan_up(cur);

cur->nwk_nd_re_scan_count = 0;
cur->thread_info->link_sync_allowed = true;

return ret_val;
}
Expand Down
1 change: 1 addition & 0 deletions source/6LoWPAN/Thread/thread_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ typedef struct thread_info_s {
bool networkDataRequested: 1;
bool end_device_link_synch: 1;
bool router_mc_addrs_registered: 1;
bool link_sync_allowed:1;
bool leader_synced:1; // flag used by leader after restart
} thread_info_t;

Expand Down

0 comments on commit 5b70440

Please sign in to comment.