BLE: Lookup for non identity addresses when a secure entry is opened.

A peer may not share a valid IRK and identity address during pairing (in that case the identity address received is all zeros). When this happens, the entry must be retrieved by looking at the address used by the peer during the connection.
pull/6932/head
Vincent Coubard 2018-05-01 11:24:44 +01:00
parent c4b78ada0e
commit 1e277bad50
1 changed files with 10 additions and 2 deletions

View File

@ -276,8 +276,16 @@ public:
for (size_t i = 0; i < MAX_ENTRIES; i++) {
if (_entries[i].state == ENTRY_FREE) {
continue;
} else if (peer_address == _entries[i].peer_identity.identity_address
&& _entries[i].flags.peer_address_is_public == peer_address_public) {
} else if (
peer_address == _entries[i].peer_identity.identity_address &&
peer_address_public ==_entries[i].flags.peer_address_is_public
) {
return &_entries[i];
} else if (
_entries[i].peer_identity.identity_address == address_t() &&
peer_address == _entries[i].flags.peer_address &&
peer_address_public == _entries[i].flags.peer_address_is_public
) {
return &_entries[i];
}
}