aboutsummaryrefslogtreecommitdiff
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorGravatar Andre Guedes <andre.guedes@openbossa.org> 2014-02-26 20:21:45 -0300
committerGravatar Marcel Holtmann <marcel@holtmann.org> 2014-02-26 19:41:34 -0800
commit6f77d8c757523f675679d845ff0e15d3276a168a (patch)
tree69ad7cf050bdfa281610c5098b33ac9beff410ac /net/bluetooth/mgmt.c
parentBluetooth: Refactor HCI connection code (diff)
downloadlinux-6f77d8c757523f675679d845ff0e15d3276a168a.tar.gz
linux-6f77d8c757523f675679d845ff0e15d3276a168a.tar.bz2
linux-6f77d8c757523f675679d845ff0e15d3276a168a.zip
Bluetooth: Move address type conversion to outside hci_connect_le
This patch moves address type conversion (L2CAP address type to HCI address type) to outside hci_connect_le. This way, we avoid back and forth address type conversion in a comming patch. So hci_connect_le() now expects 'dst_type' parameter in HCI address type convention. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 9fc7c1d9fcbb..bad23d5fdd35 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2815,12 +2815,22 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
else
auth_type = HCI_AT_DEDICATED_BONDING_MITM;
- if (cp->addr.type == BDADDR_BREDR)
+ if (cp->addr.type == BDADDR_BREDR) {
conn = hci_connect_acl(hdev, &cp->addr.bdaddr, sec_level,
auth_type);
- else
- conn = hci_connect_le(hdev, &cp->addr.bdaddr, cp->addr.type,
+ } else {
+ u8 addr_type;
+
+ /* Convert from L2CAP channel address type to HCI address type
+ */
+ if (cp->addr.type == BDADDR_LE_PUBLIC)
+ addr_type = ADDR_LE_DEV_PUBLIC;
+ else
+ addr_type = ADDR_LE_DEV_RANDOM;
+
+ conn = hci_connect_le(hdev, &cp->addr.bdaddr, addr_type,
sec_level, auth_type);
+ }
if (IS_ERR(conn)) {
int status;