diff options
-rw-r--r-- | include/net/bluetooth/mgmt.h | 4 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 13 |
2 files changed, 8 insertions, 9 deletions
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index 8b07a83dd94d..bfdb04bd780e 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -172,11 +172,11 @@ struct mgmt_cp_set_io_capability { | |||
172 | 172 | ||
173 | #define MGMT_OP_PAIR_DEVICE 0x0014 | 173 | #define MGMT_OP_PAIR_DEVICE 0x0014 |
174 | struct mgmt_cp_pair_device { | 174 | struct mgmt_cp_pair_device { |
175 | bdaddr_t bdaddr; | 175 | struct mgmt_addr_info addr; |
176 | __u8 io_cap; | 176 | __u8 io_cap; |
177 | } __packed; | 177 | } __packed; |
178 | struct mgmt_rp_pair_device { | 178 | struct mgmt_rp_pair_device { |
179 | bdaddr_t bdaddr; | 179 | struct mgmt_addr_info addr; |
180 | __u8 status; | 180 | __u8 status; |
181 | } __packed; | 181 | } __packed; |
182 | 182 | ||
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index bd77f54d91f7..6c924f24b3d9 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1333,7 +1333,8 @@ static void pairing_complete(struct pending_cmd *cmd, u8 status) | |||
1333 | struct mgmt_rp_pair_device rp; | 1333 | struct mgmt_rp_pair_device rp; |
1334 | struct hci_conn *conn = cmd->user_data; | 1334 | struct hci_conn *conn = cmd->user_data; |
1335 | 1335 | ||
1336 | bacpy(&rp.bdaddr, &conn->dst); | 1336 | bacpy(&rp.addr.bdaddr, &conn->dst); |
1337 | rp.addr.type = link_to_mgmt(conn->type, conn->dst_type); | ||
1337 | rp.status = status; | 1338 | rp.status = status; |
1338 | 1339 | ||
1339 | cmd_complete(cmd->sk, cmd->index, MGMT_OP_PAIR_DEVICE, &rp, sizeof(rp)); | 1340 | cmd_complete(cmd->sk, cmd->index, MGMT_OP_PAIR_DEVICE, &rp, sizeof(rp)); |
@@ -1366,7 +1367,6 @@ static int pair_device(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
1366 | struct hci_dev *hdev; | 1367 | struct hci_dev *hdev; |
1367 | struct mgmt_cp_pair_device *cp; | 1368 | struct mgmt_cp_pair_device *cp; |
1368 | struct pending_cmd *cmd; | 1369 | struct pending_cmd *cmd; |
1369 | struct adv_entry *entry; | ||
1370 | u8 sec_level, auth_type; | 1370 | u8 sec_level, auth_type; |
1371 | struct hci_conn *conn; | 1371 | struct hci_conn *conn; |
1372 | int err; | 1372 | int err; |
@@ -1390,12 +1390,11 @@ static int pair_device(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
1390 | else | 1390 | else |
1391 | auth_type = HCI_AT_DEDICATED_BONDING_MITM; | 1391 | auth_type = HCI_AT_DEDICATED_BONDING_MITM; |
1392 | 1392 | ||
1393 | entry = hci_find_adv_entry(hdev, &cp->bdaddr); | 1393 | if (cp->addr.type == MGMT_ADDR_BREDR) |
1394 | if (entry) | 1394 | conn = hci_connect(hdev, ACL_LINK, &cp->addr.bdaddr, sec_level, |
1395 | conn = hci_connect(hdev, LE_LINK, &cp->bdaddr, sec_level, | ||
1396 | auth_type); | 1395 | auth_type); |
1397 | else | 1396 | else |
1398 | conn = hci_connect(hdev, ACL_LINK, &cp->bdaddr, sec_level, | 1397 | conn = hci_connect(hdev, LE_LINK, &cp->addr.bdaddr, sec_level, |
1399 | auth_type); | 1398 | auth_type); |
1400 | 1399 | ||
1401 | if (IS_ERR(conn)) { | 1400 | if (IS_ERR(conn)) { |
@@ -1417,7 +1416,7 @@ static int pair_device(struct sock *sk, u16 index, unsigned char *data, u16 len) | |||
1417 | } | 1416 | } |
1418 | 1417 | ||
1419 | /* For LE, just connecting isn't a proof that the pairing finished */ | 1418 | /* For LE, just connecting isn't a proof that the pairing finished */ |
1420 | if (!entry) | 1419 | if (cp->addr.type == MGMT_ADDR_BREDR) |
1421 | conn->connect_cfm_cb = pairing_complete_cb; | 1420 | conn->connect_cfm_cb = pairing_complete_cb; |
1422 | 1421 | ||
1423 | conn->security_cfm_cb = pairing_complete_cb; | 1422 | conn->security_cfm_cb = pairing_complete_cb; |