Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bluetooth: id: fix adv sets with same id use different RPA #68892

Conversation

niym-ot
Copy link
Contributor

@niym-ot niym-ot commented Feb 12, 2024

The fix is to check if any of the adv set's rpa expired callback returns false, then all adv sets continues with the old RPA.

Note: Fix is applicable only to adv sets which shares the same id.

fixes #64625

@zephyrbot zephyrbot added area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth labels Feb 12, 2024
@niym-ot niym-ot force-pushed the Issue_Id_64625_rpa_diff_for_adv_sets_with_same_id branch from 7d3726f to 0c723a7 Compare February 12, 2024 18:36
@Thalley
Copy link
Collaborator

Thalley commented Feb 14, 2024

@niym-ot modified your PR text to use the proper way of linking PRs with issues (see https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests)

@Thalley Thalley added the bug The issue is a bug, or the PR is fixing a bug label Feb 14, 2024
@jori-nordic
Copy link
Collaborator

Could you add a bsim test for this functionality?

@niym-ot niym-ot force-pushed the Issue_Id_64625_rpa_diff_for_adv_sets_with_same_id branch from 0c723a7 to a6ee98b Compare February 20, 2024 11:46
@alwa-nordic
Copy link
Collaborator

Can we add a new test instead of modifying an old one? I think it's much easier to navigate single-purpose tests with a clearly stated test purpose.

@niym-ot niym-ot force-pushed the Issue_Id_64625_rpa_diff_for_adv_sets_with_same_id branch from a6ee98b to d1fc0aa Compare February 20, 2024 12:24
@niym-ot niym-ot force-pushed the Issue_Id_64625_rpa_diff_for_adv_sets_with_same_id branch 2 times, most recently from 2d14654 to 6a52b14 Compare March 5, 2024 08:23
subsys/bluetooth/host/id.c Show resolved Hide resolved
subsys/bluetooth/host/id.c Show resolved Hide resolved
@@ -56,15 +56,16 @@ static void validate_rpa_addr_generated_for_adv_sets(void)
FAIL("RPA not same for adv sets with same id and RPA sharing enabled\n");
}
}
if (bt_addr_le_eq(&adv_set_data[0].old_addr, &adv_set_data[3].old_addr)) {
if (bt_addr_le_eq(&adv_set_data[0].old_addr, &adv_set_data[2].old_addr)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please move the refactors of other tests to a separate PR. You can tag it trivial.
You can keep the rename in this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the changes

create_adv(&adv_set[i], ID_2, true);
break;
case ADV_SET_INDEX_4:
create_adv(&adv_set[i], ID_2, false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you post a follow-up PR where you add another id w/ two other adv sets, that return false for the first one and true for the second one? Ie started in reverse order so the iterator hits the false first.

Copy link
Collaborator

Choose a reason for hiding this comment

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

clarify: this comment is not a blocker.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted. Will create a pull request for the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Thalley Thalley removed their request for review March 8, 2024 09:25
@niym-ot niym-ot force-pushed the Issue_Id_64625_rpa_diff_for_adv_sets_with_same_id branch 2 times, most recently from 7d3092f to d96a160 Compare March 8, 2024 11:20
@zephyrbot zephyrbot requested review from asbjornsabo and Vudentz March 8, 2024 11:20
@niym-ot niym-ot requested a review from jori-nordic March 8, 2024 13:26
jhedberg
jhedberg previously approved these changes Mar 8, 2024
@@ -110,11 +111,10 @@ void start_advertising(void)

for (int i = 0; i < CONFIG_BT_EXT_ADV_MAX_ADV_SET; i++) {

if (i != ADV_SET_INDEX_THREE) {
/* Create advertising set 1 and 2 with same id */
/* Create first 2 advertising sets with one id and remaining with another id */
Copy link
Collaborator

Choose a reason for hiding this comment

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

please revert changes to this test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

The fix is to check if any of the adv set's rpa expired
callback returns false, then all adv sets continues with
the old RPA.

Note: Fix is applicable only to adv sets which shares the
same id.

Signed-off-by: Nithin Ramesh Myliattil <[email protected]>
@niym-ot niym-ot force-pushed the Issue_Id_64625_rpa_diff_for_adv_sets_with_same_id branch from d96a160 to d6a000b Compare March 8, 2024 16:41
@niym-ot niym-ot requested review from jori-nordic and jhedberg March 8, 2024 16:43
@aescolar aescolar merged commit 6ce38c1 into zephyrproject-rtos:main Mar 11, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bluetooth: Host: advertising sets linked with the same identity may use different RPAs
7 participants