diff --git a/src/shared/att.c b/src/shared/att.c
index aa06dc6..9787377 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
int fd;
struct io *io;
bool io_on_l2cap;
+ int io_sec_level; /* Only used for non-L2CAP */
struct queue *req_queue; /* Queued ATT protocol requests */
struct att_send_op *pending_req;
goto fail;
att->io_on_l2cap = is_io_l2cap_based(att->fd);
+ if (!att->io_on_l2cap)
+ att->io_sec_level = BT_SECURITY_LOW;
return bt_att_ref(att);
if (!att)
return -EINVAL;
- /*
- * Let's be nice for unit test.
- * TODO: Might be needed to emulate different levels for test purposes
- */
if (!att->io_on_l2cap)
- return BT_SECURITY_LOW;
+ return att->io_sec_level;
memset(&sec, 0, sizeof(sec));
len = sizeof(sec);
if (!att || level < BT_SECURITY_LOW || level > BT_SECURITY_HIGH)
return false;
- /* Let's be nice for unit test.*/
- if (!att->io_on_l2cap)
+ if (!att->io_on_l2cap) {
+ att->io_sec_level = level;
return true;
+ }
memset(&sec, 0, sizeof(sec));
sec.level = level;