aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-07-17 08:35:39 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-07-17 08:39:40 -0400
commit977f8fce0279e5f96dc5c5068610d60b9ae94802 (patch)
treeb2a84081d8c112589b06ac044a78b955b2b8becd /net
parente7cafc45258c852c5176cd421615846e79a3d307 (diff)
Bluetooth: Introduce a flag to track who really initiates authentication
Even though our side requests authentication, the original action that caused it may be remotely triggered, such as an incoming L2CAP or RFCOMM connect request. To track this information introduce a new hci_conn flag called HCI_CONN_AUTH_INITIATOR. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_conn.c3
-rw-r--r--net/bluetooth/hci_event.c5
2 files changed, 8 insertions, 0 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 76c5a38e5997..0d76054efd26 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1027,6 +1027,9 @@ auth:
1027 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) 1027 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
1028 return 0; 1028 return 0;
1029 1029
1030 if (initiator)
1031 set_bit(HCI_CONN_AUTH_INITIATOR, &conn->flags);
1032
1030 if (!hci_conn_auth(conn, sec_level, auth_type)) 1033 if (!hci_conn_auth(conn, sec_level, auth_type))
1031 return 0; 1034 return 0;
1032 1035
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 495d6d5c1146..af2cdca03d73 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1645,6 +1645,8 @@ static void hci_cs_remote_name_req(struct hci_dev *hdev, __u8 status)
1645 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) { 1645 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) {
1646 struct hci_cp_auth_requested auth_cp; 1646 struct hci_cp_auth_requested auth_cp;
1647 1647
1648 set_bit(HCI_CONN_AUTH_INITIATOR, &conn->flags);
1649
1648 auth_cp.handle = __cpu_to_le16(conn->handle); 1650 auth_cp.handle = __cpu_to_le16(conn->handle);
1649 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, 1651 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED,
1650 sizeof(auth_cp), &auth_cp); 1652 sizeof(auth_cp), &auth_cp);
@@ -2387,6 +2389,9 @@ check_auth:
2387 2389
2388 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) { 2390 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->flags)) {
2389 struct hci_cp_auth_requested cp; 2391 struct hci_cp_auth_requested cp;
2392
2393 set_bit(HCI_CONN_AUTH_INITIATOR, &conn->flags);
2394
2390 cp.handle = __cpu_to_le16(conn->handle); 2395 cp.handle = __cpu_to_le16(conn->handle);
2391 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp); 2396 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp);
2392 } 2397 }