Bluetooth: l2cap: Fix setting unnecessary DCID header in response
For an LE L2CAP Connect Response with a failure error code the core specification states: "The DCID, MTU, MPS and Initial Credits fields shall be ignored when the result field indicates the connection was refused." This means that there's no point in setting any specific value to it, i.e. it can be left to 0 as set by memset. Change-Id: Iead8039c7b60e1cf766e9ab14691e83fe9813288 Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
736e8b1bf9
commit
b5245cb9db
1 changed files with 0 additions and 4 deletions
|
@ -385,7 +385,6 @@ static void le_conn_req(struct bt_l2cap *l2cap, uint8_t ident,
|
||||||
/* Check if there is a server registered */
|
/* Check if there is a server registered */
|
||||||
server = l2cap_server_lookup_psm(psm);
|
server = l2cap_server_lookup_psm(psm);
|
||||||
if (!psm) {
|
if (!psm) {
|
||||||
rsp->dcid = req->scid;
|
|
||||||
rsp->result = BT_L2CAP_ERR_PSM_NOT_SUPP;
|
rsp->result = BT_L2CAP_ERR_PSM_NOT_SUPP;
|
||||||
goto rsp;
|
goto rsp;
|
||||||
}
|
}
|
||||||
|
@ -393,14 +392,12 @@ static void le_conn_req(struct bt_l2cap *l2cap, uint8_t ident,
|
||||||
/* TODO: Add security check */
|
/* TODO: Add security check */
|
||||||
|
|
||||||
if (scid < L2CAP_LE_DYN_CID_START || scid > L2CAP_LE_DYN_CID_END) {
|
if (scid < L2CAP_LE_DYN_CID_START || scid > L2CAP_LE_DYN_CID_END) {
|
||||||
rsp->dcid = req->scid;
|
|
||||||
rsp->result = BT_L2CAP_ERR_INVALID_SCID;
|
rsp->result = BT_L2CAP_ERR_INVALID_SCID;
|
||||||
goto rsp;
|
goto rsp;
|
||||||
}
|
}
|
||||||
|
|
||||||
chan = bt_l2cap_lookup_tx_cid(conn, scid);
|
chan = bt_l2cap_lookup_tx_cid(conn, scid);
|
||||||
if (chan) {
|
if (chan) {
|
||||||
rsp->dcid = req->scid;
|
|
||||||
rsp->result = BT_L2CAP_ERR_SCID_IN_USE;
|
rsp->result = BT_L2CAP_ERR_SCID_IN_USE;
|
||||||
goto rsp;
|
goto rsp;
|
||||||
}
|
}
|
||||||
|
@ -411,7 +408,6 @@ static void le_conn_req(struct bt_l2cap *l2cap, uint8_t ident,
|
||||||
* TODO: Handle different errors, it may be required to respond async.
|
* TODO: Handle different errors, it may be required to respond async.
|
||||||
*/
|
*/
|
||||||
if (server->accept(conn, &chan) < 0) {
|
if (server->accept(conn, &chan) < 0) {
|
||||||
rsp->dcid = req->scid;
|
|
||||||
rsp->result = BT_L2CAP_ERR_NO_RESOURCES;
|
rsp->result = BT_L2CAP_ERR_NO_RESOURCES;
|
||||||
goto rsp;
|
goto rsp;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue