@@ -128,6 +128,7 @@ static void ws_bootstrap_rpl_scan_start(protocol_interface_info_entry_t *cur);
128
128
static uint16_t ws_randomize_fixed_channel (uint16_t configured_fixed_channel , uint8_t number_of_channels , uint32_t * channel_mask );
129
129
130
130
static void ws_bootstrap_test_procedure_trigger_exec (protocol_interface_info_entry_t * cur , ws_bootsrap_procedure_t procedure );
131
+ static void ws_bootstrap_test_procedure_trigger_timer (protocol_interface_info_entry_t * cur , uint32_t seconds );
131
132
132
133
typedef enum {
133
134
WS_PARENT_SOFT_SYNCH = 0 , /**< let FHSS make decision if synchronization is needed*/
@@ -4181,6 +4182,7 @@ void ws_bootstrap_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t s
4181
4182
4182
4183
ws_llc_timer_seconds (cur , seconds );
4183
4184
4185
+ ws_bootstrap_test_procedure_trigger_timer (cur , seconds );
4184
4186
}
4185
4187
4186
4188
void ws_bootstrap_primary_parent_update (protocol_interface_info_entry_t * interface , mac_neighbor_table_entry_t * neighbor )
@@ -4389,8 +4391,23 @@ static void ws_bootstrap_packet_congestion_init(protocol_interface_info_entry_t
4389
4391
4390
4392
}
4391
4393
4394
+ static bool auto_test_proc_trg_enabled = false;
4395
+
4392
4396
int ws_bootstrap_test_procedure_trigger (protocol_interface_info_entry_t * cur , ws_bootsrap_procedure_t procedure )
4393
4397
{
4398
+ switch (procedure ) {
4399
+ case PROCEDURE_AUTO_ON :
4400
+ tr_info ("Trigger bootstrap test procedures automatically" );
4401
+ auto_test_proc_trg_enabled = true;
4402
+ return 0 ;
4403
+ case PROCEDURE_AUTO_OFF :
4404
+ tr_info ("Disable automatic bootstrap test procedure triggering" );
4405
+ auto_test_proc_trg_enabled = false;
4406
+ return 0 ;
4407
+ default :
4408
+ break ;
4409
+ }
4410
+
4394
4411
if (!cur ) {
4395
4412
return -1 ;
4396
4413
}
@@ -4450,8 +4467,12 @@ static void ws_bootstrap_test_procedure_trigger_exec(protocol_interface_info_ent
4450
4467
}
4451
4468
break ;
4452
4469
case PROCEDURE_PAS :
4470
+ case PROCEDURE_PAS_TRICKLE_INCON :
4453
4471
tr_info ("trigger PAN advertisement Solicit" );
4454
- ws_bootstrap_pan_advert_solicit (cur );
4472
+ if (procedure != PROCEDURE_PAS_TRICKLE_INCON ) {
4473
+ tr_info ("send PAN advertisement Solicit" );
4474
+ ws_bootstrap_pan_advert_solicit (cur );
4475
+ }
4455
4476
if (cur -> ws_info -> trickle_pas_running ) {
4456
4477
trickle_inconsistent_heard (& cur -> ws_info -> trickle_pan_advertisement_solicit , & cur -> ws_info -> trickle_params_pan_discovery );
4457
4478
}
@@ -4466,9 +4487,13 @@ static void ws_bootstrap_test_procedure_trigger_exec(protocol_interface_info_ent
4466
4487
}
4467
4488
break ;
4468
4489
case PROCEDURE_PCS :
4490
+ case PROCEDURE_PCS_TRICKLE_INCON :
4469
4491
if (cur -> ws_info -> trickle_pcs_running || ws_bootstrap_state_active (cur )) {
4470
4492
tr_info ("trigger PAN configuration Solicit" );
4471
- ws_bootstrap_pan_config_solicit (cur );
4493
+ if (procedure != PROCEDURE_PCS_TRICKLE_INCON ) {
4494
+ tr_info ("send PAN configuration Solicit" );
4495
+ ws_bootstrap_pan_config_solicit (cur );
4496
+ }
4472
4497
if (cur -> ws_info -> trickle_pcs_running ) {
4473
4498
trickle_inconsistent_heard (& cur -> ws_info -> trickle_pan_config_solicit , & cur -> ws_info -> trickle_params_pan_discovery );
4474
4499
}
@@ -4522,4 +4547,76 @@ static void ws_bootstrap_test_procedure_trigger_exec(protocol_interface_info_ent
4522
4547
}
4523
4548
}
4524
4549
4550
+ static void ws_bootstrap_test_procedure_trigger_timer (protocol_interface_info_entry_t * cur , uint32_t seconds )
4551
+ {
4552
+ if (!auto_test_proc_trg_enabled ) {
4553
+ cur -> ws_info -> test_proc_trg .auto_trg_enabled = false;
4554
+ return ;
4555
+ }
4556
+
4557
+ cur -> ws_info -> test_proc_trg .auto_trg_enabled = true;
4558
+
4559
+ if (cur -> nwk_bootstrap_state == ER_ACTIVE_SCAN ) {
4560
+ if (cur -> ws_info -> trickle_pas_running ) {
4561
+ if (cur -> ws_info -> test_proc_trg .pas_trigger_timer > seconds ) {
4562
+ cur -> ws_info -> test_proc_trg .pas_trigger_timer -= seconds ;
4563
+ } else {
4564
+ if (cur -> ws_info -> test_proc_trg .pas_trigger_count > 2 ) {
4565
+ ws_bootstrap_test_procedure_trigger_exec (cur , PROCEDURE_PAS_TRICKLE_INCON );
4566
+ } else {
4567
+ cur -> ws_info -> test_proc_trg .pas_trigger_count ++ ;
4568
+ ws_bootstrap_test_procedure_trigger_exec (cur , PROCEDURE_PAS );
4569
+ }
4570
+ cur -> ws_info -> test_proc_trg .pas_trigger_timer = (cur -> ws_info -> trickle_params_pan_discovery .Imin / 10 );
4571
+ }
4572
+ if (cur -> ws_info -> test_proc_trg .eapol_trigger_timer > seconds ) {
4573
+ cur -> ws_info -> test_proc_trg .eapol_trigger_timer -= seconds ;
4574
+ } else {
4575
+ ws_bootstrap_test_procedure_trigger_exec (cur , PROCEDURE_EAPOL );
4576
+ cur -> ws_info -> test_proc_trg .eapol_trigger_timer = (cur -> ws_info -> trickle_params_pan_discovery .Imin / 10 ) / 2 ;
4577
+ }
4578
+ }
4579
+ } else if (cur -> nwk_bootstrap_state == ER_SCAN ) {
4580
+ if (cur -> ws_info -> trickle_pcs_running ) {
4581
+ if (cur -> ws_info -> test_proc_trg .pcs_trigger_timer > seconds ) {
4582
+ cur -> ws_info -> test_proc_trg .pcs_trigger_timer -= seconds ;
4583
+ } else {
4584
+ if (cur -> ws_info -> test_proc_trg .pcs_trigger_count > 2 ) {
4585
+ ws_bootstrap_test_procedure_trigger_exec (cur , PROCEDURE_PCS_TRICKLE_INCON );
4586
+ } else {
4587
+ cur -> ws_info -> test_proc_trg .pcs_trigger_count ++ ;
4588
+ ws_bootstrap_test_procedure_trigger_exec (cur , PROCEDURE_PCS );
4589
+ }
4590
+ cur -> ws_info -> test_proc_trg .pcs_trigger_timer = (cur -> ws_info -> trickle_params_pan_discovery .Imin / 10 );
4591
+ }
4592
+ }
4593
+ } else if (cur -> nwk_bootstrap_state == ER_RPL_SCAN ) {
4594
+ if (cur -> ws_info -> test_proc_trg .dis_trigger_timer > seconds ) {
4595
+ cur -> ws_info -> test_proc_trg .dis_trigger_timer -= seconds ;
4596
+ } else {
4597
+ ws_bootstrap_test_procedure_trigger_exec (cur , PROCEDURE_DIS );
4598
+ cur -> ws_info -> test_proc_trg .dis_trigger_timer_val *= 2 ;
4599
+ if (cur -> ws_info -> test_proc_trg .dis_trigger_timer_val > (WS_RPL_DIS_INITIAL_TIMEOUT / 10 ) * 4 ) {
4600
+ cur -> ws_info -> test_proc_trg .dis_trigger_timer_val = (WS_RPL_DIS_INITIAL_TIMEOUT / 10 ) * 4 ;
4601
+ }
4602
+ cur -> ws_info -> test_proc_trg .dis_trigger_timer = cur -> ws_info -> test_proc_trg .dis_trigger_timer_val ;
4603
+ }
4604
+ if (cur -> ws_info -> test_proc_trg .rpl_trigger_timer > seconds ) {
4605
+ cur -> ws_info -> test_proc_trg .rpl_trigger_timer -= seconds ;
4606
+ } else {
4607
+ ws_bootstrap_test_procedure_trigger_exec (cur , PROCEDURE_RPL );
4608
+ cur -> ws_info -> test_proc_trg .rpl_trigger_timer_val *= 2 ;
4609
+ if (cur -> ws_info -> test_proc_trg .rpl_trigger_timer_val > (WS_RPL_DIS_INITIAL_TIMEOUT / 10 ) * 2 ) {
4610
+ cur -> ws_info -> test_proc_trg .rpl_trigger_timer_val = (WS_RPL_DIS_INITIAL_TIMEOUT / 10 ) * 2 ;
4611
+ }
4612
+ cur -> ws_info -> test_proc_trg .rpl_trigger_timer = cur -> ws_info -> test_proc_trg .rpl_trigger_timer_val ;
4613
+ }
4614
+ } else {
4615
+ cur -> ws_info -> test_proc_trg .dis_trigger_timer_val = (WS_RPL_DIS_INITIAL_TIMEOUT / 10 ) / 2 ;
4616
+ cur -> ws_info -> test_proc_trg .rpl_trigger_timer_val = (WS_RPL_DIS_INITIAL_TIMEOUT / 10 ) / 2 ;
4617
+ cur -> ws_info -> test_proc_trg .pas_trigger_count = 0 ;
4618
+ cur -> ws_info -> test_proc_trg .pcs_trigger_count = 0 ;
4619
+ }
4620
+ }
4621
+
4525
4622
#endif //HAVE_WS
0 commit comments