Bluetooth: L2CAP: Elevate security level if requested by application
Elevate the security level before sending the connection request if the application has set a required security level on the channel. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
9c3d006471
commit
5f00ee1e88
@ -2358,6 +2358,20 @@ static int l2cap_le_connect(struct bt_conn *conn, struct bt_l2cap_le_chan *ch,
|
||||
|
||||
ch->chan.psm = psm;
|
||||
|
||||
if (conn->sec_level < ch->chan.required_sec_level) {
|
||||
int err;
|
||||
|
||||
err = bt_conn_set_security(conn, ch->chan.required_sec_level);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
atomic_set_bit(ch->chan.status,
|
||||
BT_L2CAP_STATUS_ENCRYPT_PENDING);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return l2cap_le_conn_req(ch);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user