Skip to content

Commit 03f7105

Browse files
author
Mika Tervonen
committed
fixed EAPOL parent selection
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
1 parent c0456a3 commit 03f7105

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

source/6LoWPAN/ws/ws_bbr_api.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ static void ws_bbr_rpl_root_activate(uint8_t *dodag_prefix, uint8_t *dodag_id)
6565
if (!protocol_6lowpan_rpl_root_dodag) {
6666
tr_err("RPL dodag init failed");
6767
}
68+
69+
// RPL memory limits set larger for Border router
70+
rpl_control_set_memory_limits(64*1024, 0);
71+
6872
uint8_t t_flags = PIO_A;
6973

7074
rpl_control_update_dodag_prefix(protocol_6lowpan_rpl_root_dodag, dodag_prefix, 64, t_flags, 0xffffffff, 0xffffffff, false);

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,18 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
389389

390390
if(ws_bootstrap_state_discovery(cur)) {
391391
// Discovery state processing
392+
tr_info("potential parent addr:%s panid:%x signal:%d", trace_array(data->SrcAddr, 8),data->SrcPANId, data->signal_dbm);
393+
392394
// This parent is selected and used for authentication.
393395
if (memcmp(cur->ws_info->parent_info.addr, ADDR_UNSPECIFIED,8) != 0) {
394396

395-
// Drop if signal quality is not good enough If we hear only one advertise any quality is now ok
397+
// if we dont have higher than threshold signal only signal level decides parent
398+
if(ws_neighbor_class_rssi_from_dbm_calculate(cur->ws_info->parent_info.signal_dbm) < (CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERISIS) &&
399+
ws_neighbor_class_rssi_from_dbm_calculate(data->signal_dbm) > ws_neighbor_class_rssi_from_dbm_calculate(cur->ws_info->parent_info.signal_dbm)) {
400+
// automatically select the best quality link from the below threshold
401+
goto parent_selected;
402+
}
403+
// Drop if signal quality is not good enough
396404
if(ws_neighbor_class_rssi_from_dbm_calculate(data->signal_dbm) < (CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERISIS)) {
397405
tr_info("EAPOL target dropped Link quality too low");
398406
return;
@@ -412,6 +420,7 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
412420
tr_info("EAPOL target dropped Lower link quality");
413421
return;
414422
}
423+
415424
} else {
416425
// First advertise heard
417426

@@ -420,6 +429,8 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
420429
cur->bootsrap_state_machine_cnt += trickle_params_pan_configuration.Imin*10 + randLIB_get_8bit() % 50;
421430
}
422431
}
432+
433+
parent_selected:
423434
// Parent valid store information
424435
cur->ws_info->parent_info.ws_utt = *ws_utt;
425436
// Saved from unicast IE
@@ -435,7 +446,7 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
435446
cur->ws_info->parent_info.signal_dbm = data->signal_dbm;
436447
memcpy(cur->ws_info->parent_info.addr, data->SrcAddr,8);
437448

438-
tr_info("New possible parent found addr:%s", trace_array(cur->ws_info->parent_info.addr, 8));
449+
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);
439450
return;
440451
}
441452
// Active state processing

0 commit comments

Comments
 (0)