lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1372980303-3007-3-git-send-email-kyle@kylemanna.com>
Date:	Thu,  4 Jul 2013 16:25:03 -0700
From:	Kyle Manna <kyle@...emanna.com>
To:	linux-bluetooth@...r.kernel.org,
	Marcel Holtmann <marcel@...tmann.org>,
	Gustavo Padovan <gustavo@...ovan.org>,
	Johan Hedberg <johan.hedberg@...il.com>
Cc:	"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, Kyle Manna <kyle@...emanna.com>
Subject: [PATCH 2/2] bluetooth: Add l2cap sockopt for LE conn params

* Userspace can now specify connection parameters to override the
  defaults prior to connecting to the device.
* The intention is that setsockopt() will be called before connect() is
  called in userspace apps and BlueZ libraries.
* It is critical to set these parameters prior to connect() to avoid
  issues with hardware that must arbitrate the antenna access between
  Bluetooth LE and things like WiFi.  Aggressive connect (and scan)
  window and interval values result in significant WiFi degradation.
* Reduces the need to call the hci LE Connection Update Command to
  override the "defaults" when the desired values are known ahead of
  time.
* Add BT_LE_CONN_PARAM socket option.

Signed-off-by: Kyle Manna <kyle@...emanna.com>
---
 include/net/bluetooth/bluetooth.h |  2 ++
 net/bluetooth/l2cap_sock.c        | 23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 10eb9b3..36e9242 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -82,6 +82,8 @@ struct bt_power {
 
 #define BT_CHANNEL_POLICY	10
 
+#define BT_LE_CONN_PARAM	11
+
 /* BR/EDR only (default policy)
  *   AMP controllers cannot be used.
  *   Channel move requests from the remote device are denied.
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 2c7917e..17b6e2b 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -454,6 +454,15 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname,
 			err = -EFAULT;
 		break;
 
+	case BT_LE_CONN_PARAM:
+
+		len = min_t(unsigned int, len,
+			    sizeof(struct hci_cp_le_create_conn));
+		if (copy_to_user(optval, (char *) &chan->cp_le, len))
+			err = -EFAULT;
+
+		break;
+
 	default:
 		err = -ENOPROTOOPT;
 		break;
@@ -749,6 +758,20 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
 
 		break;
 
+	case BT_LE_CONN_PARAM:
+
+		if (sizeof(struct hci_cp_le_create_conn) != optlen) {
+			err = -EINVAL;
+			break;
+		}
+
+		if (copy_from_user((char *) &chan->cp_le, optval, optlen)) {
+			err = -EFAULT;
+			break;
+		}
+
+		break;
+
 	default:
 		err = -ENOPROTOOPT;
 		break;
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ