Bluetooth: host: Refresh advertiser NRPA when active scan is using NRPA
When starting a non-connectable advertiser and an active scanner is also using NRPA address then this use-case should be supported. A new advertiser that is non-connectable should have a fresh NRPA address every time it is started, so we must refresh the NRPA used by the active scanner. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
d977282514
commit
a570be6e93
1 changed files with 18 additions and 0 deletions
|
@ -6053,8 +6053,26 @@ int bt_le_adv_start_internal(const struct bt_le_adv_param *param,
|
||||||
|
|
||||||
set_param.own_addr_type = id_addr->type;
|
set_param.own_addr_type = id_addr->type;
|
||||||
} else {
|
} else {
|
||||||
|
#if defined(CONFIG_BT_OBSERVER)
|
||||||
|
bool scan_enabled = false;
|
||||||
|
|
||||||
|
/* If active scan with NRPA is ongoing refresh NRPA */
|
||||||
|
if (!IS_ENABLED(CONFIG_BT_PRIVACY) &&
|
||||||
|
!IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) &&
|
||||||
|
atomic_test_bit(bt_dev.flags, BT_DEV_SCANNING) &&
|
||||||
|
atomic_test_bit(bt_dev.flags, BT_DEV_ACTIVE_SCAN)) {
|
||||||
|
scan_enabled = true;
|
||||||
|
set_le_scan_enable(false);
|
||||||
|
}
|
||||||
|
#endif /* defined(CONFIG_BT_OBSERVER) */
|
||||||
err = le_set_private_addr(param->id);
|
err = le_set_private_addr(param->id);
|
||||||
set_param.own_addr_type = BT_ADDR_LE_RANDOM;
|
set_param.own_addr_type = BT_ADDR_LE_RANDOM;
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_OBSERVER)
|
||||||
|
if (scan_enabled) {
|
||||||
|
set_le_scan_enable(true);
|
||||||
|
}
|
||||||
|
#endif /* defined(CONFIG_BT_OBSERVER) */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue