Skip to content

Commit 65ee84b

Browse files
committed
bluetooth: host: Fix stale RPA usage on advertiser restart
Regenerate RPA when re-enabling an advertising set if BT_ADV_RPA_VALID flag was cleared while the advertiser was disabled. When RPA rotation is triggered via le_force_rpa_timeout() while an advertiser is disabled, the BT_ADV_RPA_VALID flag is cleared but the RPA is not regenerated. Without this fix, re-enabling the advertiser would use the stale RPA, violating Bluetooth privacy requirements. Add !BT_ADV_RPA_VALID check to bt_le_ext_adv_start() for both connectable and non-connectable advertisers to ensure fresh RPA generation when needed. This also ensures proper rpa_expired callback invocation for disabled advertising sets per the bt_le_ext_adv_cb API contract. Fixes regression introduced in #98117. Signed-off-by: Pavel Vasilyev <[email protected]>
1 parent d02cdc7 commit 65ee84b

File tree

1 file changed

+4
-2
lines changed
  • subsys/bluetooth/host

1 file changed

+4
-2
lines changed

subsys/bluetooth/host/adv.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,13 +1514,15 @@ int bt_le_ext_adv_start(struct bt_le_ext_adv *adv,
15141514
if (IS_ENABLED(CONFIG_BT_PRIVACY) &&
15151515
!atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY) &&
15161516
(!atomic_test_and_clear_bit(adv->flags, BT_ADV_RANDOM_ADDR_UPDATED) ||
1517-
atomic_test_bit(adv->flags, BT_PER_ADV_ENABLED))) {
1517+
atomic_test_bit(adv->flags, BT_PER_ADV_ENABLED) ||
1518+
!atomic_test_bit(adv->flags, BT_ADV_RPA_VALID))) {
15181519
bt_id_set_adv_private_addr(adv);
15191520
}
15201521
} else {
15211522
if (!atomic_test_bit(adv->flags, BT_ADV_USE_IDENTITY) &&
15221523
(!atomic_test_and_clear_bit(adv->flags, BT_ADV_RANDOM_ADDR_UPDATED) ||
1523-
atomic_test_bit(adv->flags, BT_PER_ADV_ENABLED))) {
1524+
atomic_test_bit(adv->flags, BT_PER_ADV_ENABLED) ||
1525+
!atomic_test_bit(adv->flags, BT_ADV_RPA_VALID))) {
15241526
bt_id_set_adv_private_addr(adv);
15251527
}
15261528
}

0 commit comments

Comments
 (0)