@@ -92,6 +92,7 @@ static mac_neighbor_table_entry_t * ws_bootstrap_mac_neighbor_add(struct protoco
92
92
if (!neighbor ) {
93
93
return NULL ;
94
94
}
95
+ // TODO only call these for new neighbour
95
96
mlme_device_descriptor_t device_desc ;
96
97
tr_debug ("Added new neighbor %s : index:%u" , trace_array (src64 , 8 ), neighbor -> index );
97
98
mac_helper_device_description_write (interface , & device_desc , neighbor -> mac64 , neighbor -> mac16 ,0 , false);
@@ -362,16 +363,16 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
362
363
tr_warn ("Not supported routing" );
363
364
return ;
364
365
}
365
- //TODO smarter Neighbor allocate system
366
366
367
- ws_neighbor_class_entry_t * neighbor = ws_bootstrap_neighbor_add (cur , data -> SrcAddr );
368
- if (!neighbor ) {
369
- return ;
370
- }
371
-
372
- etx_lqi_dbm_update (cur -> id , data -> mpduLinkQuality , data -> signal_dbm , ws_neighbor_class_entry_index_get (& cur -> ws_info -> neighbor_storage ,neighbor ));
373
- ws_neighbor_class_neighbor_unicast_time_info_update (neighbor , ws_utt , data -> timestamp );
374
- ws_neighbor_class_neighbor_unicast_schedule_set (neighbor , ws_us );
367
+ /* TODO smart neighbour process
368
+ *
369
+ * Unsecure packet we cant trust the device?
370
+ *
371
+ * This message is received from tens of devices and we must select the best parent
372
+ *
373
+ * We save the best parent and create entry when we have selected the EAPOL target
374
+ *
375
+ */
375
376
376
377
// Save the best network parent
377
378
@@ -385,9 +386,9 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
385
386
}
386
387
}
387
388
// Parent valid store information
388
- cur -> ws_info -> parent_info .ufsi = ws_utt -> ufsi ;
389
+ cur -> ws_info -> parent_info .ws_utt = * ws_utt ;
389
390
// Saved from unicast IE
390
- cur -> ws_info -> parent_info .dwell_interval = ws_us -> dwell_interval ;
391
+ cur -> ws_info -> parent_info .ws_us = * ws_us ;
391
392
392
393
// Saved from Pan information
393
394
cur -> ws_info -> parent_info .pan_configuration = pan_information ;
@@ -408,19 +409,15 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
408
409
ws_bootstrap_pan_advertisement_analyse_active (cur , & pan_information );
409
410
}
410
411
// Parent valid store information
411
- cur -> ws_info -> parent_info .ufsi = ws_utt -> ufsi ;
412
+ cur -> ws_info -> parent_info .ws_utt = * ws_utt ;
412
413
}
414
+
413
415
static void ws_bootstrap_pan_advertisement_solicit_analyse (struct protocol_interface_info_entry * cur , const struct mcps_data_ind_s * data , ws_utt_ie_t * ws_utt , ws_us_ie_t * ws_us )
414
416
{
415
417
416
- ws_neighbor_class_entry_t * neighbor = ws_bootstrap_neighbor_add (cur , data -> SrcAddr );
417
- if (!neighbor ) {
418
- return ;
419
- }
420
-
421
- ws_neighbor_class_neighbor_unicast_time_info_update (neighbor , ws_utt , data -> timestamp );
422
- ws_neighbor_class_neighbor_unicast_schedule_set (neighbor , ws_us );
423
-
418
+ (void )data ;
419
+ (void )ws_utt ;
420
+ (void )ws_us ;
424
421
/*
425
422
* An inconsistent transmission is defined as:
426
423
* A PAN Advertisement Solicit with NETNAME-IE matching that of the receiving node.
@@ -497,7 +494,6 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
497
494
ws_neighbor_class_neighbor_broadcast_time_info_update (neighbor , & ws_bt_ie , data -> timestamp );
498
495
ws_neighbor_class_neighbor_broadcast_schedule_set (neighbor , & ws_bs_ie );
499
496
500
-
501
497
if (cur -> ws_info -> configuration_learned &&
502
498
common_serial_number_greater_16 (cur -> ws_info -> pan_configuration .pan_version , pan_version )) {
503
499
// received version is lower se we need to reset the trickle
@@ -551,6 +547,15 @@ static void ws_bootstrap_pan_config_solicit_analyse(struct protocol_interface_in
551
547
return ;
552
548
}
553
549
550
+ /* TODO smart neighbour process
551
+ *
552
+ * Unsecure packet we cant trust the device?
553
+ *
554
+ * Question mark in specification also present, now we create neighbour.
555
+ * this is moved in future to NS/ND processing triggered by RPL
556
+ *
557
+ */
558
+
554
559
ws_neighbor_class_entry_t * neighbor = ws_bootstrap_neighbor_add (cur , data -> SrcAddr );
555
560
if (!neighbor ) {
556
561
return ;
@@ -831,7 +836,7 @@ static void ws_bootstrap_network_information_learn(protocol_interface_info_entry
831
836
tr_debug ("learn network information from parent" );
832
837
833
838
// Start following network timing schedules
834
- cur -> ws_info -> hopping_schdule .fhss_uc_dwell_interval = cur -> ws_info -> parent_info .dwell_interval ;
839
+ cur -> ws_info -> hopping_schdule .fhss_uc_dwell_interval = cur -> ws_info -> parent_info .ws_us . dwell_interval ;
835
840
// Regulatory domain saving? cant change?
836
841
837
842
// Save network information
@@ -989,9 +994,6 @@ static void ws_bootstrap_start_configuration_learn(protocol_interface_info_entry
989
994
// Clear all temporary information
990
995
ws_bootstrap_ip_stack_reset (cur );
991
996
992
- // Clear learned neighbours
993
- ws_bootstrap_neighbor_list_clean (cur );
994
-
995
997
// Reset advertisement solicit trickle to start discovering network
996
998
trickle_start (& cur -> ws_info -> trickle_pan_config_solicit , & trickle_params_pan_configuration );
997
999
trickle_inconsistent_heard (& cur -> ws_info -> trickle_pan_config_solicit , & trickle_params_pan_configuration );
@@ -1207,13 +1209,23 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
1207
1209
void ws_bootstrap_network_scan_process (protocol_interface_info_entry_t * cur )
1208
1210
{
1209
1211
1210
- if (ws_bootstrap_network_found (cur )) {
1211
- tr_info ("select network" );
1212
- ws_bootstrap_network_information_learn (cur );
1213
- ws_bootstrap_fhss_activate (cur );
1214
- ws_bootstrap_event_authentication_start (cur );
1212
+ if (!ws_bootstrap_network_found (cur )) {
1215
1213
return ;
1216
1214
}
1215
+ tr_info ("select network" );
1216
+
1217
+ // Add EAPOL neighbour
1218
+ ws_neighbor_class_entry_t * neighbor = ws_bootstrap_neighbor_add (cur , cur -> ws_info -> parent_info .addr );
1219
+ if (!neighbor ) {
1220
+ return ;
1221
+ }
1222
+
1223
+ ws_neighbor_class_neighbor_unicast_time_info_update (neighbor , & cur -> ws_info -> parent_info .ws_utt , cur -> ws_info -> parent_info .timestamp );
1224
+ ws_neighbor_class_neighbor_unicast_schedule_set (neighbor , & cur -> ws_info -> parent_info .ws_us );
1225
+
1226
+ ws_bootstrap_network_information_learn (cur );
1227
+ ws_bootstrap_fhss_activate (cur );
1228
+ ws_bootstrap_event_authentication_start (cur );
1217
1229
return ;
1218
1230
}
1219
1231
0 commit comments