aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-07-14 14:13:50 -0400
committerMarcel Holtmann <marcel@holtmann.org>2008-07-14 14:13:50 -0400
commit40be492fe4fab829951681860c2bb26fa1d5fe4a (patch)
tree41b576692c2206c9a51e689f54170076ec95bc3a /net/bluetooth/l2cap.c
parentf8558555f31e177e2644f3c8116801c3e5c29974 (diff)
[Bluetooth] Export details about authentication requirements
With the Simple Pairing support, the authentication requirements are an explicit setting during the bonding process. Track and enforce the requirements and allow higher layers like L2CAP and RFCOMM to increase them if needed. This patch introduces a new IOCTL that allows to query the current authentication requirements. It is also possible to detect Simple Pairing support in the kernel this way. Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/l2cap.c')
-rw-r--r--net/bluetooth/l2cap.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 252264062f59..30ad59b717d5 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -2150,7 +2150,7 @@ static int l2cap_disconn_ind(struct hci_conn *hcon, u8 reason)
2150static int l2cap_auth_cfm(struct hci_conn *hcon, u8 status) 2150static int l2cap_auth_cfm(struct hci_conn *hcon, u8 status)
2151{ 2151{
2152 struct l2cap_chan_list *l; 2152 struct l2cap_chan_list *l;
2153 struct l2cap_conn *conn = conn = hcon->l2cap_data; 2153 struct l2cap_conn *conn = hcon->l2cap_data;
2154 struct l2cap_conn_rsp rsp; 2154 struct l2cap_conn_rsp rsp;
2155 struct sock *sk; 2155 struct sock *sk;
2156 int result; 2156 int result;
@@ -2165,11 +2165,17 @@ static int l2cap_auth_cfm(struct hci_conn *hcon, u8 status)
2165 read_lock(&l->lock); 2165 read_lock(&l->lock);
2166 2166
2167 for (sk = l->head; sk; sk = l2cap_pi(sk)->next_c) { 2167 for (sk = l->head; sk; sk = l2cap_pi(sk)->next_c) {
2168 struct l2cap_pinfo *pi = l2cap_pi(sk);
2169
2168 bh_lock_sock(sk); 2170 bh_lock_sock(sk);
2169 2171
2170 if (sk->sk_state != BT_CONNECT2 || 2172 if (sk->sk_state != BT_CONNECT2) {
2171 (l2cap_pi(sk)->link_mode & L2CAP_LM_ENCRYPT) || 2173 bh_unlock_sock(sk);
2172 (l2cap_pi(sk)->link_mode & L2CAP_LM_SECURE)) { 2174 continue;
2175 }
2176
2177 if ((pi->link_mode & (L2CAP_LM_ENCRYPT | L2CAP_LM_SECURE)) &&
2178 !(hcon->link_mode & HCI_LM_ENCRYPT)) {
2173 bh_unlock_sock(sk); 2179 bh_unlock_sock(sk);
2174 continue; 2180 continue;
2175 } 2181 }