Skip to content

Commit a156355

Browse files
author
Juha Heiskanen
committed
WS PAN config message handler update
Update synch info only for configured parent after configuration is learned. Change-Id: I27adeca5103bd7fb80f558e49d50d7625d50f900
1 parent ab1260a commit a156355

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ static int8_t ws_fhss_enable(protocol_interface_info_entry_t *cur)
468468
/* Sets the parent and broadcast schedule we are following
469469
*
470470
*/
471-
static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry *cur, llc_neighbour_req_t *neighbor_info)
471+
static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry *cur, llc_neighbour_req_t *neighbor_info, bool force_synch)
472472
{
473473

474474
fhss_ws_configuration_t fhss_configuration;
@@ -498,7 +498,7 @@ static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry
498498
ns_fhss_ws_configuration_set(cur->ws_info->fhss_api, &fhss_configuration);
499499

500500
// We have broadcast schedule set up set the broadcast parent schedule
501-
ns_fhss_ws_set_parent(cur->ws_info->fhss_api, neighbor_info->neighbor->mac64, &neighbor_info->ws_neighbor->fhss_data.bc_timing_info, true);
501+
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);
502502

503503
// Update LLC to follow updated fhss settings
504504
ws_bootstrap_llc_hopping_update(cur,&fhss_configuration);
@@ -930,16 +930,18 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
930930
return;
931931
}
932932

933-
//Update synch to primary parent allways to update broadcast shedule and timing
934-
if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) {
935-
// RPL priority parent configuration we must update FHSS data
936-
ws_bootstrap_primary_parent_set(cur, &neighbor_info);
937-
}
933+
if (cur->ws_info->configuration_learned ) {
934+
bool old_version = cur->ws_info->pan_information.pan_version == pan_version;
935+
if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) {
936+
// RPL priority parent configuration we must update FHSS data
937+
//Update synch to primary parent allways to update broadcast shedule and timing
938+
ws_bootstrap_primary_parent_set(cur, &neighbor_info, !old_version);
939+
}
938940

939-
if (cur->ws_info->configuration_learned &&
940-
cur->ws_info->pan_information.pan_version == pan_version) {
941-
// No new information
942-
return;
941+
if (old_version) {
942+
// No new information
943+
return;
944+
}
943945
}
944946

945947
/*
@@ -958,13 +960,10 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
958960
// return to state machine after 1-2 s
959961
cur->bootsrap_state_machine_cnt = randLIB_get_random_in_range(10 ,20);
960962
// enable frequency hopping for unicast channel and start listening first neighbour
961-
ws_bootstrap_primary_parent_set(cur, &neighbor_info);
963+
ws_bootstrap_primary_parent_set(cur, &neighbor_info, true);
962964
// set neighbor as priority parent clear if there is others
963965
protocol_6lowpan_neighbor_priority_clear_all(cur->id, PRIORITY_1ST);
964966
neighbor_info.neighbor->link_role = PRIORITY_PARENT_NEIGHBOUR;
965-
} else if (neighbor_info.neighbor->link_role != PRIORITY_PARENT_NEIGHBOUR) {
966-
//This cuold affect serious problem if BC parameters are changed
967-
ws_bootstrap_primary_parent_set(cur, &neighbor_info);
968967
}
969968
}
970969

@@ -2138,7 +2137,7 @@ void ws_primary_parent_update(protocol_interface_info_entry_t *interface, mac_ne
21382137
llc_neighbour_req_t neighbor_info;
21392138
neighbor_info.neighbor = neighbor;
21402139
neighbor_info.ws_neighbor = ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, neighbor->index);
2141-
ws_bootstrap_primary_parent_set(interface, &neighbor_info);
2140+
ws_bootstrap_primary_parent_set(interface, &neighbor_info, true);
21422141

21432142
ws_secondary_parent_update(interface);
21442143
}

0 commit comments

Comments
 (0)