Skip to content
Permalink
Browse files

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>
  • Loading branch information...
joerchan authored and nashif committed May 15, 2019
1 parent b928cef commit 65b3f17aa9d3a6afccd205d88ae90e741928dce0
Showing with 18 additions and 13 deletions.
  1. +2 −0 subsys/bluetooth/controller/ll_sw/ull_master.c
  2. +16 −13 subsys/bluetooth/controller/ll_sw/ull_scan.c
@@ -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,
@@ -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);

0 comments on commit 65b3f17

Please sign in to comment.
You can’t perform that action at this time.