]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
Bluetooth: Enable new connection establishment procedure.
authorJakub Pawlowski <jpawlowski@google.com>
Fri, 7 Aug 2015 18:22:56 +0000 (20:22 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 10 Aug 2015 19:36:13 +0000 (21:36 +0200)
Currently, when trying to connect to already paired device that just
rotated its RPA MAC address, old address would be used and connection
would fail. In order to fix that, kernel must scan and receive
advertisement with fresh RPA before connecting.

This patch enables new connection establishment procedure. Instead of just
sending HCI_OP_LE_CREATE_CONN to controller, "connect" will add device to
kernel whitelist and start scan. If advertisement is received, it'll be
compared against whitelist and then trigger connection if it matches.
That fixes mentioned reconnect issue for  already paired devices. It also
make whole connection procedure more robust. We can try to connect to
multiple devices at same time now, even though controller allow only one.

Signed-off-by: Jakub Pawlowski <jpawlowski@google.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/l2cap_core.c
net/bluetooth/mgmt.c

index 45fffa4136421b8dd5ab301cf0a4ec529b36ff8e..7c65ee200c29215c6b3f050cfbb881873be4946a 100644 (file)
@@ -7113,8 +7113,10 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
                else
                        role = HCI_ROLE_MASTER;
 
-               hcon = hci_connect_le(hdev, dst, dst_type, chan->sec_level,
-                                     HCI_LE_CONN_TIMEOUT, role);
+               hcon = hci_connect_le_scan(hdev, dst, dst_type,
+                                          chan->sec_level,
+                                          HCI_LE_CONN_TIMEOUT,
+                                          role);
        } else {
                u8 auth_type = l2cap_get_auth_type(chan);
                hcon = hci_connect_acl(hdev, dst, chan->sec_level, auth_type);
index 5f5d7851f5bf2ed667e78e7c5dc33762a468a4e1..3a15f0964fabbdee7e802619bfda9bd15adba542 100644 (file)
@@ -3564,9 +3564,10 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
                 */
                hci_conn_params_add(hdev, &cp->addr.bdaddr, addr_type);
 
-               conn = hci_connect_le(hdev, &cp->addr.bdaddr, addr_type,
-                                     sec_level, HCI_LE_CONN_TIMEOUT,
-                                     HCI_ROLE_MASTER);
+               conn = hci_connect_le_scan(hdev, &cp->addr.bdaddr,
+                                          addr_type, sec_level,
+                                          HCI_LE_CONN_TIMEOUT,
+                                          HCI_ROLE_MASTER);
        }
 
        if (IS_ERR(conn)) {