Bluetooth: Permit BT_SECURITY also for L2CAP raw sockets
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 20 Feb 2009 19:54:06 +0000 (20:54 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 27 Feb 2009 05:14:48 +0000 (06:14 +0100)
Userspace pairing code can be simplified if it doesn't have to fall
back to using L2CAP_LM in the case of L2CAP raw sockets. This patch
allows the BT_SECURITY socket option to be used for these sockets.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/l2cap.c

index 7c6768c..db6fbf1 100644 (file)
@@ -1308,7 +1308,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
 
        switch (optname) {
        case BT_SECURITY:
 
        switch (optname) {
        case BT_SECURITY:
-               if (sk->sk_type != SOCK_SEQPACKET) {
+               if (sk->sk_type != SOCK_SEQPACKET && sk->sk_type != SOCK_RAW) {
                        err = -EINVAL;
                        break;
                }
                        err = -EINVAL;
                        break;
                }
@@ -1455,7 +1455,7 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ch
 
        switch (optname) {
        case BT_SECURITY:
 
        switch (optname) {
        case BT_SECURITY:
-               if (sk->sk_type != SOCK_SEQPACKET) {
+               if (sk->sk_type != SOCK_SEQPACKET && sk->sk_type != SOCK_RAW) {
                        err = -EINVAL;
                        break;
                }
                        err = -EINVAL;
                        break;
                }