diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-06-24 10:03:50 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-07-03 11:42:46 -0400 |
commit | 4dae27983eaaee15c6867561eb2c8d7b2d28d6cc (patch) | |
tree | 5081f92ee6b9cb7f28bfc446b5bf194f82680a3b /net | |
parent | 985d904902681d736924afe3f4dae212c0e5f6a4 (diff) |
Bluetooth: Convert hci_conn->link_mode into flags
Since the link_mode member of the hci_conn struct is a bit field and we
already have a flags member as well it makes sense to merge these two
together. This patch moves all used link_mode bits into corresponding
flags. To keep backwards compatibility with user space we still need to
provide a get_link_mode() helper function for the ioctl's that expect a
link_mode style value.
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.c | 43 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 28 | ||||
-rw-r--r-- | net/bluetooth/l2cap_core.c | 4 | ||||
-rw-r--r-- | net/bluetooth/smp.c | 12 |
4 files changed, 55 insertions, 32 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index a7a27bc2c0b1..626160c37103 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -67,7 +67,7 @@ static void hci_acl_create_connection(struct hci_conn *conn) | |||
67 | conn->state = BT_CONNECT; | 67 | conn->state = BT_CONNECT; |
68 | conn->out = true; | 68 | conn->out = true; |
69 | 69 | ||
70 | conn->link_mode = HCI_LM_MASTER; | 70 | set_bit(HCI_CONN_MASTER, &conn->flags); |
71 | 71 | ||
72 | conn->attempt++; | 72 | conn->attempt++; |
73 | 73 | ||
@@ -743,7 +743,7 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, | |||
743 | } | 743 | } |
744 | 744 | ||
745 | conn->out = true; | 745 | conn->out = true; |
746 | conn->link_mode |= HCI_LM_MASTER; | 746 | set_bit(HCI_CONN_MASTER, &conn->flags); |
747 | 747 | ||
748 | params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); | 748 | params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); |
749 | if (params) { | 749 | if (params) { |
@@ -865,7 +865,8 @@ int hci_conn_check_link_mode(struct hci_conn *conn) | |||
865 | return 0; | 865 | return 0; |
866 | } | 866 | } |
867 | 867 | ||
868 | if (hci_conn_ssp_enabled(conn) && !(conn->link_mode & HCI_LM_ENCRYPT)) | 868 | if (hci_conn_ssp_enabled(conn) && |
869 | !test_bit(HCI_CONN_ENCRYPT, &conn->flags)) | ||
869 | return 0; | 870 | return 0; |
870 | 871 | ||
871 | return 1; | 872 | return 1; |
@@ -881,7 +882,7 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) | |||
881 | 882 | ||
882 | if (sec_level > conn->sec_level) | 883 | if (sec_level > conn->sec_level) |
883 | conn->pending_sec_level = sec_level; | 884 | conn->pending_sec_level = sec_level; |
884 | else if (conn->link_mode & HCI_LM_AUTH) | 885 | else if (test_bit(HCI_CONN_AUTH, &conn->flags)) |
885 | return 1; | 886 | return 1; |
886 | 887 | ||
887 | /* Make sure we preserve an existing MITM requirement*/ | 888 | /* Make sure we preserve an existing MITM requirement*/ |
@@ -899,7 +900,7 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) | |||
899 | /* If we're already encrypted set the REAUTH_PEND flag, | 900 | /* If we're already encrypted set the REAUTH_PEND flag, |
900 | * otherwise set the ENCRYPT_PEND. | 901 | * otherwise set the ENCRYPT_PEND. |
901 | */ | 902 | */ |
902 | if (conn->link_mode & HCI_LM_ENCRYPT) | 903 | if (test_bit(HCI_CONN_ENCRYPT, &conn->flags)) |
903 | set_bit(HCI_CONN_REAUTH_PEND, &conn->flags); | 904 | set_bit(HCI_CONN_REAUTH_PEND, &conn->flags); |
904 | else | 905 | else |
905 | set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); | 906 | set_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); |
@@ -940,7 +941,7 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) | |||
940 | return 1; | 941 | return 1; |
941 | 942 | ||
942 | /* For other security levels we need the link key. */ | 943 | /* For other security levels we need the link key. */ |
943 | if (!(conn->link_mode & HCI_LM_AUTH)) | 944 | if (!test_bit(HCI_CONN_AUTH, &conn->flags)) |
944 | goto auth; | 945 | goto auth; |
945 | 946 | ||
946 | /* An authenticated FIPS approved combination key has sufficient | 947 | /* An authenticated FIPS approved combination key has sufficient |
@@ -980,7 +981,7 @@ auth: | |||
980 | return 0; | 981 | return 0; |
981 | 982 | ||
982 | encrypt: | 983 | encrypt: |
983 | if (conn->link_mode & HCI_LM_ENCRYPT) | 984 | if (test_bit(HCI_CONN_ENCRYPT, &conn->flags)) |
984 | return 1; | 985 | return 1; |
985 | 986 | ||
986 | hci_conn_encrypt(conn); | 987 | hci_conn_encrypt(conn); |
@@ -1027,7 +1028,7 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role) | |||
1027 | { | 1028 | { |
1028 | BT_DBG("hcon %p", conn); | 1029 | BT_DBG("hcon %p", conn); |
1029 | 1030 | ||
1030 | if (!role && conn->link_mode & HCI_LM_MASTER) | 1031 | if (!role && test_bit(HCI_CONN_MASTER, &conn->flags)) |
1031 | return 1; | 1032 | return 1; |
1032 | 1033 | ||
1033 | if (!test_and_set_bit(HCI_CONN_RSWITCH_PEND, &conn->flags)) { | 1034 | if (!test_and_set_bit(HCI_CONN_RSWITCH_PEND, &conn->flags)) { |
@@ -1101,6 +1102,28 @@ void hci_conn_check_pending(struct hci_dev *hdev) | |||
1101 | hci_dev_unlock(hdev); | 1102 | hci_dev_unlock(hdev); |
1102 | } | 1103 | } |
1103 | 1104 | ||
1105 | static u32 get_link_mode(struct hci_conn *conn) | ||
1106 | { | ||
1107 | u32 link_mode = 0; | ||
1108 | |||
1109 | if (test_bit(HCI_CONN_MASTER, &conn->flags)) | ||
1110 | link_mode |= HCI_LM_MASTER; | ||
1111 | |||
1112 | if (test_bit(HCI_CONN_ENCRYPT, &conn->flags)) | ||
1113 | link_mode |= HCI_LM_ENCRYPT; | ||
1114 | |||
1115 | if (test_bit(HCI_CONN_AUTH, &conn->flags)) | ||
1116 | link_mode |= HCI_LM_AUTH; | ||
1117 | |||
1118 | if (test_bit(HCI_CONN_SECURE, &conn->flags)) | ||
1119 | link_mode |= HCI_LM_SECURE; | ||
1120 | |||
1121 | if (test_bit(HCI_CONN_FIPS, &conn->flags)) | ||
1122 | link_mode |= HCI_LM_FIPS; | ||
1123 | |||
1124 | return link_mode; | ||
1125 | } | ||
1126 | |||
1104 | int hci_get_conn_list(void __user *arg) | 1127 | int hci_get_conn_list(void __user *arg) |
1105 | { | 1128 | { |
1106 | struct hci_conn *c; | 1129 | struct hci_conn *c; |
@@ -1136,7 +1159,7 @@ int hci_get_conn_list(void __user *arg) | |||
1136 | (ci + n)->type = c->type; | 1159 | (ci + n)->type = c->type; |
1137 | (ci + n)->out = c->out; | 1160 | (ci + n)->out = c->out; |
1138 | (ci + n)->state = c->state; | 1161 | (ci + n)->state = c->state; |
1139 | (ci + n)->link_mode = c->link_mode; | 1162 | (ci + n)->link_mode = get_link_mode(c); |
1140 | if (++n >= req.conn_num) | 1163 | if (++n >= req.conn_num) |
1141 | break; | 1164 | break; |
1142 | } | 1165 | } |
@@ -1172,7 +1195,7 @@ int hci_get_conn_info(struct hci_dev *hdev, void __user *arg) | |||
1172 | ci.type = conn->type; | 1195 | ci.type = conn->type; |
1173 | ci.out = conn->out; | 1196 | ci.out = conn->out; |
1174 | ci.state = conn->state; | 1197 | ci.state = conn->state; |
1175 | ci.link_mode = conn->link_mode; | 1198 | ci.link_mode = get_link_mode(conn); |
1176 | } | 1199 | } |
1177 | hci_dev_unlock(hdev); | 1200 | hci_dev_unlock(hdev); |
1178 | 1201 | ||
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 90cba6a8293b..7a23324eac39 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -103,9 +103,9 @@ static void hci_cc_role_discovery(struct hci_dev *hdev, struct sk_buff *skb) | |||
103 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); | 103 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle)); |
104 | if (conn) { | 104 | if (conn) { |
105 | if (rp->role) | 105 | if (rp->role) |
106 | conn->link_mode &= ~HCI_LM_MASTER; | 106 | clear_bit(HCI_CONN_MASTER, &conn->flags); |
107 | else | 107 | else |
108 | conn->link_mode |= HCI_LM_MASTER; | 108 | set_bit(HCI_CONN_MASTER, &conn->flags); |
109 | } | 109 | } |
110 | 110 | ||
111 | hci_dev_unlock(hdev); | 111 | hci_dev_unlock(hdev); |
@@ -1346,7 +1346,7 @@ static void hci_cs_create_conn(struct hci_dev *hdev, __u8 status) | |||
1346 | conn = hci_conn_add(hdev, ACL_LINK, &cp->bdaddr); | 1346 | conn = hci_conn_add(hdev, ACL_LINK, &cp->bdaddr); |
1347 | if (conn) { | 1347 | if (conn) { |
1348 | conn->out = true; | 1348 | conn->out = true; |
1349 | conn->link_mode |= HCI_LM_MASTER; | 1349 | set_bit(HCI_CONN_MASTER, &conn->flags); |
1350 | } else | 1350 | } else |
1351 | BT_ERR("No memory for new connection"); | 1351 | BT_ERR("No memory for new connection"); |
1352 | } | 1352 | } |
@@ -1989,10 +1989,10 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
1989 | hci_conn_add_sysfs(conn); | 1989 | hci_conn_add_sysfs(conn); |
1990 | 1990 | ||
1991 | if (test_bit(HCI_AUTH, &hdev->flags)) | 1991 | if (test_bit(HCI_AUTH, &hdev->flags)) |
1992 | conn->link_mode |= HCI_LM_AUTH; | 1992 | set_bit(HCI_CONN_AUTH, &conn->flags); |
1993 | 1993 | ||
1994 | if (test_bit(HCI_ENCRYPT, &hdev->flags)) | 1994 | if (test_bit(HCI_ENCRYPT, &hdev->flags)) |
1995 | conn->link_mode |= HCI_LM_ENCRYPT; | 1995 | set_bit(HCI_CONN_ENCRYPT, &conn->flags); |
1996 | 1996 | ||
1997 | /* Get remote features */ | 1997 | /* Get remote features */ |
1998 | if (conn->type == ACL_LINK) { | 1998 | if (conn->type == ACL_LINK) { |
@@ -2220,7 +2220,7 @@ static void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2220 | test_bit(HCI_CONN_REAUTH_PEND, &conn->flags)) { | 2220 | test_bit(HCI_CONN_REAUTH_PEND, &conn->flags)) { |
2221 | BT_INFO("re-auth of legacy device is not possible."); | 2221 | BT_INFO("re-auth of legacy device is not possible."); |
2222 | } else { | 2222 | } else { |
2223 | conn->link_mode |= HCI_LM_AUTH; | 2223 | set_bit(HCI_CONN_AUTH, &conn->flags); |
2224 | conn->sec_level = conn->pending_sec_level; | 2224 | conn->sec_level = conn->pending_sec_level; |
2225 | } | 2225 | } |
2226 | } else { | 2226 | } else { |
@@ -2323,19 +2323,19 @@ static void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2323 | if (!ev->status) { | 2323 | if (!ev->status) { |
2324 | if (ev->encrypt) { | 2324 | if (ev->encrypt) { |
2325 | /* Encryption implies authentication */ | 2325 | /* Encryption implies authentication */ |
2326 | conn->link_mode |= HCI_LM_AUTH; | 2326 | set_bit(HCI_CONN_AUTH, &conn->flags); |
2327 | conn->link_mode |= HCI_LM_ENCRYPT; | 2327 | set_bit(HCI_CONN_ENCRYPT, &conn->flags); |
2328 | conn->sec_level = conn->pending_sec_level; | 2328 | conn->sec_level = conn->pending_sec_level; |
2329 | 2329 | ||
2330 | /* P-256 authentication key implies FIPS */ | 2330 | /* P-256 authentication key implies FIPS */ |
2331 | if (conn->key_type == HCI_LK_AUTH_COMBINATION_P256) | 2331 | if (conn->key_type == HCI_LK_AUTH_COMBINATION_P256) |
2332 | conn->link_mode |= HCI_LM_FIPS; | 2332 | set_bit(HCI_CONN_FIPS, &conn->flags); |
2333 | 2333 | ||
2334 | if ((conn->type == ACL_LINK && ev->encrypt == 0x02) || | 2334 | if ((conn->type == ACL_LINK && ev->encrypt == 0x02) || |
2335 | conn->type == LE_LINK) | 2335 | conn->type == LE_LINK) |
2336 | set_bit(HCI_CONN_AES_CCM, &conn->flags); | 2336 | set_bit(HCI_CONN_AES_CCM, &conn->flags); |
2337 | } else { | 2337 | } else { |
2338 | conn->link_mode &= ~HCI_LM_ENCRYPT; | 2338 | clear_bit(HCI_CONN_ENCRYPT, &conn->flags); |
2339 | clear_bit(HCI_CONN_AES_CCM, &conn->flags); | 2339 | clear_bit(HCI_CONN_AES_CCM, &conn->flags); |
2340 | } | 2340 | } |
2341 | } | 2341 | } |
@@ -2386,7 +2386,7 @@ static void hci_change_link_key_complete_evt(struct hci_dev *hdev, | |||
2386 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); | 2386 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); |
2387 | if (conn) { | 2387 | if (conn) { |
2388 | if (!ev->status) | 2388 | if (!ev->status) |
2389 | conn->link_mode |= HCI_LM_SECURE; | 2389 | set_bit(HCI_CONN_SECURE, &conn->flags); |
2390 | 2390 | ||
2391 | clear_bit(HCI_CONN_AUTH_PEND, &conn->flags); | 2391 | clear_bit(HCI_CONN_AUTH_PEND, &conn->flags); |
2392 | 2392 | ||
@@ -2828,9 +2828,9 @@ static void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2828 | if (conn) { | 2828 | if (conn) { |
2829 | if (!ev->status) { | 2829 | if (!ev->status) { |
2830 | if (ev->role) | 2830 | if (ev->role) |
2831 | conn->link_mode &= ~HCI_LM_MASTER; | 2831 | clear_bit(HCI_CONN_MASTER, &conn->flags); |
2832 | else | 2832 | else |
2833 | conn->link_mode |= HCI_LM_MASTER; | 2833 | set_bit(HCI_CONN_MASTER, &conn->flags); |
2834 | } | 2834 | } |
2835 | 2835 | ||
2836 | clear_bit(HCI_CONN_RSWITCH_PEND, &conn->flags); | 2836 | clear_bit(HCI_CONN_RSWITCH_PEND, &conn->flags); |
@@ -4007,7 +4007,7 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
4007 | 4007 | ||
4008 | if (ev->role == LE_CONN_ROLE_MASTER) { | 4008 | if (ev->role == LE_CONN_ROLE_MASTER) { |
4009 | conn->out = true; | 4009 | conn->out = true; |
4010 | conn->link_mode |= HCI_LM_MASTER; | 4010 | set_bit(HCI_CONN_MASTER, &conn->flags); |
4011 | } | 4011 | } |
4012 | 4012 | ||
4013 | /* If we didn't have a hci_conn object previously | 4013 | /* If we didn't have a hci_conn object previously |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 565afb78296a..d015aa190fdc 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -1486,7 +1486,7 @@ static void l2cap_le_conn_ready(struct l2cap_conn *conn) | |||
1486 | * been configured for this connection. If not, then trigger | 1486 | * been configured for this connection. If not, then trigger |
1487 | * the connection update procedure. | 1487 | * the connection update procedure. |
1488 | */ | 1488 | */ |
1489 | if (!(hcon->link_mode & HCI_LM_MASTER) && | 1489 | if (!test_bit(HCI_CONN_MASTER, &hcon->flags) && |
1490 | (hcon->le_conn_interval < hcon->le_conn_min_interval || | 1490 | (hcon->le_conn_interval < hcon->le_conn_min_interval || |
1491 | hcon->le_conn_interval > hcon->le_conn_max_interval)) { | 1491 | hcon->le_conn_interval > hcon->le_conn_max_interval)) { |
1492 | struct l2cap_conn_param_update_req req; | 1492 | struct l2cap_conn_param_update_req req; |
@@ -5244,7 +5244,7 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn, | |||
5244 | u16 min, max, latency, to_multiplier; | 5244 | u16 min, max, latency, to_multiplier; |
5245 | int err; | 5245 | int err; |
5246 | 5246 | ||
5247 | if (!(hcon->link_mode & HCI_LM_MASTER)) | 5247 | if (!test_bit(HCI_CONN_MASTER, &hcon->flags)) |
5248 | return -EINVAL; | 5248 | return -EINVAL; |
5249 | 5249 | ||
5250 | if (cmd_len != sizeof(struct l2cap_conn_param_update_req)) | 5250 | if (cmd_len != sizeof(struct l2cap_conn_param_update_req)) |
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 28f4ef48095b..976fce2315fd 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -435,7 +435,7 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth, | |||
435 | * Confirms and the slave Enters the passkey. | 435 | * Confirms and the slave Enters the passkey. |
436 | */ | 436 | */ |
437 | if (method == OVERLAP) { | 437 | if (method == OVERLAP) { |
438 | if (hcon->link_mode & HCI_LM_MASTER) | 438 | if (test_bit(HCI_CONN_MASTER, &hcon->flags)) |
439 | method = CFM_PASSKEY; | 439 | method = CFM_PASSKEY; |
440 | else | 440 | else |
441 | method = REQ_PASSKEY; | 441 | method = REQ_PASSKEY; |
@@ -683,7 +683,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
683 | if (skb->len < sizeof(*req)) | 683 | if (skb->len < sizeof(*req)) |
684 | return SMP_INVALID_PARAMS; | 684 | return SMP_INVALID_PARAMS; |
685 | 685 | ||
686 | if (conn->hcon->link_mode & HCI_LM_MASTER) | 686 | if (test_bit(HCI_CONN_MASTER, &conn->hcon->flags)) |
687 | return SMP_CMD_NOTSUPP; | 687 | return SMP_CMD_NOTSUPP; |
688 | 688 | ||
689 | if (!test_and_set_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags)) | 689 | if (!test_and_set_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags)) |
@@ -750,7 +750,7 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb) | |||
750 | if (skb->len < sizeof(*rsp)) | 750 | if (skb->len < sizeof(*rsp)) |
751 | return SMP_INVALID_PARAMS; | 751 | return SMP_INVALID_PARAMS; |
752 | 752 | ||
753 | if (!(conn->hcon->link_mode & HCI_LM_MASTER)) | 753 | if (!test_bit(HCI_CONN_MASTER, &conn->hcon->flags)) |
754 | return SMP_CMD_NOTSUPP; | 754 | return SMP_CMD_NOTSUPP; |
755 | 755 | ||
756 | skb_pull(skb, sizeof(*rsp)); | 756 | skb_pull(skb, sizeof(*rsp)); |
@@ -873,7 +873,7 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
873 | if (skb->len < sizeof(*rp)) | 873 | if (skb->len < sizeof(*rp)) |
874 | return SMP_INVALID_PARAMS; | 874 | return SMP_INVALID_PARAMS; |
875 | 875 | ||
876 | if (!(conn->hcon->link_mode & HCI_LM_MASTER)) | 876 | if (!test_bit(HCI_CONN_MASTER, &conn->hcon->flags)) |
877 | return SMP_CMD_NOTSUPP; | 877 | return SMP_CMD_NOTSUPP; |
878 | 878 | ||
879 | sec_level = authreq_to_seclevel(rp->auth_req); | 879 | sec_level = authreq_to_seclevel(rp->auth_req); |
@@ -937,7 +937,7 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) | |||
937 | if (sec_level > hcon->pending_sec_level) | 937 | if (sec_level > hcon->pending_sec_level) |
938 | hcon->pending_sec_level = sec_level; | 938 | hcon->pending_sec_level = sec_level; |
939 | 939 | ||
940 | if (hcon->link_mode & HCI_LM_MASTER) | 940 | if (test_bit(HCI_CONN_MASTER, &hcon->flags)) |
941 | if (smp_ltk_encrypt(conn, hcon->pending_sec_level)) | 941 | if (smp_ltk_encrypt(conn, hcon->pending_sec_level)) |
942 | return 0; | 942 | return 0; |
943 | 943 | ||
@@ -957,7 +957,7 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) | |||
957 | hcon->pending_sec_level > BT_SECURITY_MEDIUM) | 957 | hcon->pending_sec_level > BT_SECURITY_MEDIUM) |
958 | authreq |= SMP_AUTH_MITM; | 958 | authreq |= SMP_AUTH_MITM; |
959 | 959 | ||
960 | if (hcon->link_mode & HCI_LM_MASTER) { | 960 | if (test_bit(HCI_CONN_MASTER, &hcon->flags)) { |
961 | struct smp_cmd_pairing cp; | 961 | struct smp_cmd_pairing cp; |
962 | 962 | ||
963 | build_pairing_cmd(conn, &cp, NULL, authreq); | 963 | build_pairing_cmd(conn, &cp, NULL, authreq); |