|
@@ -445,7 +445,7 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth,
|
|
|
* Confirms and the slave Enters the passkey.
|
|
|
*/
|
|
|
if (method == OVERLAP) {
|
|
|
- if (test_bit(HCI_CONN_MASTER, &hcon->flags))
|
|
|
+ if (hcon->role == HCI_ROLE_MASTER)
|
|
|
method = CFM_PASSKEY;
|
|
|
else
|
|
|
method = REQ_PASSKEY;
|
|
@@ -686,7 +686,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
|
|
|
if (skb->len < sizeof(*req))
|
|
|
return SMP_INVALID_PARAMS;
|
|
|
|
|
|
- if (test_bit(HCI_CONN_MASTER, &conn->hcon->flags))
|
|
|
+ if (conn->hcon->role != HCI_ROLE_SLAVE)
|
|
|
return SMP_CMD_NOTSUPP;
|
|
|
|
|
|
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)
|
|
|
if (skb->len < sizeof(*rsp))
|
|
|
return SMP_INVALID_PARAMS;
|
|
|
|
|
|
- if (!test_bit(HCI_CONN_MASTER, &conn->hcon->flags))
|
|
|
+ if (conn->hcon->role != HCI_ROLE_MASTER)
|
|
|
return SMP_CMD_NOTSUPP;
|
|
|
|
|
|
skb_pull(skb, sizeof(*rsp));
|
|
@@ -903,7 +903,7 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
|
|
|
if (skb->len < sizeof(*rp))
|
|
|
return SMP_INVALID_PARAMS;
|
|
|
|
|
|
- if (!test_bit(HCI_CONN_MASTER, &conn->hcon->flags))
|
|
|
+ if (hcon->role != HCI_ROLE_MASTER)
|
|
|
return SMP_CMD_NOTSUPP;
|
|
|
|
|
|
sec_level = authreq_to_seclevel(rp->auth_req);
|
|
@@ -961,7 +961,7 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level)
|
|
|
if (sec_level > hcon->pending_sec_level)
|
|
|
hcon->pending_sec_level = sec_level;
|
|
|
|
|
|
- if (test_bit(HCI_CONN_MASTER, &hcon->flags))
|
|
|
+ if (hcon->role == HCI_ROLE_MASTER)
|
|
|
if (smp_ltk_encrypt(conn, hcon->pending_sec_level))
|
|
|
return 0;
|
|
|
|
|
@@ -981,7 +981,7 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level)
|
|
|
hcon->pending_sec_level > BT_SECURITY_MEDIUM)
|
|
|
authreq |= SMP_AUTH_MITM;
|
|
|
|
|
|
- if (test_bit(HCI_CONN_MASTER, &hcon->flags)) {
|
|
|
+ if (hcon->role == HCI_ROLE_MASTER) {
|
|
|
struct smp_cmd_pairing cp;
|
|
|
|
|
|
build_pairing_cmd(conn, &cp, NULL, authreq);
|