Skip to contentSkip to conversation

Bluetooth: Only report LE scan responses with data content

PATCH New Marcel Holtmann 1 participant 1 message Mar 22, 2014

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH v2 1/1 Bluetooth: Only report LE scan responses with data content

When the LE scan response advertising report does not contain any advertising data, then do not report it as device found event.

All LE scan response advertising reports will be only send with a previous directed or undirected advertising report. Such a report is enough to discovery new devices. So an empty LE scan response advertising is of no value since it would just repeat an already known address and RSSI value.

---
 net/bluetooth/hci_event.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
net/bluetooth/hci_event.c +6 -4
index 9ee081b9c064..7e3b1b2559d5 100644
@@ -3945,7 +3945,6 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	u8 num_reports = skb->data[0];
 	void *ptr = &skb->data[1];
-	s8 rssi;
 
 	hci_dev_lock(hdev);
 
@@ -3957,9 +3956,12 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb)
 			check_pending_le_conn(hdev, &ev->bdaddr,
 					      ev->bdaddr_type);
 
-		rssi = ev->data[ev->length];
-		mgmt_device_found(hdev, &ev->bdaddr, LE_LINK, ev->bdaddr_type,
-				  NULL, rssi, 0, 1, ev->data, ev->length);
+		if (ev->evt_type != LE_ADV_SCAN_RSP || ev->length > 0) {
+			s8 rssi = ev->data[ev->length];
+			mgmt_device_found(hdev, &ev->bdaddr, LE_LINK,
+					  ev->bdaddr_type, NULL, rssi,
+					  0, 1, ev->data, ev->length);
+		}
 
 		ptr += sizeof(*ev) + ev->length + 1;
 	}
Signature · 1 line
1.8.5.3