@@ -92,6 +92,12 @@ static void ws_bootstrap_pan_version_increment(protocol_interface_info_entry_t *
92
92
static ws_nud_table_entry_t * ws_nud_entry_discover (protocol_interface_info_entry_t * cur , void * neighbor );
93
93
static void ws_nud_entry_remove (protocol_interface_info_entry_t * cur , mac_neighbor_table_entry_t * entry_ptr );
94
94
95
+ typedef enum {
96
+ WS_PARENT_SOFT_SYNCH = 0 , /**< let FHSS make decision if synchronization is needed*/
97
+ WS_PARENT_HARD_SYNCH , /**< Synch FHSS with latest synch information*/
98
+ WS_EAPOL_PARENT_SYNCH , /**< Broadcast synch with EAPOL parent*/
99
+ } ws_parent_synch_e ;
100
+
95
101
mac_neighbor_table_entry_t * ws_bootstrap_mac_neighbor_add (struct protocol_interface_info_entry * interface , const uint8_t * src64 )
96
102
97
103
{
@@ -470,8 +476,6 @@ static int8_t ws_fhss_discovery_configure(protocol_interface_info_entry_t *cur)
470
476
fhss_configuration .fhss_broadcast_interval = 0 ;
471
477
uint8_t tmp_uc_fixed_channel = ws_randomize_fixed_channel (cur -> ws_info -> fhss_uc_fixed_channel , cur -> ws_info -> hopping_schdule .number_of_channels );
472
478
uint8_t tmp_bc_fixed_channel = ws_randomize_fixed_channel (cur -> ws_info -> fhss_bc_fixed_channel , cur -> ws_info -> hopping_schdule .number_of_channels );
473
- memset (fhss_configuration .channel_mask , 0 , sizeof (uint32_t ) * 8 );
474
- channel_list_set_channel (fhss_configuration .channel_mask , tmp_uc_fixed_channel , true);
475
479
fhss_configuration .unicast_fixed_channel = tmp_uc_fixed_channel ;
476
480
fhss_configuration .broadcast_fixed_channel = tmp_bc_fixed_channel ;
477
481
ns_fhss_ws_configuration_set (cur -> ws_info -> fhss_api , & fhss_configuration );
@@ -503,7 +507,7 @@ static int8_t ws_fhss_enable(protocol_interface_info_entry_t *cur)
503
507
/* Sets the parent and broadcast schedule we are following
504
508
*
505
509
*/
506
- static void ws_bootstrap_primary_parent_set (struct protocol_interface_info_entry * cur , llc_neighbour_req_t * neighbor_info , bool force_synch )
510
+ static void ws_bootstrap_primary_parent_set (struct protocol_interface_info_entry * cur , llc_neighbour_req_t * neighbor_info , ws_parent_synch_e synch_req )
507
511
{
508
512
509
513
fhss_ws_configuration_t fhss_configuration ;
@@ -516,7 +520,9 @@ static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry
516
520
517
521
// Learning broadcast network configuration
518
522
if (neighbor_info -> ws_neighbor -> broadcast_shedule_info_stored ) {
519
- ws_fhss_set_defaults (cur , & fhss_configuration );
523
+ if (synch_req == WS_EAPOL_PARENT_SYNCH ) {
524
+ ws_fhss_set_defaults (cur , & fhss_configuration );
525
+ }
520
526
fhss_configuration .ws_bc_channel_function = (fhss_ws_channel_functions )neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info .broadcast_channel_function ;
521
527
if (fhss_configuration .ws_bc_channel_function == WS_FIXED_CHANNEL ) {
522
528
cur -> ws_info -> hopping_schdule .bc_fixed_channel = neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info .fixed_channel ;
@@ -532,12 +538,28 @@ static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry
532
538
ns_fhss_ws_configuration_set (cur -> ws_info -> fhss_api , & fhss_configuration );
533
539
534
540
// We have broadcast schedule set up set the broadcast parent schedule
535
- 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 );
541
+ ns_fhss_ws_set_parent (cur -> ws_info -> fhss_api , neighbor_info -> neighbor -> mac64 , & neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info , synch_req != WS_PARENT_SOFT_SYNCH );
536
542
537
543
// Update LLC to follow updated fhss settings
538
544
ws_bootstrap_llc_hopping_update (cur , & fhss_configuration );
539
545
}
540
546
547
+ void ws_bootstrap_eapol_parent_synch (struct protocol_interface_info_entry * cur , llc_neighbour_req_t * neighbor_info , ws_bs_ie_t * ws_bs_ie )
548
+ {
549
+ if (neighbor_info -> ws_neighbor -> broadcast_shedule_info_stored || cur -> ws_info -> configuration_learned ) {
550
+ return ;
551
+ }
552
+
553
+ if (memcmp (neighbor_info -> neighbor -> mac64 , cur -> ws_info -> parent_info .addr , 8 )) {
554
+ return ;
555
+ }
556
+
557
+ //Store Brodacst Shedule
558
+ ws_neighbor_class_neighbor_broadcast_schedule_set (neighbor_info -> ws_neighbor , ws_bs_ie );
559
+
560
+ ws_bootstrap_primary_parent_set (cur , neighbor_info , WS_EAPOL_PARENT_SYNCH );
561
+ }
562
+
541
563
static void ws_bootstrap_ll_address_validate (struct protocol_interface_info_entry * cur )
542
564
{
543
565
// Configure EUI64 for MAC if missing
@@ -1042,7 +1064,13 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
1042
1064
if (neighbor_info .neighbor -> link_role == PRIORITY_PARENT_NEIGHBOUR ) {
1043
1065
// RPL priority parent configuration we must update FHSS data
1044
1066
//Update synch to primary parent allways to update broadcast shedule and timing
1045
- ws_bootstrap_primary_parent_set (cur , & neighbor_info , !old_version );
1067
+ ws_parent_synch_e synreq ;
1068
+ if (old_version ) {
1069
+ synreq = WS_PARENT_SOFT_SYNCH ;
1070
+ } else {
1071
+ synreq = WS_PARENT_HARD_SYNCH ;
1072
+ }
1073
+ ws_bootstrap_primary_parent_set (cur , & neighbor_info , synreq );
1046
1074
}
1047
1075
1048
1076
if (old_version ) {
@@ -1070,7 +1098,7 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
1070
1098
// return to state machine after 1-2 s
1071
1099
cur -> bootsrap_state_machine_cnt = randLIB_get_random_in_range (10 , 20 );
1072
1100
// enable frequency hopping for unicast channel and start listening first neighbour
1073
- ws_bootstrap_primary_parent_set (cur , & neighbor_info , true );
1101
+ ws_bootstrap_primary_parent_set (cur , & neighbor_info , WS_PARENT_HARD_SYNCH );
1074
1102
// set neighbor as priority parent clear if there is others
1075
1103
protocol_6lowpan_neighbor_priority_clear_all (cur -> id , PRIORITY_1ST );
1076
1104
neighbor_info .neighbor -> link_role = PRIORITY_PARENT_NEIGHBOUR ;
@@ -2543,7 +2571,7 @@ void ws_primary_parent_update(protocol_interface_info_entry_t *interface, mac_ne
2543
2571
llc_neighbour_req_t neighbor_info ;
2544
2572
neighbor_info .neighbor = neighbor ;
2545
2573
neighbor_info .ws_neighbor = ws_neighbor_class_entry_get (& interface -> ws_info -> neighbor_storage , neighbor -> index );
2546
- ws_bootstrap_primary_parent_set (interface , & neighbor_info , true );
2574
+ ws_bootstrap_primary_parent_set (interface , & neighbor_info , WS_PARENT_HARD_SYNCH );
2547
2575
2548
2576
ws_secondary_parent_update (interface );
2549
2577
}
0 commit comments