diff mbox series

Bluetooth: Enable LE Enhanced Connection Complete event.

Message ID 20200407232523.1013507-1-marcel@holtmann.org (mailing list archive)
State Superseded
Delegated to: Marcel Holtmann
Headers show
Series Bluetooth: Enable LE Enhanced Connection Complete event. | expand

Commit Message

Marcel Holtmann April 7, 2020, 11:25 p.m. UTC
In case LL Privacy is supported by the controller, it is also a good
idea to use the LE Enhanced Connection Complete event for getting all
information about the new connection and its addresses.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
 net/bluetooth/hci_core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Marcel Holtmann April 8, 2020, 6:30 a.m. UTC | #1
Hi,

> In case LL Privacy is supported by the controller, it is also a good
> idea to use the LE Enhanced Connection Complete event for getting all
> information about the new connection and its addresses.
> 
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/hci_core.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
> 
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index fb210f7ab7ab..d8d543e3dc9f 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -638,6 +638,14 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
> 		if (hdev->le_features[0] & HCI_LE_DATA_LEN_EXT)
> 			events[0] |= 0x40;	/* LE Data Length Change */
> 
> +		/* If the controller supports LL Privacy feature, enable
> +		 * the corresponding event.
> +		 */
> +		if (hdev->le_features[0] & HCI_LE_LL_PRIVACY)
> +			events[1] |= 0x02;	/* LE Enhanced Connection
> +						 * Complete
> +						 */
> +

so this is sort of enough to get the events, but they don’t give any extra information if LL Privacy is not used. While the current code handles the non LL Privacy parts of this event, the important local RPA and peer RPA are not handled.

Both RPAs (if used) however need to be stored in hci_conn so that SMP can make use of them if needed.

Regards

Marcel
diff mbox series

Patch

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index fb210f7ab7ab..d8d543e3dc9f 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -638,6 +638,14 @@  static int hci_init3_req(struct hci_request *req, unsigned long opt)
 		if (hdev->le_features[0] & HCI_LE_DATA_LEN_EXT)
 			events[0] |= 0x40;	/* LE Data Length Change */
 
+		/* If the controller supports LL Privacy feature, enable
+		 * the corresponding event.
+		 */
+		if (hdev->le_features[0] & HCI_LE_LL_PRIVACY)
+			events[1] |= 0x02;	/* LE Enhanced Connection
+						 * Complete
+						 */
+
 		/* If the controller supports Extended Scanner Filter
 		 * Policies, enable the correspondig event.
 		 */