From f7ae091ade6a7a8ed9447d30674c9893e52ecb33 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 10 Jun 2016 13:49:27 +0300 Subject: [PATCH] Bluetooth: Allow NRPA usage when connections are not supported Currently CONFIG_BLUETOOTH_PRIVACY is defined as the ability to generate RPAs, and it depends on CONFIG_BLUETOOTH_SMP. NRPA usage however may be desirable even without these features (e.g. a broadcaster-only device). Furthermore, if we are using RPA based privacy we should be using that instead of NRPA even when doing non-connectable advertising. This patch leaves out the option of advertising with the Identity Address when non-connectable, however if we get a use case for that we could consider adding a BT_LE_ADV_OPT_ID_ADDR to force using it. Change-Id: I0502323aec15eefad1a729c393c707108d4cf758 Signed-off-by: Johan Hedberg --- net/bluetooth/hci_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index eeb817f165a..979f3479df2 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3413,16 +3413,16 @@ int bt_le_adv_start(const struct bt_le_adv_param *param, set_param->type = BT_LE_ADV_IND; } else { #if defined(CONFIG_BLUETOOTH_PRIVACY) + err = le_set_rpa(); +#else err = le_set_nrpa(); +#endif /* CONFIG_BLUETOOTH_PRIVACY */ if (err) { net_buf_unref(buf); return err; } set_param->own_addr_type = BT_ADDR_LE_RANDOM; -#else - set_param->own_addr_type = bt_dev.id_addr.type; -#endif /* CONFIG_BLUETOOTH_PRIVACY */ if (sd) { set_param->type = BT_LE_ADV_SCAN_IND;