Skip to content

Commit fbe7795

Browse files
author
Mika Tervonen
committed
Modified neighbour processing
Create only sinle parent selected for EAPOL target dont delete learned neighbours during configuration
1 parent 9fff108 commit fbe7795

File tree

2 files changed

+44
-32
lines changed

2 files changed

+44
-32
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ static mac_neighbor_table_entry_t * ws_bootstrap_mac_neighbor_add(struct protoco
9292
if (!neighbor) {
9393
return NULL;
9494
}
95+
// TODO only call these for new neighbour
9596
mlme_device_descriptor_t device_desc;
9697
tr_debug("Added new neighbor %s : index:%u", trace_array(src64, 8), neighbor->index);
9798
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
362363
tr_warn("Not supported routing");
363364
return;
364365
}
365-
//TODO smarter Neighbor allocate system
366366

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+
*/
375376

376377
// Save the best network parent
377378

@@ -385,9 +386,9 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
385386
}
386387
}
387388
// Parent valid store information
388-
cur->ws_info->parent_info.ufsi = ws_utt->ufsi;
389+
cur->ws_info->parent_info.ws_utt = *ws_utt;
389390
// 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;
391392

392393
// Saved from Pan information
393394
cur->ws_info->parent_info.pan_configuration = pan_information;
@@ -408,19 +409,15 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
408409
ws_bootstrap_pan_advertisement_analyse_active(cur, &pan_information);
409410
}
410411
// Parent valid store information
411-
cur->ws_info->parent_info.ufsi = ws_utt->ufsi;
412+
cur->ws_info->parent_info.ws_utt = *ws_utt;
412413
}
414+
413415
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)
414416
{
415417

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;
424421
/*
425422
* An inconsistent transmission is defined as:
426423
* 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
497494
ws_neighbor_class_neighbor_broadcast_time_info_update(neighbor, &ws_bt_ie, data->timestamp);
498495
ws_neighbor_class_neighbor_broadcast_schedule_set(neighbor, &ws_bs_ie);
499496

500-
501497
if (cur->ws_info->configuration_learned &&
502498
common_serial_number_greater_16(cur->ws_info->pan_configuration.pan_version, pan_version)) {
503499
// 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
551547
return;
552548
}
553549

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+
554559
ws_neighbor_class_entry_t *neighbor = ws_bootstrap_neighbor_add(cur, data->SrcAddr);
555560
if (!neighbor) {
556561
return;
@@ -831,7 +836,7 @@ static void ws_bootstrap_network_information_learn(protocol_interface_info_entry
831836
tr_debug("learn network information from parent");
832837

833838
// 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;
835840
// Regulatory domain saving? cant change?
836841

837842
// Save network information
@@ -989,9 +994,6 @@ static void ws_bootstrap_start_configuration_learn(protocol_interface_info_entry
989994
// Clear all temporary information
990995
ws_bootstrap_ip_stack_reset(cur);
991996

992-
// Clear learned neighbours
993-
ws_bootstrap_neighbor_list_clean(cur);
994-
995997
// Reset advertisement solicit trickle to start discovering network
996998
trickle_start(&cur->ws_info->trickle_pan_config_solicit, &trickle_params_pan_configuration);
997999
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)
12071209
void ws_bootstrap_network_scan_process(protocol_interface_info_entry_t *cur)
12081210
{
12091211

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)) {
12151213
return;
12161214
}
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);
12171229
return;
12181230
}
12191231

source/6LoWPAN/ws/ws_common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ typedef struct parent_info_s {
3434
uint8_t link_quality; /**< LQI value measured during reception of the MPDU */
3535
int8_t signal_dbm; /**< This extension for normal IEEE 802.15.4 Data indication */
3636
ws_pan_information_t pan_configuration;
37-
uint8_t dwell_interval; /**< unicast dwell time */
38-
uint_fast24_t ufsi; /**< unicast_fractional_sequence_interval */
37+
ws_utt_ie_t ws_utt;
38+
ws_us_ie_t ws_us;
3939
uint32_t timestamp; /**< Timestamp when packet was received */
4040
}parent_info_t;
4141

0 commit comments

Comments
 (0)