Skip to content

Commit fe8bc5a

Browse files
jhedbergholtmann
authored andcommitted
Bluetooth: Add hci_conn flag for new link key generation
For LE Secure Connections we want to trigger cross transport key generation only if a new link key was actually created during the BR/EDR connection. This patch adds a new flag to track this information. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 70157ef commit fe8bc5a

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎include/net/bluetooth/hci_core.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ enum {
559559
HCI_CONN_AUTH_INITIATOR,
560560
HCI_CONN_DROP,
561561
HCI_CONN_PARAM_REMOVAL_PEND,
562+
HCI_CONN_NEW_LINK_KEY,
562563
};
563564

564565
static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)

‎net/bluetooth/hci_event.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3249,6 +3249,8 @@ static void hci_link_key_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
32493249

32503250
conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr);
32513251
if (conn) {
3252+
clear_bit(HCI_CONN_NEW_LINK_KEY, &conn->flags);
3253+
32523254
if ((key->type == HCI_LK_UNAUTH_COMBINATION_P192 ||
32533255
key->type == HCI_LK_UNAUTH_COMBINATION_P256) &&
32543256
conn->auth_type != 0xff && (conn->auth_type & 0x01)) {
@@ -3301,6 +3303,7 @@ static void hci_link_key_notify_evt(struct hci_dev *hdev, struct sk_buff *skb)
33013303
conn->disc_timeout = HCI_DISCONN_TIMEOUT;
33023304
hci_conn_drop(conn);
33033305

3306+
set_bit(HCI_CONN_NEW_LINK_KEY, &conn->flags);
33043307
conn_set_key(conn, ev->key_type, conn->pin_length);
33053308

33063309
if (!test_bit(HCI_MGMT, &hdev->dev_flags))

0 commit comments

Comments
 (0)