All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Only report LE scan responses with data content
@ 2014-03-22  5:55 Marcel Holtmann
  0 siblings, 0 replies; only message in thread
From: Marcel Holtmann @ 2014-03-22  5:55 UTC (permalink / raw)
  To: linux-bluetooth

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.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
 net/bluetooth/hci_event.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 9ee081b9c064..505220ce5deb 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -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_IND || 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;
 	}
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-22  5:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-22  5:55 [PATCH] Bluetooth: Only report LE scan responses with data content Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.