Revert "Bluetooth: Host: Disable host-based RPA resolution when !BT_PRIVACY"

This reverts commit 5824ac90ecd8dd06d9ea117d345dbc6b069e5840.

The resulting revert takes into account changes to the predicate that
guards the use of `resp_addr`.

In the resulting revert, the predicate guarding the use of `resp_addr`
is differs from the naive revert because the intention of that predicate
is to know when `conn.c:bt_conn_le_create` decided to use the Host
resolver. And, the logic in `conn.c:bt_conn_le_create` has changed. The
changes to the logic in `conn.c` are in the following commits:

89780d715d
5a09325ba9

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
This commit is contained in:
Aleksander Wasaznik 2023-01-20 13:08:12 +01:00 committed by Carles Cufí
commit 4b675f34db
4 changed files with 9 additions and 17 deletions

View file

@ -673,11 +673,6 @@ struct bt_conn_le_create_param {
* The application must disable explicit scanning before initiating * The application must disable explicit scanning before initiating
* a new LE connection. * a new LE connection.
* *
* When @kconfig{CONFIG_BT_PRIVACY} enabled and @p peer is an identity address
* from a local bond, this API will connect to an advertisement with either:
* - the address being an RPA resolved from the IRK obtained during bonding.
* - the passed identity address, if the local identity is not in Network Privacy Mode.
*
* @param[in] peer Remote address. * @param[in] peer Remote address.
* @param[in] create_param Create connection parameters. * @param[in] create_param Create connection parameters.
* @param[in] conn_param Initial connection parameters. * @param[in] conn_param Initial connection parameters.

View file

@ -327,10 +327,8 @@ if BT_SMP
config BT_PRIVACY config BT_PRIVACY
bool "Privacy Feature" bool "Privacy Feature"
help help
Enable Privacy Feature support. This makes it possible to generate and use Enable local Privacy Feature support. This makes it possible
Resolvable Private Addresses (RPAs). to use Resolvable Private Addresses (RPAs).
Disabling this will remove the capability to resolve private addresses.
config BT_PRIVACY_RANDOMIZE_IR config BT_PRIVACY_RANDOMIZE_IR
bool "Randomize identity root for fallback identities" bool "Randomize identity root for fallback identities"

View file

@ -2834,8 +2834,7 @@ int bt_conn_le_create(const bt_addr_le_t *peer,
create_param_setup(create_param); create_param_setup(create_param);
#if defined(CONFIG_BT_SMP) #if defined(CONFIG_BT_SMP)
if (IS_ENABLED(CONFIG_BT_PRIVACY) && if (bt_dev.le.rl_entries > bt_dev.le.rl_size) {
(bt_dev.le.rl_entries > bt_dev.le.rl_size)) {
/* Use host-based identity resolving. */ /* Use host-based identity resolving. */
bt_conn_set_state(conn, BT_CONN_CONNECTING_SCAN); bt_conn_set_state(conn, BT_CONN_CONNECTING_SCAN);

View file

@ -583,12 +583,12 @@ int bt_le_create_conn_ext(const struct bt_conn *conn)
} else { } else {
const bt_addr_le_t *peer_addr = &conn->le.dst; const bt_addr_le_t *peer_addr = &conn->le.dst;
if (!bt_addr_le_eq(&conn->le.resp_addr, BT_ADDR_LE_ANY)) { #if defined(CONFIG_BT_SMP)
if (bt_dev.le.rl_entries > bt_dev.le.rl_size) {
/* Host resolving is used, use the RPA directly. */ /* Host resolving is used, use the RPA directly. */
peer_addr = &conn->le.resp_addr; peer_addr = &conn->le.resp_addr;
LOG_DBG("Using resp_addr %s", bt_addr_le_str(peer_addr));
} }
#endif
bt_addr_le_copy(&cp->peer_addr, peer_addr); bt_addr_le_copy(&cp->peer_addr, peer_addr);
cp->filter_policy = BT_HCI_LE_CREATE_CONN_FP_NO_FILTER; cp->filter_policy = BT_HCI_LE_CREATE_CONN_FP_NO_FILTER;
} }
@ -656,12 +656,12 @@ static int bt_le_create_conn_legacy(const struct bt_conn *conn)
} else { } else {
const bt_addr_le_t *peer_addr = &conn->le.dst; const bt_addr_le_t *peer_addr = &conn->le.dst;
if (!bt_addr_le_eq(&conn->le.resp_addr, BT_ADDR_LE_ANY)) { #if defined(CONFIG_BT_SMP)
if (bt_dev.le.rl_entries > bt_dev.le.rl_size) {
/* Host resolving is used, use the RPA directly. */ /* Host resolving is used, use the RPA directly. */
peer_addr = &conn->le.resp_addr; peer_addr = &conn->le.resp_addr;
LOG_DBG("Using resp_addr %s", bt_addr_le_str(peer_addr));
} }
#endif
bt_addr_le_copy(&cp->peer_addr, peer_addr); bt_addr_le_copy(&cp->peer_addr, peer_addr);
cp->filter_policy = BT_HCI_LE_CREATE_CONN_FP_NO_FILTER; cp->filter_policy = BT_HCI_LE_CREATE_CONN_FP_NO_FILTER;
} }