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 <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2016-06-10 13:49:27 +03:00
commit f7ae091ade

View file

@ -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;