Bluetooth: Set filter policy for LE connection 31/261631/1
authorSudha Bheemanna <b.sudha@samsung.com>
Thu, 8 Sep 2016 05:51:06 +0000 (11:21 +0530)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 21 Jul 2021 05:07:33 +0000 (14:07 +0900)
This patch sets the filter policy to a default value 0x01 during
LE auto connection if the destination address is not set. And it
updates the destination address once the LE connection complete
event is recieved during LE auto connection. And for it checks
valid destination address before cancelling LE connection when
connection timeout occurs.

Change-Id: I9877556c0b0ab4826f5f4934ead4d85b7837036d
Signed-off-by: Sudha Bheemanna <b.sudha@samsung.com>
[squash patches, LE connection policy, set dest address and check dest address before cancelling connection]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
net/bluetooth/hci_conn.c
net/bluetooth/hci_event.c
net/bluetooth/hci_request.c

index 074c8f1b8b26829dc8fafeae5b12fb973dbee9a5..76fd9761e7564015e92243ec60335856783dada6 100644 (file)
@@ -802,7 +802,15 @@ static void hci_req_add_le_create_conn(struct hci_request *req,
        cp.scan_interval = cpu_to_le16(hdev->le_scan_interval);
        cp.scan_window = cp.scan_interval;
 
+#ifdef TIZEN_BT
+       /* LE auto connect */
+       if (!bacmp(&conn->dst, BDADDR_ANY))
+               cp.filter_policy = 0x1;
+       else
+               bacpy(&cp.peer_addr, &conn->dst);
+#else
        bacpy(&cp.peer_addr, &conn->dst);
+#endif
        cp.peer_addr_type = conn->dst_type;
        cp.own_address_type = own_addr_type;
        cp.conn_interval_min = cpu_to_le16(conn->le_conn_min_interval);
index aff18552741b59ac04285f1b502d4385254b13e9..f4c36763fd01772adf87cde98876cdd2f2b080c6 100644 (file)
@@ -4657,6 +4657,10 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
                        }
                }
        } else {
+#ifdef TIZEN_BT
+               /* LE auto connect */
+               bacpy(&conn->dst, &ev->bdaddr);
+#endif
                cancel_delayed_work(&conn->le_conn_timeout);
        }
 
index 3c4ca4b018b9c31193edc7091e7fd3a0f7a7f177..876363f8c4fae269a3ff3c3fce2e12d2e1493125 100644 (file)
@@ -1751,7 +1751,11 @@ void __hci_abort_conn(struct hci_request *req, struct hci_conn *conn,
 
                break;
        case BT_CONNECT:
+#ifdef TIZEN_BT
+               if (conn->type == LE_LINK && bacmp(&conn->dst, BDADDR_ANY)) {
+#else
                if (conn->type == LE_LINK) {
+#endif
                        if (test_bit(HCI_CONN_SCANNING, &conn->flags))
                                break;
                        hci_req_add(req, HCI_OP_LE_CREATE_CONN_CANCEL,