From a156355e5848c149debf3d4a9311bfec7ea4bf91 Mon Sep 17 00:00:00 2001 From: Juha Heiskanen Date: Mon, 22 Oct 2018 10:12:17 +0300 Subject: [PATCH] WS PAN config message handler update Update synch info only for configured parent after configuration is learned. Change-Id: I27adeca5103bd7fb80f558e49d50d7625d50f900 --- source/6LoWPAN/ws/ws_bootstrap.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/source/6LoWPAN/ws/ws_bootstrap.c b/source/6LoWPAN/ws/ws_bootstrap.c index 3ab0b68f71d..b6f443860df 100644 --- a/source/6LoWPAN/ws/ws_bootstrap.c +++ b/source/6LoWPAN/ws/ws_bootstrap.c @@ -468,7 +468,7 @@ static int8_t ws_fhss_enable(protocol_interface_info_entry_t *cur) /* Sets the parent and broadcast schedule we are following * */ -static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry *cur, llc_neighbour_req_t *neighbor_info) +static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry *cur, llc_neighbour_req_t *neighbor_info, bool force_synch) { fhss_ws_configuration_t fhss_configuration; @@ -498,7 +498,7 @@ static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry ns_fhss_ws_configuration_set(cur->ws_info->fhss_api, &fhss_configuration); // We have broadcast schedule set up set the broadcast parent schedule - ns_fhss_ws_set_parent(cur->ws_info->fhss_api, neighbor_info->neighbor->mac64, &neighbor_info->ws_neighbor->fhss_data.bc_timing_info, true); + ns_fhss_ws_set_parent(cur->ws_info->fhss_api, neighbor_info->neighbor->mac64, &neighbor_info->ws_neighbor->fhss_data.bc_timing_info, force_synch); // Update LLC to follow updated fhss settings ws_bootstrap_llc_hopping_update(cur,&fhss_configuration); @@ -930,16 +930,18 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry return; } - //Update synch to primary parent allways to update broadcast shedule and timing - if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) { - // RPL priority parent configuration we must update FHSS data - ws_bootstrap_primary_parent_set(cur, &neighbor_info); - } + if (cur->ws_info->configuration_learned ) { + bool old_version = cur->ws_info->pan_information.pan_version == pan_version; + if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) { + // RPL priority parent configuration we must update FHSS data + //Update synch to primary parent allways to update broadcast shedule and timing + ws_bootstrap_primary_parent_set(cur, &neighbor_info, !old_version); + } - if (cur->ws_info->configuration_learned && - cur->ws_info->pan_information.pan_version == pan_version) { - // No new information - return; + if (old_version) { + // No new information + return; + } } /* @@ -958,13 +960,10 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry // return to state machine after 1-2 s cur->bootsrap_state_machine_cnt = randLIB_get_random_in_range(10 ,20); // enable frequency hopping for unicast channel and start listening first neighbour - ws_bootstrap_primary_parent_set(cur, &neighbor_info); + ws_bootstrap_primary_parent_set(cur, &neighbor_info, true); // set neighbor as priority parent clear if there is others protocol_6lowpan_neighbor_priority_clear_all(cur->id, PRIORITY_1ST); neighbor_info.neighbor->link_role = PRIORITY_PARENT_NEIGHBOUR; - } else if (neighbor_info.neighbor->link_role != PRIORITY_PARENT_NEIGHBOUR) { - //This cuold affect serious problem if BC parameters are changed - ws_bootstrap_primary_parent_set(cur, &neighbor_info); } } @@ -2138,7 +2137,7 @@ void ws_primary_parent_update(protocol_interface_info_entry_t *interface, mac_ne llc_neighbour_req_t neighbor_info; neighbor_info.neighbor = neighbor; neighbor_info.ws_neighbor = ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, neighbor->index); - ws_bootstrap_primary_parent_set(interface, &neighbor_info); + ws_bootstrap_primary_parent_set(interface, &neighbor_info, true); ws_secondary_parent_update(interface); }