diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-07-16 04:42:27 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-07-16 05:04:23 -0400 |
commit | 40bef302f6323d1ee6fb3dc0e62edb0f446d0339 (patch) | |
tree | 2b77646a8adf90560b66e7f72df64ab4cc76240e /net/bluetooth/smp.c | |
parent | ba165a90b59812ab1d9cd2943fd104cfc25c601e (diff) |
Bluetooth: Convert HCI_CONN_MASTER flag to a conn->role variable
Having a dedicated u8 role variable in the hci_conn struct greatly
simplifies tracking of the role, since this is the native way that it's
represented on the HCI level.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/smp.c')
-rw-r--r-- | net/bluetooth/smp.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 8339d6b0f2b8..78eeb8b5970a 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -445,7 +445,7 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth, | |||
445 | * Confirms and the slave Enters the passkey. | 445 | * Confirms and the slave Enters the passkey. |
446 | */ | 446 | */ |
447 | if (method == OVERLAP) { | 447 | if (method == OVERLAP) { |
448 | if (test_bit(HCI_CONN_MASTER, &hcon->flags)) | 448 | if (hcon->role == HCI_ROLE_MASTER) |
449 | method = CFM_PASSKEY; | 449 | method = CFM_PASSKEY; |
450 | else | 450 | else |
451 | method = REQ_PASSKEY; | 451 | method = REQ_PASSKEY; |
@@ -686,7 +686,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
686 | if (skb->len < sizeof(*req)) | 686 | if (skb->len < sizeof(*req)) |
687 | return SMP_INVALID_PARAMS; | 687 | return SMP_INVALID_PARAMS; |
688 | 688 | ||
689 | if (test_bit(HCI_CONN_MASTER, &conn->hcon->flags)) | 689 | if (conn->hcon->role != HCI_ROLE_SLAVE) |
690 | return SMP_CMD_NOTSUPP; | 690 | return SMP_CMD_NOTSUPP; |
691 | 691 | ||
692 | if (!test_and_set_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags)) | 692 | if (!test_and_set_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags)) |
@@ -755,7 +755,7 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb) | |||
755 | if (skb->len < sizeof(*rsp)) | 755 | if (skb->len < sizeof(*rsp)) |
756 | return SMP_INVALID_PARAMS; | 756 | return SMP_INVALID_PARAMS; |
757 | 757 | ||
758 | if (!test_bit(HCI_CONN_MASTER, &conn->hcon->flags)) | 758 | if (conn->hcon->role != HCI_ROLE_MASTER) |
759 | return SMP_CMD_NOTSUPP; | 759 | return SMP_CMD_NOTSUPP; |
760 | 760 | ||
761 | skb_pull(skb, sizeof(*rsp)); | 761 | skb_pull(skb, sizeof(*rsp)); |
@@ -903,7 +903,7 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
903 | if (skb->len < sizeof(*rp)) | 903 | if (skb->len < sizeof(*rp)) |
904 | return SMP_INVALID_PARAMS; | 904 | return SMP_INVALID_PARAMS; |
905 | 905 | ||
906 | if (!test_bit(HCI_CONN_MASTER, &conn->hcon->flags)) | 906 | if (hcon->role != HCI_ROLE_MASTER) |
907 | return SMP_CMD_NOTSUPP; | 907 | return SMP_CMD_NOTSUPP; |
908 | 908 | ||
909 | sec_level = authreq_to_seclevel(rp->auth_req); | 909 | sec_level = authreq_to_seclevel(rp->auth_req); |
@@ -961,7 +961,7 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) | |||
961 | if (sec_level > hcon->pending_sec_level) | 961 | if (sec_level > hcon->pending_sec_level) |
962 | hcon->pending_sec_level = sec_level; | 962 | hcon->pending_sec_level = sec_level; |
963 | 963 | ||
964 | if (test_bit(HCI_CONN_MASTER, &hcon->flags)) | 964 | if (hcon->role == HCI_ROLE_MASTER) |
965 | if (smp_ltk_encrypt(conn, hcon->pending_sec_level)) | 965 | if (smp_ltk_encrypt(conn, hcon->pending_sec_level)) |
966 | return 0; | 966 | return 0; |
967 | 967 | ||
@@ -981,7 +981,7 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) | |||
981 | hcon->pending_sec_level > BT_SECURITY_MEDIUM) | 981 | hcon->pending_sec_level > BT_SECURITY_MEDIUM) |
982 | authreq |= SMP_AUTH_MITM; | 982 | authreq |= SMP_AUTH_MITM; |
983 | 983 | ||
984 | if (test_bit(HCI_CONN_MASTER, &hcon->flags)) { | 984 | if (hcon->role == HCI_ROLE_MASTER) { |
985 | struct smp_cmd_pairing cp; | 985 | struct smp_cmd_pairing cp; |
986 | 986 | ||
987 | build_pairing_cmd(conn, &cp, NULL, authreq); | 987 | build_pairing_cmd(conn, &cp, NULL, authreq); |