Skip to content

Commit

Permalink
Bluetooth: L2CAP: Fix checking if LTK is present
Browse files Browse the repository at this point in the history
This fix a typo where incorrect member of bt_keys was used for
checking if LTK is present. This was resulting in bogus results
depending on connection role and current identity used.

This was affecting L2CAP/LE/CFC/BV-25-C qualification test case.

Fixes: zephyrproject-rtos#42862

Signed-off-by: Szymon Janc <[email protected]>
  • Loading branch information
sjanc authored and carlescufi committed Feb 17, 2022
1 parent 777ddc0 commit 4fce6fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions subsys/bluetooth/host/l2cap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1054,9 +1054,9 @@ static uint16_t l2cap_check_security(struct bt_conn *conn,

if (keys) {
if (conn->role == BT_HCI_ROLE_CENTRAL) {
ltk_present = keys->id & (BT_KEYS_LTK_P256 | BT_KEYS_PERIPH_LTK);
ltk_present = keys->keys & (BT_KEYS_LTK_P256 | BT_KEYS_PERIPH_LTK);
} else {
ltk_present = keys->id & (BT_KEYS_LTK_P256 | BT_KEYS_LTK);
ltk_present = keys->keys & (BT_KEYS_LTK_P256 | BT_KEYS_LTK);
}
} else {
ltk_present = false;
Expand Down

0 comments on commit 4fce6fb

Please sign in to comment.