Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Bluetooth: Add support for running SMP without a socket

When doing the pairing procedure we won't have an associated
socket, but we still have to do the SMP negotiation. This
adds support for encrypting the link and exchanging keys.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>

authored by

Vinicius Costa Gomes and committed by
Gustavo F. Padovan
160dc6ac 7a512d01

+8 -2
+8 -2
net/bluetooth/l2cap_core.c
··· 907 907 if (!conn->hcon->out && conn->hcon->type == LE_LINK) 908 908 l2cap_le_conn_ready(conn); 909 909 910 + if (conn->hcon->out && conn->hcon->type == LE_LINK) 911 + smp_conn_security(conn, conn->hcon->pending_sec_level); 912 + 910 913 read_lock(&conn->chan_lock); 911 914 912 915 list_for_each_entry(chan, &conn->chan_l, list) { ··· 4098 4095 4099 4096 BT_DBG("conn %p", conn); 4100 4097 4098 + if (hcon->type == LE_LINK) { 4099 + smp_distribute_keys(conn, 0); 4100 + del_timer(&conn->security_timer); 4101 + } 4102 + 4101 4103 read_lock(&conn->chan_lock); 4102 4104 4103 4105 list_for_each_entry(chan, &conn->chan_l, list) { ··· 4115 4107 if (chan->scid == L2CAP_CID_LE_DATA) { 4116 4108 if (!status && encrypt) { 4117 4109 chan->sec_level = hcon->sec_level; 4118 - del_timer(&conn->security_timer); 4119 4110 l2cap_chan_ready(sk); 4120 - smp_distribute_keys(conn, 0); 4121 4111 } 4122 4112 4123 4113 bh_unlock_sock(sk);