Skip to content

Commit

Permalink
fixed EAPOL parent selection
Browse files Browse the repository at this point in the history
Parent selection now searches the best from below hysteresis signals.
if there is good signal quality signal then those override

updated border router RPL memory configuration
  • Loading branch information
Mika Tervonen committed Apr 27, 2018
1 parent c0456a3 commit 03f7105
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions source/6LoWPAN/ws/ws_bbr_api.c
Expand Up @@ -65,6 +65,10 @@ static void ws_bbr_rpl_root_activate(uint8_t *dodag_prefix, uint8_t *dodag_id)
if (!protocol_6lowpan_rpl_root_dodag) {
tr_err("RPL dodag init failed");
}

// RPL memory limits set larger for Border router
rpl_control_set_memory_limits(64*1024, 0);

uint8_t t_flags = PIO_A;

rpl_control_update_dodag_prefix(protocol_6lowpan_rpl_root_dodag, dodag_prefix, 64, t_flags, 0xffffffff, 0xffffffff, false);
Expand Down
15 changes: 13 additions & 2 deletions source/6LoWPAN/ws/ws_bootstrap.c
Expand Up @@ -389,10 +389,18 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf

if(ws_bootstrap_state_discovery(cur)) {
// Discovery state processing
tr_info("potential parent addr:%s panid:%x signal:%d", trace_array(data->SrcAddr, 8),data->SrcPANId, data->signal_dbm);

// This parent is selected and used for authentication.
if (memcmp(cur->ws_info->parent_info.addr, ADDR_UNSPECIFIED,8) != 0) {

// Drop if signal quality is not good enough If we hear only one advertise any quality is now ok
// if we dont have higher than threshold signal only signal level decides parent
if(ws_neighbor_class_rssi_from_dbm_calculate(cur->ws_info->parent_info.signal_dbm) < (CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERISIS) &&
ws_neighbor_class_rssi_from_dbm_calculate(data->signal_dbm) > ws_neighbor_class_rssi_from_dbm_calculate(cur->ws_info->parent_info.signal_dbm)) {
// automatically select the best quality link from the below threshold
goto parent_selected;
}
// Drop if signal quality is not good enough
if(ws_neighbor_class_rssi_from_dbm_calculate(data->signal_dbm) < (CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERISIS)) {
tr_info("EAPOL target dropped Link quality too low");
return;
Expand All @@ -412,6 +420,7 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
tr_info("EAPOL target dropped Lower link quality");
return;
}

} else {
// First advertise heard

Expand All @@ -420,6 +429,8 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
cur->bootsrap_state_machine_cnt += trickle_params_pan_configuration.Imin*10 + randLIB_get_8bit() % 50;
}
}

parent_selected:
// Parent valid store information
cur->ws_info->parent_info.ws_utt = *ws_utt;
// Saved from unicast IE
Expand All @@ -435,7 +446,7 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
cur->ws_info->parent_info.signal_dbm = data->signal_dbm;
memcpy(cur->ws_info->parent_info.addr, data->SrcAddr,8);

tr_info("New possible parent found addr:%s", trace_array(cur->ws_info->parent_info.addr, 8));
tr_info("New parent addr:%s panid:%x signal:%d", trace_array(cur->ws_info->parent_info.addr, 8),cur->ws_info->parent_info.pan_id, cur->ws_info->parent_info.signal_dbm);
return;
}
// Active state processing
Expand Down

0 comments on commit 03f7105

Please sign in to comment.