Bluetooth: L2CAP: Handle of Reject command

This handles Reject command which currently only affects pending
Connection Request where the remote may actually respond with Reject
when it is not implemented.

Change-Id: I0095259230955ee7dd605fad9339a7b5e8f1611b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2016-03-01 13:06:31 +02:00 committed by Gerrit Code Review
commit 5d43dfd704

View file

@ -748,6 +748,21 @@ static void le_credits(struct bt_l2cap *l2cap, uint8_t ident,
BT_DBG("chan %p total credits %u", chan, chan->tx.credits.nsig);
}
static void reject_cmd(struct bt_l2cap *l2cap, uint8_t ident,
struct net_buf *buf)
{
struct bt_conn *conn = l2cap->chan.conn;
struct bt_l2cap_chan *chan;
/* Check if there is a outstanding channel */
chan = l2cap_remove_ident(conn, ident);
if (!chan) {
return;
}
l2cap_chan_del(chan);
}
#endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */
static void l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
@ -802,6 +817,13 @@ static void l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
case BT_L2CAP_LE_CREDITS:
le_credits(l2cap, hdr->ident, buf);
break;
case BT_L2CAP_CMD_REJECT:
reject_cmd(l2cap, hdr->ident, buf);
break;
#else
case BT_L2CAP_CMD_REJECT:
/* Ignored */
break;
#endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */
default:
BT_WARN("Unknown L2CAP PDU code 0x%02x", hdr->code);