diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-08-14 05:33:17 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-12-03 10:51:20 -0500 |
commit | fe8bc5ac67a36b05c4ec91643736d44373096a76 (patch) | |
tree | 325b840d4796296696e0f10a131d424bb9c63fb4 | |
parent | 70157ef5391819a55bb4186c901ac873231fb6ea (diff) |
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>
-rw-r--r-- | include/net/bluetooth/hci_core.h | 1 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 90929641d0f0..42f9362a83c1 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -559,6 +559,7 @@ enum { | |||
559 | HCI_CONN_AUTH_INITIATOR, | 559 | HCI_CONN_AUTH_INITIATOR, |
560 | HCI_CONN_DROP, | 560 | HCI_CONN_DROP, |
561 | HCI_CONN_PARAM_REMOVAL_PEND, | 561 | HCI_CONN_PARAM_REMOVAL_PEND, |
562 | HCI_CONN_NEW_LINK_KEY, | ||
562 | }; | 563 | }; |
563 | 564 | ||
564 | static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) | 565 | static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 34ecbf0b7e5b..c3d6390e3b7b 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -3249,6 +3249,8 @@ static void hci_link_key_request_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
3249 | 3249 | ||
3250 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); | 3250 | conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); |
3251 | if (conn) { | 3251 | if (conn) { |
3252 | clear_bit(HCI_CONN_NEW_LINK_KEY, &conn->flags); | ||
3253 | |||
3252 | if ((key->type == HCI_LK_UNAUTH_COMBINATION_P192 || | 3254 | if ((key->type == HCI_LK_UNAUTH_COMBINATION_P192 || |
3253 | key->type == HCI_LK_UNAUTH_COMBINATION_P256) && | 3255 | key->type == HCI_LK_UNAUTH_COMBINATION_P256) && |
3254 | conn->auth_type != 0xff && (conn->auth_type & 0x01)) { | 3256 | 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) | |||
3301 | conn->disc_timeout = HCI_DISCONN_TIMEOUT; | 3303 | conn->disc_timeout = HCI_DISCONN_TIMEOUT; |
3302 | hci_conn_drop(conn); | 3304 | hci_conn_drop(conn); |
3303 | 3305 | ||
3306 | set_bit(HCI_CONN_NEW_LINK_KEY, &conn->flags); | ||
3304 | conn_set_key(conn, ev->key_type, conn->pin_length); | 3307 | conn_set_key(conn, ev->key_type, conn->pin_length); |
3305 | 3308 | ||
3306 | if (!test_bit(HCI_MGMT, &hdev->dev_flags)) | 3309 | if (!test_bit(HCI_MGMT, &hdev->dev_flags)) |