diff options
| -rw-r--r-- | include/net/bluetooth/hci_core.h | 2 | ||||
| -rw-r--r-- | net/bluetooth/hci_conn.c | 8 | ||||
| -rw-r--r-- | net/bluetooth/l2cap.c | 19 | ||||
| -rw-r--r-- | net/bluetooth/sco.c | 2 |
4 files changed, 24 insertions, 7 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index cbf751094688..5e785b968e7e 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -325,7 +325,7 @@ int hci_conn_del(struct hci_conn *conn); | |||
| 325 | void hci_conn_hash_flush(struct hci_dev *hdev); | 325 | void hci_conn_hash_flush(struct hci_dev *hdev); |
| 326 | void hci_conn_check_pending(struct hci_dev *hdev); | 326 | void hci_conn_check_pending(struct hci_dev *hdev); |
| 327 | 327 | ||
| 328 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *src); | 328 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 auth_type); |
| 329 | int hci_conn_auth(struct hci_conn *conn); | 329 | int hci_conn_auth(struct hci_conn *conn); |
| 330 | int hci_conn_encrypt(struct hci_conn *conn); | 330 | int hci_conn_encrypt(struct hci_conn *conn); |
| 331 | int hci_conn_change_link_key(struct hci_conn *conn); | 331 | int hci_conn_change_link_key(struct hci_conn *conn); |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index ca8d05245ca0..a2f9efaa3361 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
| @@ -330,7 +330,7 @@ EXPORT_SYMBOL(hci_get_route); | |||
| 330 | 330 | ||
| 331 | /* Create SCO or ACL connection. | 331 | /* Create SCO or ACL connection. |
| 332 | * Device _must_ be locked */ | 332 | * Device _must_ be locked */ |
| 333 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst) | 333 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 auth_type) |
| 334 | { | 334 | { |
| 335 | struct hci_conn *acl; | 335 | struct hci_conn *acl; |
| 336 | struct hci_conn *sco; | 336 | struct hci_conn *sco; |
| @@ -344,8 +344,10 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst) | |||
| 344 | 344 | ||
| 345 | hci_conn_hold(acl); | 345 | hci_conn_hold(acl); |
| 346 | 346 | ||
| 347 | if (acl->state == BT_OPEN || acl->state == BT_CLOSED) | 347 | if (acl->state == BT_OPEN || acl->state == BT_CLOSED) { |
| 348 | acl->auth_type = auth_type; | ||
| 348 | hci_acl_connect(acl); | 349 | hci_acl_connect(acl); |
| 350 | } | ||
| 349 | 351 | ||
| 350 | if (type == ACL_LINK) | 352 | if (type == ACL_LINK) |
| 351 | return acl; | 353 | return acl; |
| @@ -381,7 +383,7 @@ int hci_conn_auth(struct hci_conn *conn) | |||
| 381 | 383 | ||
| 382 | if (conn->ssp_mode > 0 && conn->hdev->ssp_mode > 0) { | 384 | if (conn->ssp_mode > 0 && conn->hdev->ssp_mode > 0) { |
| 383 | if (!(conn->auth_type & 0x01)) { | 385 | if (!(conn->auth_type & 0x01)) { |
| 384 | conn->auth_type = HCI_AT_GENERAL_BONDING_MITM; | 386 | conn->auth_type |= 0x01; |
| 385 | conn->link_mode &= ~HCI_LM_AUTH; | 387 | conn->link_mode &= ~HCI_LM_AUTH; |
| 386 | } | 388 | } |
| 387 | } | 389 | } |
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 3396d5bdef1c..a96d6de80d12 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
| @@ -55,7 +55,7 @@ | |||
| 55 | #define BT_DBG(D...) | 55 | #define BT_DBG(D...) |
| 56 | #endif | 56 | #endif |
| 57 | 57 | ||
| 58 | #define VERSION "2.10" | 58 | #define VERSION "2.11" |
| 59 | 59 | ||
| 60 | static u32 l2cap_feat_mask = 0x0000; | 60 | static u32 l2cap_feat_mask = 0x0000; |
| 61 | 61 | ||
| @@ -778,6 +778,7 @@ static int l2cap_do_connect(struct sock *sk) | |||
| 778 | struct l2cap_conn *conn; | 778 | struct l2cap_conn *conn; |
| 779 | struct hci_conn *hcon; | 779 | struct hci_conn *hcon; |
| 780 | struct hci_dev *hdev; | 780 | struct hci_dev *hdev; |
| 781 | __u8 auth_type; | ||
| 781 | int err = 0; | 782 | int err = 0; |
| 782 | 783 | ||
| 783 | BT_DBG("%s -> %s psm 0x%2.2x", batostr(src), batostr(dst), l2cap_pi(sk)->psm); | 784 | BT_DBG("%s -> %s psm 0x%2.2x", batostr(src), batostr(dst), l2cap_pi(sk)->psm); |
| @@ -789,7 +790,21 @@ static int l2cap_do_connect(struct sock *sk) | |||
| 789 | 790 | ||
| 790 | err = -ENOMEM; | 791 | err = -ENOMEM; |
| 791 | 792 | ||
| 792 | hcon = hci_connect(hdev, ACL_LINK, dst); | 793 | if (l2cap_pi(sk)->link_mode & L2CAP_LM_AUTH || |
| 794 | l2cap_pi(sk)->link_mode & L2CAP_LM_ENCRYPT || | ||
| 795 | l2cap_pi(sk)->link_mode & L2CAP_LM_SECURE) { | ||
| 796 | if (l2cap_pi(sk)->psm == cpu_to_le16(0x0001)) | ||
| 797 | auth_type = HCI_AT_NO_BONDING_MITM; | ||
| 798 | else | ||
| 799 | auth_type = HCI_AT_GENERAL_BONDING_MITM; | ||
| 800 | } else { | ||
| 801 | if (l2cap_pi(sk)->psm == cpu_to_le16(0x0001)) | ||
| 802 | auth_type = HCI_AT_NO_BONDING; | ||
| 803 | else | ||
| 804 | auth_type = HCI_AT_GENERAL_BONDING; | ||
| 805 | } | ||
| 806 | |||
| 807 | hcon = hci_connect(hdev, ACL_LINK, dst, auth_type); | ||
| 793 | if (!hcon) | 808 | if (!hcon) |
| 794 | goto done; | 809 | goto done; |
| 795 | 810 | ||
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index a16011fedc1d..0cc91e6da76d 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
| @@ -200,7 +200,7 @@ static int sco_connect(struct sock *sk) | |||
| 200 | else | 200 | else |
| 201 | type = SCO_LINK; | 201 | type = SCO_LINK; |
| 202 | 202 | ||
| 203 | hcon = hci_connect(hdev, type, dst); | 203 | hcon = hci_connect(hdev, type, dst, HCI_AT_NO_BONDING); |
| 204 | if (!hcon) | 204 | if (!hcon) |
| 205 | goto done; | 205 | goto done; |
| 206 | 206 | ||
