zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.42k stars 6.39k forks source link

Bluetooth: Advertising resume functionality is broken #72567

Open jori-nordic opened 3 months ago

jori-nordic commented 3 months ago

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. https://github.com/zephyrproject-rtos/zephyr/blob/e32c2ee2968599e893172a0221bab7d4bde3632b/include/zephyr/bluetooth/conn.h#L1003-L1016

Additional context

image

github-actions[bot] commented 1 month ago

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.