mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
fix(nimble): Connect with OTA address for host based privacy
This commit is contained in:
@@ -323,6 +323,17 @@ menu "GAP"
|
||||
Use this option to do host based Random Private Address resolution.
|
||||
This option is valid only for ESP32
|
||||
|
||||
config BT_NIMBLE_HOST_BASED_PRIVACY_RESOLVE_ON_SCAN
|
||||
bool "Resolve peer RPA while scanning"
|
||||
default y
|
||||
depends on BT_NIMBLE_HOST_BASED_PRIVACY
|
||||
help
|
||||
Enable this option to resolve peer Resolvable Private Addresses (RPAs)
|
||||
to their identity addresses in scan results. This is useful when an
|
||||
application needs to identify a peer while scanning, for example, to
|
||||
match a bonded device. When disabled, scan results retain the peer's
|
||||
on-air RPA, and the RPA is resolved when the connection is established.
|
||||
|
||||
config BT_NIMBLE_HOST_ALLOW_CONNECT_WITH_SCAN
|
||||
bool "Allow Connections with scanning in progress"
|
||||
depends on BT_NIMBLE_ENABLED && !(IDF_TARGET_ESP32C2)
|
||||
|
||||
Submodule components/bt/host/nimble/nimble updated: 3c88ae2745...eac83cd603
@@ -1010,6 +1010,14 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_HOST_BASED_PRIVACY_RESOLVE_ON_SCAN
|
||||
#ifdef CONFIG_BT_NIMBLE_HOST_BASED_PRIVACY_RESOLVE_ON_SCAN
|
||||
#define MYNEWT_VAL_BLE_HOST_BASED_PRIVACY_RESOLVE_ON_SCAN (1)
|
||||
#else
|
||||
#define MYNEWT_VAL_BLE_HOST_BASED_PRIVACY_RESOLVE_ON_SCAN (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_RPA_TIMEOUT
|
||||
#define MYNEWT_VAL_BLE_RPA_TIMEOUT (CONFIG_BT_NIMBLE_RPA_TIMEOUT)
|
||||
#endif
|
||||
|
||||
@@ -376,9 +376,21 @@ ble_cts_cent_connect_if_interesting(void *disc)
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXAMPLE_EXTENDED_ADV
|
||||
addr = &((struct ble_gap_ext_disc_desc *)disc)->addr;
|
||||
struct ble_gap_ext_disc_desc *disc_desc = disc;
|
||||
#else
|
||||
addr = &((struct ble_gap_disc_desc *)disc)->addr;
|
||||
struct ble_gap_disc_desc *disc_desc = disc;
|
||||
#endif
|
||||
|
||||
addr = &disc_desc->addr;
|
||||
|
||||
#if MYNEWT_VAL(BLE_HOST_BASED_PRIVACY)
|
||||
/*
|
||||
* With host-based privacy, the advertising report's peer address may be
|
||||
* resolved to the identity address by the Host. The Controller does not
|
||||
* perform peer RPA resolution, so use the current OTA address when
|
||||
* initiating the connection.
|
||||
*/
|
||||
addr = &disc_desc->ota_addr;
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXAMPLE_CI_ID && CONFIG_EXAMPLE_CI_PIPELINE_ID
|
||||
|
||||
@@ -498,9 +498,21 @@ ble_htp_cent_connect_if_interesting(void *disc)
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXAMPLE_EXTENDED_ADV
|
||||
addr = &((struct ble_gap_ext_disc_desc *)disc)->addr;
|
||||
struct ble_gap_ext_disc_desc *disc_desc = disc;
|
||||
#else
|
||||
addr = &((struct ble_gap_disc_desc *)disc)->addr;
|
||||
struct ble_gap_disc_desc *disc_desc = disc;
|
||||
#endif
|
||||
|
||||
addr = &disc_desc->addr;
|
||||
|
||||
#if MYNEWT_VAL(BLE_HOST_BASED_PRIVACY)
|
||||
/*
|
||||
* With host-based privacy, the advertising report's peer address may be
|
||||
* resolved to the identity address by the Host. The Controller does not
|
||||
* perform peer RPA resolution, so use the current OTA address when
|
||||
* initiating the connection.
|
||||
*/
|
||||
addr = &disc_desc->ota_addr;
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXAMPLE_CI_ID && CONFIG_EXAMPLE_CI_PIPELINE_ID
|
||||
|
||||
@@ -435,10 +435,23 @@ ble_prox_cent_connect_if_interesting(void *disc)
|
||||
* timeout.
|
||||
*/
|
||||
#if CONFIG_EXAMPLE_EXTENDED_ADV
|
||||
addr = &((struct ble_gap_ext_disc_desc *)disc)->addr;
|
||||
struct ble_gap_ext_disc_desc *disc_desc = disc;
|
||||
#else
|
||||
addr = &((struct ble_gap_disc_desc *)disc)->addr;
|
||||
struct ble_gap_disc_desc *disc_desc = disc;
|
||||
#endif
|
||||
|
||||
addr = &disc_desc->addr;
|
||||
|
||||
#if MYNEWT_VAL(BLE_HOST_BASED_PRIVACY)
|
||||
/*
|
||||
* With host-based privacy, the advertising report's peer address may be
|
||||
* resolved to the identity address by the Host. The Controller does not
|
||||
* perform peer RPA resolution, so use the current OTA address when
|
||||
* initiating the connection.
|
||||
*/
|
||||
addr = &disc_desc->ota_addr;
|
||||
#endif
|
||||
|
||||
rc = ble_gap_connect(own_addr_type, addr, 30000, NULL,
|
||||
ble_prox_cent_gap_event, NULL);
|
||||
if (rc != 0) {
|
||||
|
||||
@@ -678,9 +678,21 @@ blecent_connect_if_interesting(void *disc)
|
||||
* timeout.
|
||||
*/
|
||||
#if CONFIG_EXAMPLE_EXTENDED_ADV
|
||||
addr = &((struct ble_gap_ext_disc_desc *)disc)->addr;
|
||||
struct ble_gap_ext_disc_desc *disc_desc = disc;
|
||||
#else
|
||||
addr = &((struct ble_gap_disc_desc *)disc)->addr;
|
||||
struct ble_gap_disc_desc *disc_desc = disc;
|
||||
#endif
|
||||
|
||||
addr = &disc_desc->addr;
|
||||
|
||||
#if MYNEWT_VAL(BLE_HOST_BASED_PRIVACY)
|
||||
/*
|
||||
* With host-based privacy, the advertising report's peer address may be
|
||||
* resolved to the identity address by the Host. The Controller does not
|
||||
* perform peer RPA resolution, so use the current OTA address when
|
||||
* initiating the connection.
|
||||
*/
|
||||
addr = &disc_desc->ota_addr;
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXAMPLE_CI_ID && CONFIG_EXAMPLE_CI_PIPELINE_ID
|
||||
|
||||
Reference in New Issue
Block a user