public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@nokia.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] Allow BT_SECURITY for L2CAP raw sockets
Date: Fri, 20 Feb 2009 15:23:46 +0200	[thread overview]
Message-ID: <20090220132346.GA5255@jh-x301> (raw)

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

Hi Marcel,

Here's the patch to permit BT_SECURITY for L2CAP raw sockets. It allows
our BtIO code to be simpler since there's no need to do special L2CAP_LM
tricks when doing paring using L2CAP raw sockets. It seemed to work fine
in my tests (both SSP and legacy pairing) so if it's ok with you I'll
also push the corresponding patch for bluetoothd (which without this
patch would cause EINVAL when trying pairing on a newer kernel).

Johan

[-- Attachment #2: 0001-Bluetooth-Permit-BT_SECURITY-also-for-L2CAP-raw-soc.patch --]
[-- Type: text/x-diff, Size: 1061 bytes --]

>From a6f7321f607712eafde755726d07ccf1a1fcdfab Mon Sep 17 00:00:00 2001
From: Johan Hedberg <johan.hedberg@nokia.com>
Date: Fri, 20 Feb 2009 14:56:00 +0200
Subject: [PATCH] Bluetooth: Permit BT_SECURITY also for L2CAP raw sockets

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 all types of L2CAP sockets.

Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com>
---
 net/bluetooth/l2cap.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 7c6768c..b935cf0 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -1308,11 +1308,6 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
 
 	switch (optname) {
 	case BT_SECURITY:
-		if (sk->sk_type != SOCK_SEQPACKET) {
-			err = -EINVAL;
-			break;
-		}
-
 		sec.level = BT_SECURITY_LOW;
 
 		len = min_t(unsigned int, sizeof(sec), optlen);
-- 
1.5.6.3


             reply	other threads:[~2009-02-20 13:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-20 13:23 Johan Hedberg [this message]
2009-02-20 19:57 ` [PATCH] Allow BT_SECURITY for L2CAP raw sockets Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090220132346.GA5255@jh-x301 \
    --to=johan.hedberg@nokia.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox