fix(nimble): Connect with OTA address for host based privacy

This commit is contained in:
Astha Verma
2026-09-18 17:22:25 +05:30
parent 05e2ad7bb2
commit 8946ea2d7a
7 changed files with 79 additions and 9 deletions
@@ -346,10 +346,23 @@ ble_cts_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_cts_cent_gap_event, NULL);
if (rc != 0) {
@@ -468,10 +468,23 @@ ble_htp_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_htp_cent_gap_event, NULL);
if (rc != 0) {
@@ -356,10 +356,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) {
+14 -2
View File
@@ -626,9 +626,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
rc = ble_gap_connect(own_addr_type, addr, 30000, NULL,