Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 290893
b: refs/heads/master
c: aa64a8b
h: refs/heads/master
i:
  290891: 388e97f
v: v3
  • Loading branch information
Johan Hedberg committed Feb 13, 2012
1 parent b2f1b5b commit ae4a2c1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 84bde9d6c0e6830f4a8685a5d237965053118bf9
refs/heads/master: aa64a8b500e61c33c17f1d5e7de0cc154489c59e
7 changes: 7 additions & 0 deletions trunk/include/net/bluetooth/hci_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,13 @@ enum {
HCI_CONN_REMOTE_OOB,
};

static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
{
struct hci_dev *hdev = conn->hdev;
return (test_bit(HCI_SSP_ENABLED, &hdev->flags) &&
test_bit(HCI_CONN_SSP_ENABLED, &conn->flags));
}

static inline void hci_conn_hash_init(struct hci_dev *hdev)
{
struct hci_conn_hash *h = &hdev->conn_hash;
Expand Down
8 changes: 2 additions & 6 deletions trunk/net/bluetooth/hci_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,7 @@ int hci_conn_check_link_mode(struct hci_conn *conn)
{
BT_DBG("conn %p", conn);

if (test_bit(HCI_CONN_SSP_ENABLED, &conn->flags) &&
test_bit(HCI_SSP_ENABLED, &conn->hdev->dev_flags) &&
!(conn->link_mode & HCI_LM_ENCRYPT))
if (hci_conn_ssp_enabled(conn) && !(conn->link_mode & HCI_LM_ENCRYPT))
return 0;

return 1;
Expand Down Expand Up @@ -672,9 +670,7 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)

/* For non 2.1 devices and low security level we don't need the link
key. */
if (sec_level == BT_SECURITY_LOW &&
(!test_bit(HCI_CONN_SSP_ENABLED, &conn->flags) ||
!test_bit(HCI_SSP_ENABLED, &conn->hdev->dev_flags)))
if (sec_level == BT_SECURITY_LOW && !hci_conn_ssp_enabled(conn))
return 1;

/* For other security levels we need the link key. */
Expand Down
12 changes: 4 additions & 8 deletions trunk/net/bluetooth/hci_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1270,8 +1270,7 @@ static int hci_outgoing_auth_needed(struct hci_dev *hdev,

/* Only request authentication for SSP connections or non-SSP
* devices with sec_level HIGH or if MITM protection is requested */
if (!(test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) &&
test_bit(HCI_CONN_SSP_ENABLED, &conn->flags)) &&
if (!hci_conn_ssp_enabled(conn) &&
conn->pending_sec_level != BT_SECURITY_HIGH &&
!(conn->auth_type & 0x01))
return 0;
Expand Down Expand Up @@ -1845,9 +1844,8 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
goto unlock;

if (!ev->status) {
if (!(test_bit(HCI_CONN_SSP_ENABLED, &conn->flags) &&
test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) &&
test_bit(HCI_CONN_REAUTH_PEND, &conn->flags)) {
if (!hci_conn_ssp_enabled(conn) &&
test_bit(HCI_CONN_REAUTH_PEND, &conn->flags)) {
BT_INFO("re-auth of legacy device is not possible.");
} else {
conn->link_mode |= HCI_LM_AUTH;
Expand All @@ -1861,9 +1859,7 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
clear_bit(HCI_CONN_REAUTH_PEND, &conn->flags);

if (conn->state == BT_CONFIG) {
if (!ev->status &&
test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) &&
test_bit(HCI_CONN_SSP_ENABLED, &conn->flags)) {
if (!ev->status && hci_conn_ssp_enabled(conn)) {
struct hci_cp_set_conn_encrypt cp;
cp.handle = ev->handle;
cp.encrypt = 0x01;
Expand Down

0 comments on commit ae4a2c1

Please sign in to comment.