mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
pkg/nimble: derive used address type in statconn from peer address
Using a `BLE_ADDR_RANDOM` as the peer address type allows connecting only to peers that have a static random address. Deriving the peer address type from the peer address is simple and allows connections to be established with peers that have either a public or static random address.
This commit is contained in:
parent
3a6dac4455
commit
367707a158
@ -86,7 +86,8 @@ static void _activate(uint8_t role)
|
||||
|
||||
if (slot && (role == ROLE_M)) {
|
||||
ble_addr_t peer;
|
||||
peer.type = BLE_ADDR_RANDOM;
|
||||
peer.type = ((slot->addr[0] & 0xc0) == 0xc0) ? BLE_ADDR_RANDOM
|
||||
: BLE_ADDR_PUBLIC;
|
||||
bluetil_addr_swapped_cp(slot->addr, peer.val);
|
||||
/* try to (re)open the connection */
|
||||
#if IS_USED(MODULE_NIMBLE_STATCONN_EXT)
|
||||
|
Loading…
Reference in New Issue
Block a user