Bluetooth: host: Ignore failure to set passive scanner address

Ignore error when failing to set the passive scanner private address.
This can happen because in between the time we checked if the
advertiser was enabled and the time we execute the set random address
command the state of the advertiser could have changed in the
controller, and we only set the state once the command has completed
in the controller.

Fixes: #25672

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2020-09-15 12:47:58 +02:00 committed by Carles Cufí
commit f332d51d60

View file

@ -4124,7 +4124,13 @@ static int le_scan_set_random_addr(bool active_scan, uint8_t *own_addr_type)
!is_adv_using_rand_addr()) { !is_adv_using_rand_addr()) {
err = le_set_private_addr(BT_ID_DEFAULT); err = le_set_private_addr(BT_ID_DEFAULT);
if (err) { if (err) {
return err; if (active_scan || !is_adv_using_rand_addr()) {
return err;
} else {
BT_WARN("Ignoring failure to set "
"address for passive scan (%d)",
err);
}
} }
*own_addr_type = BT_ADDR_LE_RANDOM; *own_addr_type = BT_ADDR_LE_RANDOM;