Skip to contentSkip to conversation

mgmt-tester: Add LL Privacy host-resolved RPA scan checks

PATCH Applied Luiz Augusto von Dentz 3 participants 3 messages Oct 14 – Oct 15 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 mgmt-tester: Add LL Privacy host-resolved RPA scan checks

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

Controllers with LL Privacy resolve RPAs themselves, so peers with an IRK can be kept in the accept list and passive scanning shall use the accept list filter policy.

Assisted-by OpenCode:claude-opus-5.5
---
 tools/mgmt-tester.c | 84 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)
tools/mgmt-tester.c +84 -0
index 13484a6632ff..631c906f3aa8 100644
@@ -10758,6 +10758,70 @@ static const struct generic_data host_rpa_no_irk_autoconnect = {
 	.expect_hci_param_check_func = host_rpa_filtered_check,
 };
 
+static const uint8_t ll_privacy_rpa_filtered[] = {
+	0x00,			/* Own Address Type */
+	0x01,			/* Filter Policy - Accept List */
+	0x05,			/* PHYs - 1M and Coded */
+	0x00,			/* Type - Passive */
+	0x60, 0x00,		/* Interval */
+	0x30, 0x00,		/* Window */
+	0x00,			/* Type - Passive */
+	0x60, 0x00,		/* Interval */
+	0x30, 0x00,		/* Window */
+};
+
+static int ll_privacy_rpa_filtered_check(const void *param, uint16_t length)
+{
+	const struct bt_hci_cmd_le_set_ext_scan_params *cp = param;
+	const struct bt_hci_le_scan_phy *phy = (void *) cp->data;
+
+	if (length != sizeof(ll_privacy_rpa_filtered))
+		return -EINVAL;
+
+	return cp->filter_policy != 0x01 || phy[0].type != 0x00 ||
+							phy[1].type != 0x00;
+}
+
+static const struct generic_data ll_privacy_rpa_autoconnect = {
+	.setup_settings = settings_powered_le,
+	.setup_send_opcode = MGMT_OP_LOAD_IRKS,
+	.setup_send_param = load_irks_le_public_param_1,
+	.setup_send_len = sizeof(load_irks_le_public_param_1),
+	.send_opcode = MGMT_OP_ADD_DEVICE,
+	.send_param = add_device_le_public_param_1,
+	.send_len = sizeof(add_device_le_public_param_1),
+	.expect_param = add_device_rsp_le_public,
+	.expect_len = sizeof(add_device_rsp_le_public),
+	.expect_status = MGMT_STATUS_SUCCESS,
+	.expect_alt_ev = MGMT_EV_DEVICE_ADDED,
+	.expect_alt_ev_param = add_device_le_public_param_1,
+	.expect_alt_ev_len = sizeof(add_device_le_public_param_1),
+	.expect_hci_command = BT_HCI_CMD_LE_SET_EXT_SCAN_PARAMS,
+	.expect_hci_param = ll_privacy_rpa_filtered,
+	.expect_hci_len = sizeof(ll_privacy_rpa_filtered),
+	.expect_hci_param_check_func = ll_privacy_rpa_filtered_check,
+};
+
+static const struct generic_data ll_privacy_rpa_report = {
+	.setup_settings = settings_powered_le,
+	.setup_send_opcode = MGMT_OP_LOAD_IRKS,
+	.setup_send_param = load_irks_le_public_param_1,
+	.setup_send_len = sizeof(load_irks_le_public_param_1),
+	.send_opcode = MGMT_OP_ADD_DEVICE,
+	.send_param = host_rpa_report_param,
+	.send_len = sizeof(host_rpa_report_param),
+	.expect_param = add_device_rsp_le_public,
+	.expect_len = sizeof(add_device_rsp_le_public),
+	.expect_status = MGMT_STATUS_SUCCESS,
+	.expect_alt_ev = MGMT_EV_DEVICE_ADDED,
+	.expect_alt_ev_param = host_rpa_report_param,
+	.expect_alt_ev_len = sizeof(host_rpa_report_param),
+	.expect_hci_command = BT_HCI_CMD_LE_SET_EXT_SCAN_PARAMS,
+	.expect_hci_param = ll_privacy_rpa_filtered,
+	.expect_hci_len = sizeof(ll_privacy_rpa_filtered),
+	.expect_hci_param_check_func = ll_privacy_rpa_filtered_check,
+};
+
 static const struct generic_data host_rpa_no_irk_report = {
 	.setup_settings = settings_powered_le,
 	.send_opcode = MGMT_OP_ADD_DEVICE,
@@ -15856,6 +15920,26 @@ int main(int argc, char *argv[])
 	test_bredrle("Scan RPA - Background report without IRK",
 			&host_rpa_no_irk_report, NULL, test_command_generic);
 
+	/* LL Privacy
+	 * Setup: Enable LE, load IRK and Power On
+	 * Run: Add new device with auto-connect
+	 * Expect: Passive scanning uses the accept list since the controller
+	 *         resolves RPAs
+	 */
+	test_bredrle50("LL Privacy - Scan RPA - Auto-connect with IRK",
+				&ll_privacy_rpa_autoconnect,
+				setup_command_generic, test_command_generic);
+
+	/* LL Privacy
+	 * Setup: Enable LE, load IRK and Power On
+	 * Run: Add new device with background report
+	 * Expect: Passive scanning uses the accept list since the controller
+	 *         resolves RPAs
+	 */
+	test_bredrle50("LL Privacy - Scan RPA - Background report with IRK",
+				&ll_privacy_rpa_report,
+				setup_command_generic, test_command_generic);
+
 	/* LL Privacy
 	 * Setup: Enable LE and Power On
 	 * Run: Add new device
Signature · 1 line
2.56.0
#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/series/1185788/

---Test result---

Test Summary:

CheckPatch                    PASS      0.60 seconds
GitLint                       PASS      0.33 seconds
BuildEll                      PASS      19.72 seconds
BluezMake                     PASS      302.23 seconds
CheckSmatch                   PASS      296.18 seconds
bluezmakeextell               PASS      95.13 seconds
TestFunctional                PASS      1135.66 seconds
IncrementalBuild              PASS      302.77 seconds
ScanBuild                     PASS      1153.57 seconds

https://github.com/bluez/bluez/pull/2681

---
Regards,
Linux Bluetooth

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

Hello:

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

Quoted 9 lines · On Wed, 14 Oct 2026 14:11:53 -0400 you wrote:

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

Controllers with LL Privacy resolve RPAs themselves, so peers with an IRK can be kept in the accept list and passive scanning shall use the accept list filter policy.

Assisted-by OpenCode:claude-opus-5.5

[...]

Here is the summary with links:
- [BlueZ,v1] mgmt-tester: Add LL Privacy host-resolved RPA scan checks

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=fa6ba55020de

You are awesome, thank you!

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