Skip to content

Commit 7cecc28

Browse files
author
Juha Heiskanen
committed
Fixed missing asynch trigle setup stop at if down process
Added generic function for wi-sun asynch trickle timer stop.
1 parent 7a8b2bf commit 7cecc28

File tree

1 file changed

+16
-31
lines changed

1 file changed

+16
-31
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,15 @@ static int8_t ws_bootstrap_up(protocol_interface_info_entry_t *cur)
10451045
return ret_val;
10461046
}
10471047

1048+
static void ws_bootstrap_asynch_trickle_stop(protocol_interface_info_entry_t *cur)
1049+
{
1050+
cur->ws_info->trickle_pas_running = false;
1051+
cur->ws_info->trickle_pa_running = false;
1052+
cur->ws_info->trickle_pcs_running = false;
1053+
cur->ws_info->trickle_pc_running = false;
1054+
cur->ws_info->trickle_pc_consistency_block_period = 0;
1055+
}
1056+
10481057
static int8_t ws_bootstrap_down(protocol_interface_info_entry_t *cur)
10491058
{
10501059
if (!cur || !(cur->lowpan_info & INTERFACE_NWK_ACTIVE)) {
@@ -1058,7 +1067,7 @@ static int8_t ws_bootstrap_down(protocol_interface_info_entry_t *cur)
10581067
ns_fhss_delete(cur->ws_info->fhss_api);
10591068
cur->ws_info->fhss_api = NULL;
10601069
// Reset WS information
1061-
// ws_common_reset(cur)
1070+
ws_bootstrap_asynch_trickle_stop(cur);
10621071
ws_llc_reset(cur);
10631072
if (nd_proxy_downstream_interface_unregister(cur->id) != 0) {
10641073
tr_warn("nd proxy unregister failed");
@@ -1103,11 +1112,7 @@ void ws_bootstrap_configuration_reset(protocol_interface_info_entry_t *cur)
11031112

11041113
cur->nwk_bootstrap_state = ER_ACTIVE_SCAN;
11051114
cur->ws_info->network_pan_id = 0xffff;
1106-
cur->ws_info->trickle_pas_running = false;
1107-
cur->ws_info->trickle_pa_running = false;
1108-
cur->ws_info->trickle_pcs_running = false;
1109-
cur->ws_info->trickle_pc_running = false;
1110-
cur->ws_info->trickle_pc_consistency_block_period = 0;
1115+
ws_bootstrap_asynch_trickle_stop(cur);
11111116

11121117
//cur->mac_security_key_usage_update_cb = ws_management_mac_security_key_update_cb;
11131118
return;
@@ -3239,11 +3244,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
32393244
blacklist_clear();
32403245

32413246
// All trickle timers stopped to allow entry from any state
3242-
cur->ws_info->trickle_pa_running = false;
3243-
cur->ws_info->trickle_pc_running = false;
3244-
cur->ws_info->trickle_pas_running = false;
3245-
cur->ws_info->trickle_pcs_running = false;
3246-
cur->ws_info->trickle_pc_consistency_block_period = 0;
3247+
ws_bootstrap_asynch_trickle_stop(cur);
32473248

32483249
if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
32493250
tr_info("Border router start network");
@@ -3332,11 +3333,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
33323333
case WS_CONFIGURATION_START:
33333334
tr_info("Configuration start");
33343335
// Old configuration is considered invalid stopping all
3335-
cur->ws_info->trickle_pa_running = false;
3336-
cur->ws_info->trickle_pc_running = false;
3337-
cur->ws_info->trickle_pas_running = false;
3338-
cur->ws_info->trickle_pcs_running = false;
3339-
cur->ws_info->trickle_pc_consistency_block_period = 0;
3336+
ws_bootstrap_asynch_trickle_stop(cur);
33403337

33413338
// Build list of possible neighbours and learn first broadcast schedule
33423339

@@ -3345,11 +3342,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
33453342
case WS_OPERATION_START:
33463343
tr_info("operation start");
33473344
// Advertisements stopped during the RPL scan
3348-
cur->ws_info->trickle_pa_running = false;
3349-
cur->ws_info->trickle_pc_running = false;
3350-
cur->ws_info->trickle_pas_running = false;
3351-
cur->ws_info->trickle_pcs_running = false;
3352-
cur->ws_info->trickle_pc_consistency_block_period = 0;
3345+
ws_bootstrap_asynch_trickle_stop(cur);
33533346
// Activate RPL
33543347
// Activate IPv6 stack
33553348
ws_bootstrap_ip_stack_activate(cur);
@@ -3365,11 +3358,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
33653358
case WS_ROUTING_READY:
33663359
tr_info("Routing ready");
33673360
// stopped all to make sure we can enter here from any state
3368-
cur->ws_info->trickle_pa_running = false;
3369-
cur->ws_info->trickle_pc_running = false;
3370-
cur->ws_info->trickle_pas_running = false;
3371-
cur->ws_info->trickle_pcs_running = false;
3372-
cur->ws_info->trickle_pc_consistency_block_period = 0;
3361+
ws_bootstrap_asynch_trickle_stop(cur);
33733362

33743363
// Indicate PAE controller that bootstrap is ready
33753364
ws_pae_controller_bootstrap_done(cur);
@@ -3550,11 +3539,7 @@ void ws_bootstrap_state_machine(protocol_interface_info_entry_t *cur)
35503539
case ER_PANA_AUTH:
35513540
tr_info("authentication start");
35523541
// Advertisements stopped during the EAPOL
3553-
cur->ws_info->trickle_pa_running = false;
3554-
cur->ws_info->trickle_pc_running = false;
3555-
cur->ws_info->trickle_pas_running = false;
3556-
cur->ws_info->trickle_pcs_running = false;
3557-
cur->ws_info->trickle_pc_consistency_block_period = 0;
3542+
ws_bootstrap_asynch_trickle_stop(cur);
35583543
ws_fhss_configure(cur, false);
35593544
int8_t new_default = cur->ws_info->weakest_received_rssi - 1;
35603545
if ((new_default < CCA_DEFAULT_DBM) && (new_default >= CCA_LOW_LIMIT) && (new_default <= CCA_HIGH_LIMIT)) {

0 commit comments

Comments
 (0)