Skip to content

Commit 4c1a309

Browse files
committed
Nordic BLE: Set own resolvable address to NULL.
This address is not accessible to the application.
1 parent d962fc0 commit 4c1a309

File tree

1 file changed

+5
-13
lines changed
  • features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF52/source

1 file changed

+5
-13
lines changed

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF52/source/nRF5xGap.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ void nRF5xGap::on_connection(Gap::Handle_t handle, const ble_gap_evt_connected_t
13221322
// deal with own address
13231323
LegacyAddressType_t own_addr_type;
13241324
ble::address_t own_address;
1325-
ble::address_t own_resolvable_address;
1325+
const uint8_t* own_resolvable_address = NULL;
13261326

13271327
#if (NRF_SD_BLE_API_VERSION <= 2)
13281328
if (evt.own_addr.addr_type == BLE_GAP_ADDR_TYPE_PUBLIC) {
@@ -1335,14 +1335,6 @@ void nRF5xGap::on_connection(Gap::Handle_t handle, const ble_gap_evt_connected_t
13351335
getAddress(&own_addr_type, own_address.data());
13361336
#endif
13371337

1338-
if (_privacy_enabled) {
1339-
// swap own address with own resolvable address as when privacy is
1340-
// enabled own_address is invalid and the address returned by getAddress
1341-
// is the resolvable one.
1342-
std::swap(own_address, own_resolvable_address);
1343-
own_addr_type = LegacyAddressType::RANDOM_PRIVATE_RESOLVABLE;
1344-
}
1345-
13461338
#if (NRF_SD_BLE_API_VERSION <= 2)
13471339
bool private_peer_known = evt.irk_match;
13481340
#else
@@ -1374,11 +1366,11 @@ void nRF5xGap::on_connection(Gap::Handle_t handle, const ble_gap_evt_connected_t
13741366
private_peer_known,
13751367
evt.peer_addr.addr_type
13761368
);
1369+
13771370
// NOTE: when privacy is enabled, the only address returned is the resolved
1378-
// address; set peer and resolved address to the same value in such case.
1371+
// address.
13791372
const uint8_t* peer_address = evt.peer_addr.addr;
1380-
const uint8_t* peer_resolvable_address =
1381-
private_peer_known ? peer_address : NULL;
1373+
const uint8_t* peer_resolvable_address = NULL;
13821374

13831375
// notify internal event handler before applying the resolution strategy
13841376
if (_connection_event_handler) {
@@ -1422,7 +1414,7 @@ void nRF5xGap::on_connection(Gap::Handle_t handle, const ble_gap_evt_connected_t
14221414
own_address.data(),
14231415
reinterpret_cast<const ConnectionParams_t *>(&(evt.conn_params)),
14241416
peer_resolvable_address,
1425-
own_resolvable_address.data()
1417+
own_resolvable_address
14261418
);
14271419
}
14281420

0 commit comments

Comments
 (0)