From b9187daa624eaeca226f3c2f62c9f61433395c82 Mon Sep 17 00:00:00 2001 From: Mika Tervonen Date: Thu, 6 Feb 2020 15:39:18 +0200 Subject: [PATCH] Randomize fixed channel when making new parent selection --- source/6LoWPAN/ws/ws_bootstrap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/6LoWPAN/ws/ws_bootstrap.c b/source/6LoWPAN/ws/ws_bootstrap.c index c74a27fbb27..2f714679585 100644 --- a/source/6LoWPAN/ws/ws_bootstrap.c +++ b/source/6LoWPAN/ws/ws_bootstrap.c @@ -2807,6 +2807,10 @@ void ws_bootstrap_network_scan_process(protocol_interface_info_entry_t *cur) selected_parent_ptr = ws_bootstrap_candidate_parent_get_best(cur); if (!selected_parent_ptr) { + // Configure LLC for network discovery + ws_bootstrap_network_discovery_configure(cur); + // randomize new channel and start MAC + ws_bootstrap_fhss_activate(cur); // Next check will be after one trickle cur->bootsrap_state_machine_cnt += cur->ws_info->trickle_params_pan_discovery.Imin + randLIB_get_8bit() % 50; tr_info("Making parent selection in %u s", (cur->bootsrap_state_machine_cnt / 10)); @@ -2825,9 +2829,6 @@ void ws_bootstrap_network_scan_process(protocol_interface_info_entry_t *cur) //Remove Neighbour and set Link setup back ns_list_remove(&cur->ws_info->parent_list_reserved, selected_parent_ptr); ns_list_add_to_end(&cur->ws_info->parent_list_free, selected_parent_ptr); - // Configure LLC for network discovery - ws_bootstrap_network_discovery_configure(cur); - ws_bootstrap_fhss_activate(cur); goto select_best_candidate; }