From 64b890463d18e5d678cc43cf35213f1c33a3badc Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Wed, 15 Jan 2020 18:56:39 +0100 Subject: [PATCH] Bluetooth: host: Fix advertiser with identity switches to RPA Fix advertiser requested to use the identity address while privacy feature is enabled will change to using RPA address when advertise is resumed or when RPA timeout occurred. RPA timeout does not need to run when advertiser is using identity. Signed-off-by: Joakim Andersson --- subsys/bluetooth/host/hci_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index f7f3e3fb4a6..fc719d079e0 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -607,7 +607,8 @@ static void rpa_timeout(struct k_work *work) atomic_clear_bit(bt_dev.flags, BT_DEV_RPA_VALID); /* IF no roles using the RPA is running we can stop the RPA timer */ - if (!(atomic_test_bit(bt_dev.flags, BT_DEV_ADVERTISING) || + if (!((atomic_test_bit(bt_dev.flags, BT_DEV_ADVERTISING) && + !atomic_test_bit(bt_dev.flags, BT_DEV_ADVERTISING_IDENTITY)) || atomic_test_bit(bt_dev.flags, BT_DEV_INITIATING) || (atomic_test_bit(bt_dev.flags, BT_DEV_SCANNING) && atomic_test_bit(bt_dev.flags, BT_DEV_ACTIVE_SCAN)))) { @@ -6172,7 +6173,8 @@ void bt_le_adv_resume(void) bt_conn_set_state(adv_conn, BT_CONN_CONNECT_ADV); - if (IS_ENABLED(CONFIG_BT_PRIVACY)) { + if (IS_ENABLED(CONFIG_BT_PRIVACY) && + !atomic_test_bit(bt_dev.flags, BT_DEV_ADVERTISING_IDENTITY)) { le_set_private_addr(bt_dev.adv_id); }