-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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 L2CAP TX fragmentation state not cleared upon disconnect #76737
Comments
This bug led to repeated disconnects in an internal application (same one as in #76738). L2CAP initially works fine, but falls into a loop of connecting and disconnecting once the connection drops for the first time. Error logs:
The receiving side usually receives an invalid packet when this happens:
The fix listed above (Setting |
So I managed to reproduce the bug.
@EaselinkBachmann What exactly are you doing with L2CAP? I know Rubin is using private APIs. |
Okay, that might be it.
I have a static global of a `bt_l2cap_le_chan` that I use for creating a single channel that I repeatedly use for connections without memsetting in beyween. I didn't know that users of the L2CAP API were supposed to memset their channels before
each connection and assumed that the disconnect logic would leave the channel in a clean state, ready to be reused. It might be that I missed this in the docstring of the relevant functions.
I will double-check this tomorrow to verify if this is the case.
|
Describe the bug
When reconnecting, previous l2cap TX fragmentation state is kept, resulting in that we may send l2cap fragments to the controller without an l2cap header.
To Reproduce
Setting
le_chan._pdu_remaining = 0
inbt_l2cap_chan_del()
resolves this issue.Expected behavior
Upon disconnection all previous state shall be cleared.
Impact
Showstopper
Logs and console output
Logs extracted from a custom test
Environment (please complete the following information):
Zephyr 3.7.0
Additional context
The bug was introduced in #72090
The text was updated successfully, but these errors were encountered: