Bluetooth: L2CAP: Split security changed handler for BR/EDR

Delegates own handler for changed security information happened on BR/EDR
link. Now L2CAP layer based on transport type can independently handle
updated security information.

Change-Id: I4838f1cc9d53cf6dfab19bb9f70ec6e307741e66
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
Arkadiusz Lichwa 2016-07-08 16:05:58 +02:00 committed by Johan Hedberg
commit 37bb3e8049
3 changed files with 21 additions and 0 deletions

View file

@ -330,6 +330,13 @@ void bt_l2cap_encrypt_change(struct bt_conn *conn)
{
struct bt_l2cap_chan *chan;
#if defined(CONFIG_BLUETOOTH_BREDR)
if (conn->type == BT_CONN_TYPE_BR) {
l2cap_br_encrypt_change(conn);
return;
}
#endif /* CONFIG_BLUETOOTH_BREDR */
for (chan = conn->channels; chan; chan = chan->_next) {
if (chan->ops->encrypt_change) {
chan->ops->encrypt_change(chan);

View file

@ -1064,6 +1064,17 @@ static void l2cap_br_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
}
}
void l2cap_br_encrypt_change(struct bt_conn *conn)
{
struct bt_l2cap_chan *chan;
for (chan = conn->channels; chan; chan = chan->_next) {
if (chan->ops && chan->ops->encrypt_change) {
chan->ops->encrypt_change(chan);
}
}
}
static int l2cap_br_accept(struct bt_conn *conn, struct bt_l2cap_chan **chan)
{
int i;

View file

@ -270,4 +270,7 @@ int bt_l2cap_br_chan_connect(struct bt_conn *conn, struct bt_l2cap_chan *chan,
/* Send packet data to connected peer */
int bt_l2cap_br_chan_send(struct bt_l2cap_chan *chan, struct net_buf *buf);
/* Handle security level changed on link */
void l2cap_br_encrypt_change(struct bt_conn *conn);
#endif /* CONFIG_BLUETOOTH_BREDR */