diff options
author | Andre Guedes <andre.guedes@openbossa.org> | 2011-05-31 13:20:56 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-06-08 15:58:18 -0400 |
commit | eda42b503a3c866d51146549fe46da1f5f64e2c7 (patch) | |
tree | abccd76f57decdd1824851fffe025c56ee11fd61 /net/bluetooth/hci_conn.c | |
parent | 893d67514aebcfd3ebf17bd212ceea1e2741a443 (diff) |
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.c | 9 |
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 | |||
447 | BT_DBG("%s dst %s", hdev->name, batostr(dst)); | 447 | BT_DBG("%s dst %s", hdev->name, batostr(dst)); |
448 | 448 | ||
449 | if (type == LE_LINK) { | 449 | if (type == LE_LINK) { |
450 | struct adv_entry *entry; | ||
451 | |||
450 | le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst); | 452 | le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst); |
451 | if (le) | 453 | if (le) |
452 | return ERR_PTR(-EBUSY); | 454 | return ERR_PTR(-EBUSY); |
455 | |||
456 | entry = hci_find_adv_entry(hdev, dst); | ||
457 | if (!entry) | ||
458 | return ERR_PTR(-EHOSTUNREACH); | ||
459 | |||
453 | le = hci_conn_add(hdev, LE_LINK, dst); | 460 | le = hci_conn_add(hdev, LE_LINK, dst); |
454 | if (!le) | 461 | if (!le) |
455 | return ERR_PTR(-ENOMEM); | 462 | return ERR_PTR(-ENOMEM); |
456 | 463 | ||
464 | le->dst_type = entry->bdaddr_type; | ||
465 | |||
457 | hci_le_connect(le); | 466 | hci_le_connect(le); |
458 | 467 | ||
459 | hci_conn_hold(le); | 468 | hci_conn_hold(le); |