Bluetooth: controller: Fix RL permission check

When the initiator is using an RPA and we match it using the filtering,
we should return early and allow the device packet through instead of
going through the whole resolving list.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
Carles Cufi 2017-07-12 14:10:18 +02:00
commit 486dad9e4c

View file

@ -239,7 +239,6 @@ bool ctrl_irk_whitelisted(u8_t rl_idx)
return false; return false;
} }
LL_ASSERT(rl_idx < CONFIG_BLUETOOTH_CONTROLLER_RL_SIZE);
LL_ASSERT(rl[rl_idx].taken); LL_ASSERT(rl[rl_idx].taken);
return rl[rl_idx].wl; return rl[rl_idx].wl;
@ -401,7 +400,8 @@ bool ctrl_rl_allowed(u8_t id_addr_type, u8_t *id_addr, u8_t *rl_idx)
{ {
int i, j; int i, j;
if (!rl_enable) { /* If AR is disabled or we matched an IRK then we're all set */
if (!rl_enable || *rl_idx != FILTER_IDX_NONE) {
return true; return true;
} }
@ -415,11 +415,7 @@ bool ctrl_rl_allowed(u8_t id_addr_type, u8_t *id_addr, u8_t *rl_idx)
} }
if (j == BDADDR_SIZE) { if (j == BDADDR_SIZE) {
if (*rl_idx == FILTER_IDX_NONE) { *rl_idx = i;
*rl_idx = i;
} else {
LL_ASSERT(*rl_idx == i);
}
return !rl[i].pirk || rl[i].dev; return !rl[i].pirk || rl[i].dev;
} }
} }