Bluetooth: Cache LE Address Type with LTK, and use for reconnections
LE-Only devices require that an Address Type (Public or Random) be
included in Connection Requests. This info is available at Pairing
but must be cached so that it is available at reconnection time.
This change includes the Address type with the Pairing data.
Change-Id: I50c78ad31d8be70f5c3f49a0529039e4a26daaac
Signed-off-by: Brian Gix <bgix@codeaurora.org>
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 733e9d2..5e67829 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -631,6 +631,7 @@
if (type == LE_LINK) {
struct adv_entry *entry;
+ struct link_key *key;
le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst);
if (le) {
@@ -638,11 +639,17 @@
return le;
}
- entry = hci_find_adv_entry(hdev, dst);
- if (!entry)
- le = hci_le_conn_add(hdev, dst, 0);
- else
- le = hci_le_conn_add(hdev, dst, entry->bdaddr_type);
+ key = hci_find_link_key_type(hdev, dst, KEY_TYPE_LTK);
+ if (!key) {
+ entry = hci_find_adv_entry(hdev, dst);
+ if (entry)
+ le = hci_le_conn_add(hdev, dst,
+ entry->bdaddr_type);
+ else
+ le = hci_le_conn_add(hdev, dst, 0);
+ } else {
+ le = hci_le_conn_add(hdev, dst, key->addr_type);
+ }
if (!le)
return ERR_PTR(-ENOMEM);