Bluetooth: GATT: Replace check for CONFIG_BT_SMP

Make use of bt_conn_get_security instead of accessing conn->sec_level
directly.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2019-10-08 11:21:10 +03:00 committed by Johan Hedberg
commit c736de05fa

View file

@ -1867,13 +1867,9 @@ u8_t bt_gatt_check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr,
mask &= attr->perm;
if (mask & BT_GATT_PERM_AUTHEN_MASK) {
#if defined(CONFIG_BT_SMP)
if (conn->sec_level < BT_SECURITY_L3) {
if (bt_conn_get_security(conn) < BT_SECURITY_L3) {
return BT_ATT_ERR_AUTHENTICATION;
}
#else
return BT_ATT_ERR_AUTHENTICATION;
#endif /* CONFIG_BT_SMP */
}
if ((mask & BT_GATT_PERM_ENCRYPT_MASK)) {