Bluetooth: Fix not using endianess helper in LE L2CAP conn req
Corrects response 'result' protocol field to right endianess when responding to LE L2CAP connection request on error case. Change-Id: I066bad2f0f3173739676e918f42d425581084dbe Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
parent
7f07d28f37
commit
9385a47e53
1 changed files with 4 additions and 4 deletions
|
@ -458,20 +458,20 @@ 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 (!server) {
|
if (!server) {
|
||||||
rsp->result = BT_L2CAP_ERR_PSM_NOT_SUPP;
|
rsp->result = sys_cpu_to_le16(BT_L2CAP_ERR_PSM_NOT_SUPP);
|
||||||
goto rsp;
|
goto rsp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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->result = BT_L2CAP_ERR_INVALID_SCID;
|
rsp->result = sys_cpu_to_le16(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->result = BT_L2CAP_ERR_SCID_IN_USE;
|
rsp->result = sys_cpu_to_le16(BT_L2CAP_ERR_SCID_IN_USE);
|
||||||
goto rsp;
|
goto rsp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ 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->result = BT_L2CAP_ERR_NO_RESOURCES;
|
rsp->result = sys_cpu_to_le16(BT_L2CAP_ERR_NO_RESOURCES);
|
||||||
goto rsp;
|
goto rsp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue