diff options
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r-- | net/bluetooth/hci_conn.c | 56 |
1 files changed, 11 insertions, 45 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 5238b6b3ea6a..3f18a6ed9731 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -223,36 +223,6 @@ void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], | |||
223 | } | 223 | } |
224 | EXPORT_SYMBOL(hci_le_start_enc); | 224 | EXPORT_SYMBOL(hci_le_start_enc); |
225 | 225 | ||
226 | void hci_le_ltk_reply(struct hci_conn *conn, u8 ltk[16]) | ||
227 | { | ||
228 | struct hci_dev *hdev = conn->hdev; | ||
229 | struct hci_cp_le_ltk_reply cp; | ||
230 | |||
231 | BT_DBG("%p", conn); | ||
232 | |||
233 | memset(&cp, 0, sizeof(cp)); | ||
234 | |||
235 | cp.handle = cpu_to_le16(conn->handle); | ||
236 | memcpy(cp.ltk, ltk, sizeof(ltk)); | ||
237 | |||
238 | hci_send_cmd(hdev, HCI_OP_LE_LTK_REPLY, sizeof(cp), &cp); | ||
239 | } | ||
240 | EXPORT_SYMBOL(hci_le_ltk_reply); | ||
241 | |||
242 | void hci_le_ltk_neg_reply(struct hci_conn *conn) | ||
243 | { | ||
244 | struct hci_dev *hdev = conn->hdev; | ||
245 | struct hci_cp_le_ltk_neg_reply cp; | ||
246 | |||
247 | BT_DBG("%p", conn); | ||
248 | |||
249 | memset(&cp, 0, sizeof(cp)); | ||
250 | |||
251 | cp.handle = cpu_to_le16(conn->handle); | ||
252 | |||
253 | hci_send_cmd(hdev, HCI_OP_LE_LTK_NEG_REPLY, sizeof(cp), &cp); | ||
254 | } | ||
255 | |||
256 | /* Device _must_ be locked */ | 226 | /* Device _must_ be locked */ |
257 | void hci_sco_setup(struct hci_conn *conn, __u8 status) | 227 | void hci_sco_setup(struct hci_conn *conn, __u8 status) |
258 | { | 228 | { |
@@ -513,7 +483,8 @@ EXPORT_SYMBOL(hci_get_route); | |||
513 | 483 | ||
514 | /* Create SCO, ACL or LE connection. | 484 | /* Create SCO, ACL or LE connection. |
515 | * Device _must_ be locked */ | 485 | * Device _must_ be locked */ |
516 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type) | 486 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, |
487 | __u8 dst_type, __u8 sec_level, __u8 auth_type) | ||
517 | { | 488 | { |
518 | struct hci_conn *acl; | 489 | struct hci_conn *acl; |
519 | struct hci_conn *sco; | 490 | struct hci_conn *sco; |
@@ -522,23 +493,18 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 | |||
522 | BT_DBG("%s dst %s", hdev->name, batostr(dst)); | 493 | BT_DBG("%s dst %s", hdev->name, batostr(dst)); |
523 | 494 | ||
524 | if (type == LE_LINK) { | 495 | if (type == LE_LINK) { |
525 | struct adv_entry *entry; | ||
526 | |||
527 | le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst); | 496 | le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst); |
528 | if (le) | 497 | if (!le) { |
529 | return ERR_PTR(-EBUSY); | 498 | le = hci_conn_add(hdev, LE_LINK, dst); |
530 | 499 | if (!le) | |
531 | entry = hci_find_adv_entry(hdev, dst); | 500 | return ERR_PTR(-ENOMEM); |
532 | if (!entry) | ||
533 | return ERR_PTR(-EHOSTUNREACH); | ||
534 | 501 | ||
535 | le = hci_conn_add(hdev, LE_LINK, dst); | 502 | le->dst_type = bdaddr_to_le(dst_type); |
536 | if (!le) | 503 | hci_le_connect(le); |
537 | return ERR_PTR(-ENOMEM); | 504 | } |
538 | |||
539 | le->dst_type = entry->bdaddr_type; | ||
540 | 505 | ||
541 | hci_le_connect(le); | 506 | le->pending_sec_level = sec_level; |
507 | le->auth_type = auth_type; | ||
542 | 508 | ||
543 | hci_conn_hold(le); | 509 | hci_conn_hold(le); |
544 | 510 | ||