@@ -92,6 +92,12 @@ static void ws_bootstrap_pan_version_increment(protocol_interface_info_entry_t *
9292static ws_nud_table_entry_t * ws_nud_entry_discover (protocol_interface_info_entry_t * cur , void * neighbor );
9393static void ws_nud_entry_remove (protocol_interface_info_entry_t * cur , mac_neighbor_table_entry_t * entry_ptr );
9494
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+
95101mac_neighbor_table_entry_t * ws_bootstrap_mac_neighbor_add (struct protocol_interface_info_entry * interface , const uint8_t * src64 )
96102
97103{
@@ -470,8 +476,6 @@ static int8_t ws_fhss_discovery_configure(protocol_interface_info_entry_t *cur)
470476 fhss_configuration .fhss_broadcast_interval = 0 ;
471477 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 );
472478 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);
475479 fhss_configuration .unicast_fixed_channel = tmp_uc_fixed_channel ;
476480 fhss_configuration .broadcast_fixed_channel = tmp_bc_fixed_channel ;
477481 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)
503507/* Sets the parent and broadcast schedule we are following
504508 *
505509 */
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 )
507511{
508512
509513 fhss_ws_configuration_t fhss_configuration ;
@@ -516,7 +520,9 @@ static void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry
516520
517521 // Learning broadcast network configuration
518522 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+ }
520526 fhss_configuration .ws_bc_channel_function = (fhss_ws_channel_functions )neighbor_info -> ws_neighbor -> fhss_data .bc_timing_info .broadcast_channel_function ;
521527 if (fhss_configuration .ws_bc_channel_function == WS_FIXED_CHANNEL ) {
522528 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
532538 ns_fhss_ws_configuration_set (cur -> ws_info -> fhss_api , & fhss_configuration );
533539
534540 // 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 );
536542
537543 // Update LLC to follow updated fhss settings
538544 ws_bootstrap_llc_hopping_update (cur , & fhss_configuration );
539545}
540546
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+
541563static void ws_bootstrap_ll_address_validate (struct protocol_interface_info_entry * cur )
542564{
543565 // Configure EUI64 for MAC if missing
@@ -1042,7 +1064,13 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
10421064 if (neighbor_info .neighbor -> link_role == PRIORITY_PARENT_NEIGHBOUR ) {
10431065 // RPL priority parent configuration we must update FHSS data
10441066 //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 );
10461074 }
10471075
10481076 if (old_version ) {
@@ -1070,7 +1098,7 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
10701098 // return to state machine after 1-2 s
10711099 cur -> bootsrap_state_machine_cnt = randLIB_get_random_in_range (10 , 20 );
10721100 // 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 );
10741102 // set neighbor as priority parent clear if there is others
10751103 protocol_6lowpan_neighbor_priority_clear_all (cur -> id , PRIORITY_1ST );
10761104 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
25432571 llc_neighbour_req_t neighbor_info ;
25442572 neighbor_info .neighbor = neighbor ;
25452573 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 );
25472575
25482576 ws_secondary_parent_update (interface );
25492577 }
0 commit comments