Skip to contentSkip to conversation

Bluetooth: MGMT: Fix marking SCAN_RSP as not connectable

PATCH Applied Luiz Augusto von Dentz 3 participants 3 messages Jun 7, 2023 – Jun 20, 2023

Subsystems (2)
lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: MGMT: Fix marking SCAN_RSP as not connectable

From: Luiz Augusto von Dentz <[email protected]>

When receiving a scan response there is no way to know if the remote device is connectable or not, so when it cannot be merged don't make any assumption and instead just mark it with a new flag defined as MGMT_DEV_FOUND_SCAN_RSP so userspace can tell it is a standalone SCAN_RSP.

Fixes c70a7e4cc8d2 ("Bluetooth: Add support for Not Connectable flag for Device Found events")
---
 include/net/bluetooth/mgmt.h |  1 +
 net/bluetooth/hci_event.c    | 15 +++++----------
 2 files changed, 6 insertions(+), 10 deletions(-)
include/net/bluetooth/mgmt.h +1 -0
index 7eeec8501846..d382679efd2b 100644
@@ -981,6 +981,7 @@ struct mgmt_ev_auth_failed {
 #define MGMT_DEV_FOUND_NOT_CONNECTABLE		BIT(2)
 #define MGMT_DEV_FOUND_INITIATED_CONN		BIT(3)
 #define MGMT_DEV_FOUND_NAME_REQUEST_FAILED	BIT(4)
+#define MGMT_DEV_FOUND_SCAN_RSP			BIT(5)
 
 #define MGMT_EV_DEVICE_FOUND		0x0012
 struct mgmt_ev_device_found {
net/bluetooth/hci_event.c +5 -10
index 7c199f7361f7..13319757258f 100644
@@ -6327,23 +6327,18 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
 		return;
 	}
 
-	/* When receiving non-connectable or scannable undirected
-	 * advertising reports, this means that the remote device is
-	 * not connectable and then clearly indicate this in the
-	 * device found event.
-	 *
-	 * When receiving a scan response, then there is no way to
+	/* When receiving a scan response, then there is no way to
 	 * know if the remote device is connectable or not. However
 	 * since scan responses are merged with a previously seen
 	 * advertising report, the flags field from that report
 	 * will be used.
 	 *
-	 * In the really unlikely case that a controller get confused
-	 * and just sends a scan response event, then it is marked as
-	 * not connectable as well.
+	 * In the unlikely case that a controller just sends a scan
+	 * response event that doesn't match the pending report, then
+	 * it is marked as a standalone SCAN_RSP.
 	 */
 	if (type == LE_ADV_SCAN_RSP)
-		flags = MGMT_DEV_FOUND_NOT_CONNECTABLE;
+		flags = MGMT_DEV_FOUND_SCAN_RSP;
 
 	/* If there's nothing pending either store the data from this
 	 * event or send an immediate device found event if the data
Signature · 1 line
2.40.1
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=755036

---Test result---

Test Summary:

CheckPatch                    PASS      0.88 seconds
GitLint                       FAIL      0.67 seconds
SubjectPrefix                 PASS      0.09 seconds
BuildKernel                   PASS      43.40 seconds
CheckAllWarning               PASS      46.08 seconds
CheckSparse                   WARNING   51.88 seconds
CheckSmatch                   WARNING   142.87 seconds
BuildKernel32                 PASS      42.15 seconds
TestRunnerSetup               PASS      592.76 seconds
TestRunner_l2cap-tester       PASS      20.87 seconds
TestRunner_iso-tester         PASS      30.92 seconds
TestRunner_bnep-tester        PASS      7.51 seconds
TestRunner_mgmt-tester        PASS      146.19 seconds
TestRunner_rfcomm-tester      PASS      11.75 seconds
TestRunner_sco-tester         PASS      10.98 seconds
TestRunner_ioctl-tester       PASS      13.07 seconds
TestRunner_mesh-tester        PASS      9.55 seconds
TestRunner_smp-tester         PASS      10.71 seconds
TestRunner_userchan-tester    PASS      7.93 seconds
IncrementalBuild              PASS      39.33 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
Bluetooth: MGMT: Fix marking SCAN_RSP as not connectable

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
11: B1 Line exceeds max length (113>80): "Link: https://lore.kernel.org/linux-bluetooth/CABBYNZ+CYMsDSPTxBn09Js3BcdC-x7vZFfyLJ3ppZGGwJKmUTw@mail.gmail.com/"
##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:
net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Luiz Augusto von Dentz
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 9 lines · On Wed, 7 Jun 2023 12:45:18 -0700 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

When receiving a scan response there is no way to know if the remote device is connectable or not, so when it cannot be merged don't make any assumption and instead just mark it with a new flag defined as MGMT_DEV_FOUND_SCAN_RSP so userspace can tell it is a standalone SCAN_RSP.

[...]

Here is the summary with links:
- Bluetooth: MGMT: Fix marking SCAN_RSP as not connectable

    https://git.kernel.org/bluetooth/bluetooth-next/c/8a84527ec1ac

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html