2023-06-07 19:48:07

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH] 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.

Link: https://lore.kernel.org/linux-bluetooth/CABBYNZ+CYMsDSPTxBn09Js3BcdC-x7vZFfyLJ3ppZGGwJKmUTw@mail.gmail.com/
Fixes: c70a7e4cc8d2 ("Bluetooth: Add support for Not Connectable flag for Device Found events")
Signed-off-by: Luiz Augusto von Dentz <[email protected]>
---
include/net/bluetooth/mgmt.h | 1 +
net/bluetooth/hci_event.c | 15 +++++----------
2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 7eeec8501846..d382679efd2b 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -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 {
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 7c199f7361f7..13319757258f 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -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
--
2.40.1



2023-06-07 20:41:03

by bluez.test.bot

[permalink] [raw]
Subject: RE: Bluetooth: MGMT: Fix marking SCAN_RSP as not connectable

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

2023-06-20 18:36:53

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: MGMT: Fix marking SCAN_RSP as not connectable

Hello:

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

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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html