Skip to content

Commit 1e1f69a

Browse files
author
Mika Tervonen
committed
modified trickle analyse function for pan configuration
Improved tracing for ASYNC messaged optimised the version analysing Removed the inconsistent for adverts when going to state 5
1 parent b7a8268 commit 1e1f69a

File tree

1 file changed

+18
-32
lines changed

1 file changed

+18
-32
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,51 +1066,39 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
10661066
ws_neighbor_class_neighbor_broadcast_schedule_set(neighbor_info.ws_neighbor, &ws_bs_ie);
10671067

10681068
if (cur->ws_info->configuration_learned) {
1069-
// received version is lower se we need to reset the trickle
1069+
tr_info("PAN Config analyse own:%d, heard:%d", cur->ws_info->pan_information.pan_version, pan_version);
10701070
if (cur->ws_info->pan_information.pan_version == pan_version) {
1071+
// Same version heard so it is consistent
10711072
trickle_consistent_heard(&cur->ws_info->trickle_pan_config);
1073+
if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) {
1074+
ws_bootstrap_primary_parent_set(cur, &neighbor_info, WS_PARENT_SOFT_SYNCH);
1075+
}
1076+
// no need to process more
1077+
return;
10721078
} else {
1073-
tr_info("different pan version heard");
1079+
// received version is different so we need to reset the trickle
10741080
trickle_inconsistent_heard(&cur->ws_info->trickle_pan_config, &cur->ws_info->trickle_params_pan_discovery);
1081+
if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) {
1082+
ws_bootstrap_primary_parent_set(cur, &neighbor_info, WS_PARENT_HARD_SYNCH);
1083+
}
10751084
if (common_serial_number_greater_16(cur->ws_info->pan_information.pan_version, pan_version)) {
10761085
// older version heard ignoring the message
10771086
return;
10781087
}
10791088
}
1080-
1081-
10821089
}
10831090

10841091
if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
10851092
//Border router does not learn network information
10861093
return;
10871094
}
10881095

1089-
if (cur->ws_info->configuration_learned) {
1090-
bool old_version = cur->ws_info->pan_information.pan_version == pan_version;
1091-
if (neighbor_info.neighbor->link_role == PRIORITY_PARENT_NEIGHBOUR) {
1092-
// RPL priority parent configuration we must update FHSS data
1093-
//Update synch to primary parent allways to update broadcast shedule and timing
1094-
ws_parent_synch_e synreq;
1095-
if (old_version) {
1096-
synreq = WS_PARENT_SOFT_SYNCH;
1097-
} else {
1098-
synreq = WS_PARENT_HARD_SYNCH;
1099-
}
1100-
ws_bootstrap_primary_parent_set(cur, &neighbor_info, synreq);
1101-
}
1102-
1103-
if (old_version) {
1104-
// No new information
1105-
return;
1106-
}
1107-
}
1108-
11091096
/*
1110-
* Learn new information from border router
1097+
* Learn new information from neighbor
11111098
*/
1112-
tr_info("Updated PAN configuration heard");
1099+
tr_info("Updated PAN configuration own:%d, heard:%d", cur->ws_info->pan_information.pan_version, pan_version);
11131100

1101+
// restart PAN version timer
11141102
cur->ws_info->pan_version_timeout_timer = PAN_VERSION_TIMEOUT;
11151103
cur->ws_info->pan_information.pan_version = pan_version;
11161104

@@ -1264,19 +1252,19 @@ static void ws_bootstrap_asynch_ind(struct protocol_interface_info_entry *cur, c
12641252
switch (message_type) {
12651253
case WS_FT_PAN_ADVERT:
12661254
// Analyse Advertisement
1267-
tr_debug("received ADVERT");
1255+
tr_info("received ADVERT Src:%s rssi:%d", trace_array(data->SrcAddr, 8), data->signal_dbm);
12681256
ws_bootstrap_pan_advertisement_analyse(cur, data, ie_ext, &ws_utt, &ws_us);
12691257
break;
12701258
case WS_FT_PAN_ADVERT_SOL:
1271-
tr_debug("received ADVERT SOL");
1259+
tr_info("received ADVERT SOL Src:%s rssi:%d", trace_array(data->SrcAddr, 8), data->signal_dbm);
12721260
ws_bootstrap_pan_advertisement_solicit_analyse(cur, data, &ws_utt, &ws_us);
12731261
break;
12741262
case WS_FT_PAN_CONF:
1275-
tr_debug("received CONFIG");
1263+
tr_info("received CONFIG Src:%s rssi:%d", trace_array(data->SrcAddr, 8), data->signal_dbm);
12761264
ws_bootstrap_pan_config_analyse(cur, data, ie_ext, &ws_utt, &ws_us);
12771265
break;
12781266
default:
1279-
tr_debug("received CONFIG SOL");
1267+
tr_info("received CONFIG SOL Src:%s rssi:%d", trace_array(data->SrcAddr, 8), data->signal_dbm);
12801268
ws_bootstrap_pan_config_solicit_analyse(cur, data, &ws_utt, &ws_us);
12811269
break;
12821270
}
@@ -1946,10 +1934,8 @@ static void ws_bootstrap_advertise_start(protocol_interface_info_entry_t *cur)
19461934
{
19471935
cur->ws_info->trickle_pa_running = true;
19481936
trickle_start(&cur->ws_info->trickle_pan_advertisement, &cur->ws_info->trickle_params_pan_discovery);
1949-
trickle_inconsistent_heard(&cur->ws_info->trickle_pan_advertisement, &cur->ws_info->trickle_params_pan_discovery);
19501937
cur->ws_info->trickle_pc_running = true;
19511938
trickle_start(&cur->ws_info->trickle_pan_config, &cur->ws_info->trickle_params_pan_discovery);
1952-
trickle_inconsistent_heard(&cur->ws_info->trickle_pan_config, &cur->ws_info->trickle_params_pan_discovery);
19531939
}
19541940

19551941
static void ws_bootstrap_pan_version_increment(protocol_interface_info_entry_t *cur)

0 commit comments

Comments
 (0)