Skip to content

Conversation

@PavelVPV
Copy link
Contributor

@PavelVPV PavelVPV commented Dec 1, 2025

Add !BT_ADV_RPA_VALID check to force RPA regeneration when re-enabling an advertising set after RPA rotation occurred while disabled.

The BT_ADV_RANDOM_ADDR_UPDATED flag was added to prevent unnecessary address regeneration (RPA/NRPA) between bt_le_ext_adv_param_set() and bt_le_ext_adv_start() calls. However, this revealed an issue:

When RPA rotation (le_force_rpa_timeout) occurs while an advertiser is disabled, BT_ADV_RPA_VALID is cleared but the RPA is not regenerated. On subsequent bt_le_ext_adv_start() without a new param_set() call:

  • BT_ADV_RANDOM_ADDR_UPDATED is already cleared (from previous start)
  • Without BT_PER_ADV_ENABLED, no regeneration occurs
  • Stale RPA is used, violating privacy requirements

Add !BT_ADV_RPA_VALID check for both connectable and non-connectable advertisers to ensure fresh RPA generation when the previous RPA was invalidated while the advertiser was disabled.

Fixes regression introduced in zephyrproject-rtos/zephyr#98117.

(cherry picked from commit a63f51b536358e3b0f7e196015e4d88c594d7b12)

Upstream PR #: 100295

@PavelVPV PavelVPV added the DNM label Dec 1, 2025
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Dec 1, 2025
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-zephyr#3565

Signed-off-by: Nordic Builder <[email protected]>
@PavelVPV PavelVPV added this to the ncs-3.2.0 milestone Dec 1, 2025
@PavelVPV PavelVPV requested a review from kapi-no December 1, 2025 12:58
@PavelVPV
Copy link
Contributor Author

PavelVPV commented Dec 1, 2025

DNM until upstream PR is approved (at least).

@PavelVPV PavelVPV force-pushed the fix_rpa_rotation_after_being_invalidated branch from b5b42ac to f3fa678 Compare December 1, 2025 19:33
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Dec 1, 2025
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-zephyr#3565

Signed-off-by: Nordic Builder <[email protected]>
@PavelVPV PavelVPV force-pushed the fix_rpa_rotation_after_being_invalidated branch from f3fa678 to 3e2e13e Compare December 1, 2025 19:36
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Dec 1, 2025
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-zephyr#3565

Signed-off-by: Nordic Builder <[email protected]>
Add !BT_ADV_RPA_VALID check to force RPA regeneration when re-enabling
an advertising set after RPA rotation occurred while disabled.

The BT_ADV_RANDOM_ADDR_UPDATED flag was added to prevent unnecessary
address regeneration (RPA/NRPA) between bt_le_ext_adv_param_set() and
bt_le_ext_adv_start() calls. However, this revealed an issue:

When RPA rotation (le_force_rpa_timeout) occurs while an advertiser is
disabled, BT_ADV_RPA_VALID is cleared but the RPA is not regenerated.
On subsequent bt_le_ext_adv_start() without a new param_set() call:
- BT_ADV_RANDOM_ADDR_UPDATED is already cleared (from previous start)
- Without BT_PER_ADV_ENABLED, no regeneration occurs
- Stale RPA is used, violating privacy requirements

Add !BT_ADV_RPA_VALID check for both connectable and non-connectable
advertisers to ensure fresh RPA generation when the previous RPA was
invalidated while the advertiser was disabled.

Fixes regression introduced in #98117.

Signed-off-by: Pavel Vasilyev <[email protected]>
(cherry picked from commit 6da559f56544aa2ed1c93071ffad203a523d432c)
@PavelVPV PavelVPV force-pushed the fix_rpa_rotation_after_being_invalidated branch from 3e2e13e to 5c96acb Compare December 2, 2025 10:44
@PavelVPV PavelVPV changed the title [nrf fromlist] bluetooth: host: Fix stale RPA usage after invalidation [nrf fromtree] bluetooth: host: Fix stale RPA usage after invalidation Dec 2, 2025
@PavelVPV PavelVPV requested a review from KyraLengfeld December 2, 2025 10:44
@PavelVPV PavelVPV marked this pull request as ready for review December 2, 2025 10:44
@PavelVPV
Copy link
Contributor Author

PavelVPV commented Dec 2, 2025

Changed to fromtree as upstream PR has been merged.

NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Dec 2, 2025
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-zephyr#3565

Signed-off-by: Nordic Builder <[email protected]>
Copy link
Contributor

@alwa-nordic alwa-nordic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cherry pick looks correct and is a bug fix.

@PavelVPV PavelVPV removed the DNM label Dec 2, 2025
@carlescufi carlescufi merged commit 16d748b into nrfconnect:main Dec 2, 2025
25 checks passed
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Dec 2, 2025
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-zephyr#3565

Signed-off-by: Nordic Builder <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants