summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/rfcomm/core.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-02-09 02:48:38 +0100
committerMarcel Holtmann <marcel@holtmann.org>2009-02-27 06:14:40 +0100
commit0684e5f9fb9e3f7e168ab831dfca693bcb44805b (patch)
tree1fb1315dff64ef2ebaa24729988b2c3b7c77d578 /net/bluetooth/rfcomm/core.c
parentefc7688b557dd1be10eead7399b315efcb1dbc74 (diff)
downloadlinux-0684e5f9fb9e3f7e168ab831dfca693bcb44805b.tar.gz
linux-0684e5f9fb9e3f7e168ab831dfca693bcb44805b.tar.bz2
linux-0684e5f9fb9e3f7e168ab831dfca693bcb44805b.zip
Bluetooth: Use general bonding whenever possible
When receiving incoming connection to specific services, always use general bonding. This ensures that the link key gets stored and can be used for further authentications. Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/rfcomm/core.c')
-rw-r--r--net/bluetooth/rfcomm/core.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 3717c25ba33a..1828ec06ad1c 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -226,8 +226,22 @@ static int rfcomm_l2sock_create(struct socket **sock)
static inline int rfcomm_check_security(struct rfcomm_dlc *d)
{
struct sock *sk = d->session->sock->sk;
+ __u8 auth_type;
- return hci_conn_security(l2cap_pi(sk)->conn->hcon, d->sec_level);
+ switch (d->sec_level) {
+ case BT_SECURITY_HIGH:
+ auth_type = HCI_AT_GENERAL_BONDING_MITM;
+ break;
+ case BT_SECURITY_MEDIUM:
+ auth_type = HCI_AT_GENERAL_BONDING;
+ break;
+ default:
+ auth_type = HCI_AT_NO_BONDING;
+ break;
+ }
+
+ return hci_conn_security(l2cap_pi(sk)->conn->hcon, d->sec_level,
+ auth_type);
}
/* ---- RFCOMM DLCs ---- */