Bluetooth: controller: Fix initialization of rl_idx and rpa_gen

The privacy state variables rl_idx and rpa_gen was not initialized
properly, which results in connection failing to be established.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2019-05-15 16:10:43 +02:00 committed by Anas Nashif
commit 65b3f17aa9
2 changed files with 18 additions and 13 deletions

View file

@ -235,6 +235,8 @@ u8_t ll_create_connection(u16_t scan_interval, u16_t scan_window,
#if defined(CONFIG_BT_CTLR_PRIVACY)
ull_filter_scan_update(filter_policy);
lll->rl_idx = FILTER_IDX_NONE;
lll->rpa_gen = 0;
if (!filter_policy && ull_filter_lll_rl_enabled()) {
/* Look up the resolving list */
lll->rl_idx = ull_filter_rl_find(peer_addr_type, peer_addr,

View file

@ -79,6 +79,22 @@ u8_t ll_scan_enable(u8_t enable)
return BT_HCI_ERR_CMD_DISALLOWED;
}
#if defined(CONFIG_BT_CTLR_PRIVACY)
struct lll_scan *lll = &scan->lll;
ull_filter_scan_update(lll->filter_policy);
lll->rl_idx = FILTER_IDX_NONE;
lll->rpa_gen = 0;
if ((lll->type & 0x1) &&
(scan->own_addr_type == BT_ADDR_LE_PUBLIC_ID ||
scan->own_addr_type == BT_ADDR_LE_RANDOM_ID)) {
/* Generate RPAs if required */
ull_filter_rpa_update(false);
lll->rpa_gen = 1;
}
#endif
return ull_scan_enable(scan);
}
@ -147,19 +163,6 @@ u8_t ull_scan_enable(struct ll_scan_set *scan)
u32_t ticks_anchor;
u32_t ret;
#if defined(CONFIG_BT_CTLR_PRIVACY)
ull_filter_scan_update(lll->filter_policy);
if ((lll->type & 0x1) &&
(scan->own_addr_type == BT_ADDR_LE_PUBLIC_ID ||
scan->own_addr_type == BT_ADDR_LE_RANDOM_ID)) {
/* Generate RPAs if required */
ull_filter_rpa_update(false);
lll->rpa_gen = 1;
lll->rl_idx = FILTER_IDX_NONE;
}
#endif
lll->chan = 0;
lll->init_addr_type = scan->own_addr_type;
ll_addr_get(lll->init_addr_type, lll->init_addr);