opened
trond-snekvik
username_0
The passive scanner isn't actually using the advertising address, and
doesn't need to set it during scan initialization.

set_random_addr always fails if there's an active advertiser, which
would cause needless complications for the Bluetooth Mesh LPN case.

Fixes #22088.
Bluetooth: Skip address setting for passive scan
issue
created
joerchan
username_1
This is a continuation of https://github.com/zephyrproject-rtos/zephyr/pull/21714
comment
created
jhedberg
username_2
I might remember wrong, but I have a faint memory of us discussing this with the controller guys some time ago, and there was something that still justified setting the address for passive scanning. Perhaps it was directed advertising, or something similar, or then I just remember wrong and it was for something else. @cvinayak @username_3 any comments?
comment
created
joerchan
username_1
@username_2 That's true. But then using advertiser with NRPA at the same time would not work. We could possibly set random address if the advertiser is not running. Otherwise we have a structural conflict with the passive scanner on using the random address as well.
comment
created
joerchan
username_1
@username_2 @username_3 @username_0 
Maybe we could try to set the random address, but if it fails we continue without it (for passive scanner only). Then we would not get directed advertising reports. Then we could support the Mesh use-case of NRPA advertiser and Passive scanner.

Of course this should be documented clearly. It would only affect users who start advertiser with NRPA or an identity different than the default identity (BT_ID_DEFAULT).
comment
created
joerchan
username_1
Furthermore. This should be documented, or possibly handled together with the `Central Address Resolution` characteristic.
comment
created
joerchan
username_1
Current behaviour when Privacy is OFF and Random Static Identity

 - Active scanner sets an NRPA if not advertising or Kconfig option BT_SCAN_WITH_IDENTITY is set.
   Active scanner currently will not receive directed advertise reports.

 - Passive scanner sets random address.
   Passive scanner currently can received directed advertise reports.

 - Passive scanner with non-connectable advertiser
   Advertiser will overwrite random address of passive scanner, and will not receive directed advertise reports anymore.

 - Active scanner with non-connectable advertiser
   Both will try to set NRPA, and it will fail (because it is not the same NRPA)

Suggested action:
 - Switch default BT_SCAN_WITH_IDENTITY to on. (off by default) to support directed advertising reports.
 - Mesh sets BT_SCAN_WITH_IDENTITY to off
 - When BT_SCAN_WITH_IDENTITY is off, allow advertiser to overwrite the address NRPA of the scanner.
   - Should passive scanner set NRPA instead of Random Static Identity?
     It would be confusing that passive scanner receives directed advertising reports, but not active scanner
comment
created
carlescufi
username_3
Conclusion after meeting:

- `BT_SCAN_WITH_IDENTITY` enables not only using (and setting) the identity address when scanning (and no privacy) but also the reception of directed adv reports for **both** active and passive scanning.
- Document this fact in both the Kconfig option help text and the `bt_le_scan_start()` doxygen
comment
created
trond-snekvik
username_0
The mesh still works after @username_1's changes.
comment