diff --git a/source/6LoWPAN/ws/ws_bootstrap.c b/source/6LoWPAN/ws/ws_bootstrap.c index e5457760895..daf16b9bc93 100644 --- a/source/6LoWPAN/ws/ws_bootstrap.c +++ b/source/6LoWPAN/ws/ws_bootstrap.c @@ -1066,19 +1066,26 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry ws_neighbor_class_neighbor_broadcast_schedule_set(neighbor_info.ws_neighbor, &ws_bs_ie); if (cur->ws_info->configuration_learned) { - // received version is lower se we need to reset the trickle + tr_info("PAN Config analyse own:%d, heard:%d", cur->ws_info->pan_information.pan_version, pan_version); if (cur->ws_info->pan_information.pan_version == pan_version) { + // Same version heard so it is consistent trickle_consistent_heard(&cur->ws_info->trickle_pan_config); + if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) { + ws_bootstrap_primary_parent_set(cur, &neighbor_info, WS_PARENT_SOFT_SYNCH); + } + // no need to process more + return; } else { - tr_info("different pan version heard"); + // received version is different so we need to reset the trickle trickle_inconsistent_heard(&cur->ws_info->trickle_pan_config, &cur->ws_info->trickle_params_pan_discovery); + if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) { + ws_bootstrap_primary_parent_set(cur, &neighbor_info, WS_PARENT_HARD_SYNCH); + } if (common_serial_number_greater_16(cur->ws_info->pan_information.pan_version, pan_version)) { // older version heard ignoring the message return; } } - - } if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) { @@ -1086,31 +1093,12 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry return; } - 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_parent_synch_e synreq; - if (old_version) { - synreq = WS_PARENT_SOFT_SYNCH; - } else { - synreq = WS_PARENT_HARD_SYNCH; - } - ws_bootstrap_primary_parent_set(cur, &neighbor_info, synreq); - } - - if (old_version) { - // No new information - return; - } - } - /* - * Learn new information from border router + * Learn new information from neighbor */ - tr_info("Updated PAN configuration heard"); + tr_info("Updated PAN configuration own:%d, heard:%d", cur->ws_info->pan_information.pan_version, pan_version); + // restart PAN version timer cur->ws_info->pan_version_timeout_timer = PAN_VERSION_TIMEOUT; cur->ws_info->pan_information.pan_version = pan_version; @@ -1264,19 +1252,19 @@ static void ws_bootstrap_asynch_ind(struct protocol_interface_info_entry *cur, c switch (message_type) { case WS_FT_PAN_ADVERT: // Analyse Advertisement - tr_debug("received ADVERT"); + tr_info("received ADVERT Src:%s rssi:%d", trace_array(data->SrcAddr, 8), data->signal_dbm); ws_bootstrap_pan_advertisement_analyse(cur, data, ie_ext, &ws_utt, &ws_us); break; case WS_FT_PAN_ADVERT_SOL: - tr_debug("received ADVERT SOL"); + tr_info("received ADVERT SOL Src:%s rssi:%d", trace_array(data->SrcAddr, 8), data->signal_dbm); ws_bootstrap_pan_advertisement_solicit_analyse(cur, data, &ws_utt, &ws_us); break; case WS_FT_PAN_CONF: - tr_debug("received CONFIG"); + tr_info("received CONFIG Src:%s rssi:%d", trace_array(data->SrcAddr, 8), data->signal_dbm); ws_bootstrap_pan_config_analyse(cur, data, ie_ext, &ws_utt, &ws_us); break; default: - tr_debug("received CONFIG SOL"); + tr_info("received CONFIG SOL Src:%s rssi:%d", trace_array(data->SrcAddr, 8), data->signal_dbm); ws_bootstrap_pan_config_solicit_analyse(cur, data, &ws_utt, &ws_us); break; } @@ -1946,10 +1934,8 @@ static void ws_bootstrap_advertise_start(protocol_interface_info_entry_t *cur) { cur->ws_info->trickle_pa_running = true; trickle_start(&cur->ws_info->trickle_pan_advertisement, &cur->ws_info->trickle_params_pan_discovery); - trickle_inconsistent_heard(&cur->ws_info->trickle_pan_advertisement, &cur->ws_info->trickle_params_pan_discovery); cur->ws_info->trickle_pc_running = true; trickle_start(&cur->ws_info->trickle_pan_config, &cur->ws_info->trickle_params_pan_discovery); - trickle_inconsistent_heard(&cur->ws_info->trickle_pan_config, &cur->ws_info->trickle_params_pan_discovery); } static void ws_bootstrap_pan_version_increment(protocol_interface_info_entry_t *cur)