summaryrefslogtreecommitdiff
path: root/net/bluetooth/hci_conn.c
diff options
context:
space:
mode:
authorAndre Guedes <andre.guedes@openbossa.org>2011-05-31 14:20:56 -0300
committerGustavo F. Padovan <padovan@profusion.mobi>2011-06-08 16:58:18 -0300
commiteda42b503a3c866d51146549fe46da1f5f64e2c7 (patch)
treeabccd76f57decdd1824851fffe025c56ee11fd61 /net/bluetooth/hci_conn.c
parent893d67514aebcfd3ebf17bd212ceea1e2741a443 (diff)
downloadlwn-eda42b503a3c866d51146549fe46da1f5f64e2c7.tar.gz
lwn-eda42b503a3c866d51146549fe46da1f5f64e2c7.zip
Bluetooth: Check advertising cache in hci_connect()
When connecting to a LE device, we need to check the advertising cache in order to know the address type of that device. If its advertising entry is not found, the connection is not established and hci_connect() returns error. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Acked-by: Ville Tervo <ville.tervo@nokia.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r--net/bluetooth/hci_conn.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index ca283a0f63ea..4e38b4872865 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -447,13 +447,22 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8
BT_DBG("%s dst %s", hdev->name, batostr(dst));
if (type == LE_LINK) {
+ struct adv_entry *entry;
+
le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst);
if (le)
return ERR_PTR(-EBUSY);
+
+ entry = hci_find_adv_entry(hdev, dst);
+ if (!entry)
+ return ERR_PTR(-EHOSTUNREACH);
+
le = hci_conn_add(hdev, LE_LINK, dst);
if (!le)
return ERR_PTR(-ENOMEM);
+ le->dst_type = entry->bdaddr_type;
+
hci_le_connect(le);
hci_conn_hold(le);