Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bluetooth: att: Fix L2CAP channel section order #45801

Merged
merged 1 commit into from
May 20, 2022

Conversation

MarekPieta
Copy link
Collaborator

@MarekPieta MarekPieta commented May 19, 2022

The L2CAP channel section is sorted lexicographically. Make sure that ATT fixed channel will be placed as the last one to ensure
that SMP channel is properly initialized before bt_att_connected tries to send security request.

The issue can be replicated on main (used commit hash of 2dc866f) with bluetooth/peripheral_hids sample (checked on nrf52840dk_nrf528400):

  • Build and program the sample
  • Connect with device over BLE (e.g. with Android phone) and establish security
  • Disconnect
  • Reconnect

Right after reconnection, the following error log is observed:

[00:00:43.157,531] <err> bt_smp: Unable to find SMP channel
[00:00:43.157,562] <wrn> bt_gatt: Failed to set security for bonded peer (-128)

The error log is observed on every reconnection.

Fixes #45820

@MarekPieta MarekPieta requested a review from pdunaj May 19, 2022 15:22
@github-actions github-actions bot added area: Bluetooth area: Bluetooth Host Bluetooth Host (excluding BR/EDR) labels May 19, 2022
pdunaj
pdunaj previously approved these changes May 19, 2022
@pdunaj pdunaj requested a review from ppryga-nordic May 19, 2022 15:30
ppryga-nordic
ppryga-nordic previously approved these changes May 20, 2022
@MarekPieta MarekPieta added the bug The issue is a bug, or the PR is fixing a bug label May 20, 2022
jhedberg
jhedberg previously approved these changes May 20, 2022
The L2CAP channel section is sorted lexicographically. Make sure
that ATT fixed channel will be placed as the last one to ensure
that SMP channel is properly initialized before bt_att_connected
tries to send security request.

Fixes zephyrproject-rtos#45820

Signed-off-by: Marek Pieta <[email protected]>
@MarekPieta
Copy link
Collaborator Author

Added link to fixed issue to commit message. Please rereview @pdunaj @ppryga @jhedberg
Sorry for the inconvenience

@carlescufi carlescufi merged commit 903672c into zephyrproject-rtos:main May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bluetooth: host: Failed to set security right after reconnection with bonded Central
6 participants