-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Bluetooth: Classic: L2CAP: Disconn channel if proposed MTU is invalid #90158
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: Classic: L2CAP: Disconn channel if proposed MTU is invalid #90158
Conversation
Hi @lylezhu2012 It seems that the first part of the description (If the proposed MTU is less than MIN MTU) is not relevant to this PR. |
} else if (mtu > BR_CHAN(chan)->rx.mtu) { | ||
LOG_WRN("Proposed MTU is more than given value (%u > %u)", mtu, | ||
BR_CHAN(chan)->rx.mtu); | ||
result = BT_L2CAP_CONF_REJECT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend to add goto done;
after this.
Note that the future developers may add codes after line 3154.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think so. However, from the current implementation point of view, it makes no difference whether it is added or not. From the perspective of later maintenance, adding goto
statements is easier to understand and maintain.
Updated.
7f3b0da
to
610b24c
Compare
Thanks. Added it. |
Disconnect the L2CAP channel connection if the proposed MTU is less than min MTU or more than local supported MTU. The main scenes are as follows. If the proposed MTU is less than MIN MTU. 1. The channel connection of client and server is established, 2. Client/server sends channel config REQ (MTU=50), 3. Peer replies channel config RQP (Unaccepted/success with MTU=30), 4. The client/server will repeat step 3~4 if the RSP is unacceptable. With the change applied, the local will disconnect the L2CAP channel connection in step 3. If the proposed MTU is more than local supported MTU. 1. The channel connection of client and server is established, 2. Client/server sends channel config REQ (MTU=50), 3. Peer replies channel config RQP (Unaccepted/success with MTU=80), 4. The client/server will repeat step 3~4 if the RSP is unacceptable. With the change applied, the local will disconnect the L2CAP channel connection in step 3. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
610b24c
to
29cf81b
Compare
|
@gzh-terry Do you have any comments? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Disconnect the L2CAP channel connection if the proposed MTU is less than min MTU or more than local supported MTU.
The main scenes are as follows.
If the proposed MTU is less than MIN MTU.
With the change applied, the local will disconnect the L2CAP channel connection in step 3.
If the proposed MTU is more than local supported MTU.
With the change applied, the local will disconnect the L2CAP channel connection in step 3.