summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJakub Pawlowski <jpawlowski@google.com>2015-03-04 19:24:26 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2015-03-05 02:50:50 -0500
commit82f8b651a94d5c7090563fe55cfdb286c461a16c (patch)
tree8f18cc6e68060a709189c5af747c55e740a7469b /net/bluetooth/mgmt.c
parent2976cdeb27c83c83bf010a314309f07659ead228 (diff)
Bluetooth: fix service discovery behaviour for empty uuids filter
This patch fixes service discovery behaviour, when provided uuid filter is empty and HCI_QUIRK_STRICT_DUPLICATE_FILTER is set. Before this patch, empty uuid filter was unable to trigger scan restart, and that caused inconsistent behaviour in applications. Example: two DBus clients call BlueZ, one to find all devices with service abcd, second to find all devices with rssi smaller than -90. Sum of those filters, that is passed to mgmt_service_scan is empty filter, with no rssi or uuids set. That caused kernel not to restart scan when quirk was set. That was inconsistent with what happen when there's only one of those two filters set (scan is restarted and reports devices). To fix that, new variable hdev->discovery.result_filtering was introduced. It can indicate that filtered scan is running, no matter what uuid or rssi filter is set. Signed-off-by: Jakub Pawlowski <jpawlowski@google.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index bc09c5a37032..967f07fdbbbe 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3933,8 +3933,7 @@ static void start_discovery_complete(struct hci_dev *hdev, u8 status,
3933 */ 3933 */
3934 if (test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, 3934 if (test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER,
3935 &hdev->quirks) && 3935 &hdev->quirks) &&
3936 (hdev->discovery.uuid_count > 0 || 3936 hdev->discovery.result_filtering) {
3937 hdev->discovery.rssi != HCI_RSSI_INVALID)) {
3938 hdev->discovery.scan_start = jiffies; 3937 hdev->discovery.scan_start = jiffies;
3939 hdev->discovery.scan_duration = timeout; 3938 hdev->discovery.scan_duration = timeout;
3940 } 3939 }
@@ -4087,6 +4086,7 @@ static int start_service_discovery(struct sock *sk, struct hci_dev *hdev,
4087 */ 4086 */
4088 hci_discovery_filter_clear(hdev); 4087 hci_discovery_filter_clear(hdev);
4089 4088
4089 hdev->discovery.result_filtering = true;
4090 hdev->discovery.type = cp->type; 4090 hdev->discovery.type = cp->type;
4091 hdev->discovery.rssi = cp->rssi; 4091 hdev->discovery.rssi = cp->rssi;
4092 hdev->discovery.uuid_count = uuid_count; 4092 hdev->discovery.uuid_count = uuid_count;
@@ -7344,8 +7344,7 @@ void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
7344 return; 7344 return;
7345 } 7345 }
7346 7346
7347 if (hdev->discovery.rssi != HCI_RSSI_INVALID || 7347 if (hdev->discovery.result_filtering) {
7348 hdev->discovery.uuid_count > 0) {
7349 /* We are using service discovery */ 7348 /* We are using service discovery */
7350 if (!is_filter_match(hdev, rssi, eir, eir_len, scan_rsp, 7349 if (!is_filter_match(hdev, rssi, eir, eir_len, scan_rsp,
7351 scan_rsp_len)) 7350 scan_rsp_len))