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: Advertising resume functionality is broken #72567

Open
jori-nordic opened this issue May 10, 2024 · 0 comments
Open

Bluetooth: Advertising resume functionality is broken #72567

jori-nordic opened this issue May 10, 2024 · 0 comments
Assignees
Labels
area: Bluetooth Host area: Bluetooth bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@jori-nordic
Copy link
Contributor

jori-nordic commented May 10, 2024

Describe the bug

  1. This feature only works when using legacy advertising
  2. This feature will attempt to change the random address while a scanner/initiator is running

The Bluetooth specification says that (when using legacy advertising) it is forbidden to update the random address whilst another role is running.
That means we can't start a scanner while an advertiser is running or the opposite.

With the resume feature, it is very probable that the host attempts to re-start advertising while the scanner is already running.

Proposed change

We should deprecate that feature.
It has also been the source of many race-condition bugs (finding PRs left as exercise to the reader).

With the addition of the recycled callback, that feature is now implementable by the application itself.

/** @brief A connection object has been returned to the pool.
*
* This callback notifies the application that it might be able to
* allocate a connection object. No guarantee, first come, first serve.
*
* Use this to e.g. re-start connectable advertising or scanning.
*
* Treat this callback as an ISR, as it originates from
* @ref bt_conn_unref which is used by the BT stack. Making
* Bluetooth API calls in this context is error-prone and strongly
* discouraged.
*/
void (*recycled)(void);

Additional context

image

@jori-nordic jori-nordic added bug The issue is a bug, or the PR is fixing a bug area: Bluetooth Host labels May 10, 2024
@jori-nordic jori-nordic self-assigned this May 10, 2024
alwa-nordic added a commit to alwa-nordic/zephyr that referenced this issue May 14, 2024
Resolves: zephyrproject-rtos#72567

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
@aescolar aescolar added the priority: low Low impact/importance bug label May 14, 2024
alwa-nordic added a commit to alwa-nordic/zephyr that referenced this issue May 21, 2024
Resolves: zephyrproject-rtos#72567

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Host area: Bluetooth bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

3 participants