Diff between 8e493e8416e5525042b8b4a34eb2b7084725438b and 064f48ad6dd0eb4becb94f5492b6c78218065f19

Changed Files

File Additions Deletions Status
src/shared/att.c +4 -3 modified

Full Patch

diff --git a/src/shared/att.c b/src/shared/att.c
index 3a84783..7b20757 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
@@ -573,10 +573,11 @@ static bool change_security(struct bt_att *att, uint8_t ecode)
 {
 	int security;
 
-	security = bt_att_get_security(att);
-	if (security != BT_ATT_SECURITY_AUTO)
+	if (att->io_sec_level != BT_ATT_SECURITY_AUTO)
 		return false;
 
+	security = bt_att_get_security(att);
+
 	if (ecode == BT_ATT_ERROR_INSUFFICIENT_ENCRYPTION &&
 					security < BT_ATT_SECURITY_MEDIUM)
 		security = BT_ATT_SECURITY_MEDIUM;
@@ -979,7 +980,7 @@ struct bt_att *bt_att_new(int fd, bool ext_signed)
 
 	att->io_on_l2cap = is_io_l2cap_based(att->fd);
 	if (!att->io_on_l2cap)
-		att->io_sec_level = BT_SECURITY_LOW;
+		att->io_sec_level = BT_ATT_SECURITY_LOW;
 
 	return bt_att_ref(att);