summaryrefslogtreecommitdiff
path: root/emulator
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-08-13 13:54:10 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-08-13 13:59:01 -0700
commitf71feab36538a02d9b4dbed549e52dcaa75384c9 (patch)
tree7a31f15ae4b180f35a51172df58e1234a0a62fb5 /emulator
parent219e1c6e50cf8f3fdfcf152962a5b0a4c2ae7bc3 (diff)
downloadbluez-f71feab36538a02d9b4dbed549e52dcaa75384c9.tar.gz
bthost: Fix not initializing address types properly
The address type given to the init_conn is the peer address type (btdev) not the bthost address type, the old code assume it could use since only BDADDR_BREDR or BDADDR_LE_PUBLIC was tested but with the upcoming support for LL Privacy the peer address type would become BDADDR_LE_RANDOM which cannot be used as address type of bthost as that doesn't support random addresses and would likely cause SMP to fail when pairing.
Diffstat (limited to 'emulator')
-rw-r--r--emulator/bthost.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/emulator/bthost.c b/emulator/bthost.c
index 547685208..4f1598f0d 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
@@ -951,14 +951,20 @@ static void init_conn(struct bthost *bthost, uint16_t handle,
if (bthost->conn_init) {
ia = bthost->bdaddr;
- ia_type = addr_type;
- ra = conn->bdaddr;
- ra_type = conn->addr_type;
+ if (addr_type == BDADDR_BREDR)
+ ia_type = addr_type;
+ else
+ ia_type = BDADDR_LE_PUBLIC;
+ ra = bdaddr;
+ ra_type = addr_type;
} else {
- ia = conn->bdaddr;
- ia_type = conn->addr_type;
+ ia = bdaddr;
+ ia_type = addr_type;
ra = bthost->bdaddr;
- ra_type = addr_type;
+ if (addr_type == BDADDR_BREDR)
+ ra_type = addr_type;
+ else
+ ra_type = BDADDR_LE_PUBLIC;
}
conn->smp_data = smp_conn_add(bthost->smp_data, handle, ia, ia_type,