Thread (4 messages) read the whole thread 4 messages, 1 author, 2013-01-28
STALE4931d

[PATCH BlueZ 2/4] device: Fix missing PDUs during encryption procedure

From: Vinicius Costa Gomes <hidden>
Date: 2013-01-28 23:48:09
Subsystem: the rest · Maintainer: Linus Torvalds

In case the remote device sends an ATT PDU while encryption is going
on, we may lose it because the ATT socket (with security level medium),
would only be attached when encryption finishes.
---
 src/device.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/device.c b/src/device.c
index ceaa575..0d2d3ee 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3167,7 +3167,6 @@ int device_connect_le(struct btd_device *dev)
 {
 	struct btd_adapter *adapter = dev->adapter;
 	struct att_callbacks *attcb;
-	BtIOSecLevel sec_level;
 	GIOChannel *io;
 	GError *gerr = NULL;
 	char addr[18];
@@ -3185,21 +3184,18 @@ int device_connect_le(struct btd_device *dev)
 	attcb->success = att_success_cb;
 	attcb->user_data = dev;
 
-	if (dev->paired)
-		sec_level = BT_IO_SEC_MEDIUM;
-	else
-		sec_level = BT_IO_SEC_LOW;
-
 	/*
 	 * This connection will help us catch any PDUs that comes before
-	 * pairing finishes
+	 * pairing finishes. Its security level is low, because we don't
+	 * want to miss any PDU that may come before the encryption
+	 * procedure finishes
 	 */
 	io = bt_io_connect(att_connect_cb, attcb, NULL, &gerr,
 			BT_IO_OPT_SOURCE_BDADDR, adapter_get_address(adapter),
 			BT_IO_OPT_DEST_BDADDR, &dev->bdaddr,
 			BT_IO_OPT_DEST_TYPE, dev->bdaddr_type,
 			BT_IO_OPT_CID, ATT_CID,
-			BT_IO_OPT_SEC_LEVEL, sec_level,
+			BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_LOW,
 			BT_IO_OPT_INVALID);
 
 	if (io == NULL) {
-- 
1.8.1.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help