Skip to contentSkip to conversation

mgmt-tester: Add host-resolved RPA scan checks

RFC PATCH In review Kyle Pepper 2 participants 4 messages Oct 14 – Oct 29 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

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

Check unfiltered passive scanning for IRK peers on controllers without LL Privacy, with auto-connect and background-report controls.

Assisted-by OpenCode:gpt-6.1-sol

---
Companion to the kernel v2 "Bluetooth: hci_sync: scan unfiltered for host-resolved RPAs", responding to Luiz's mgmt-tester request in:
https://lore.kernel.org/linux-bluetooth/[email protected]/

This is the first submission of these BlueZ tests, not a v2 and not a cross-project apply-order series. It applies independently on BlueZ 9dc7e40962f1. The IRK cases intentionally fail on an unfixed kernel.

Native results on bluetooth-next 609a23989d63, KASAN/lockdep enabled:
upstream revised kernel

  Auto-connect with IRK           FAIL       PASS
  Background report with IRK      FAIL       PASS
  Auto-connect without IRK        PASS       PASS
  Background report without IRK   PASS       PASS

These assert passive-scan programming, not physical address rotation or successful radio reconnect. On the complete 512-case mgmt run, upstream has 503 pass/four fail/five not run; revision has 506 pass/one fail/five not run. Both have the "Set Static Address - Success 2" timeout. The upstream run also fails the two new IRK tests and the already-listed flaky "LL Privacy - Set Flags 3 (2 Devices to RL)" test. The latter's pass is not attributed to the RPA fix. No captured KASAN/lockdep alerts.

Maintainer-mode sanitizer build and 35/35 unit binaries pass. The complete mgmt suite is not clean; no physical hardware test is claimed.

 tools/mgmt-tester.c | 119 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 119 insertions(+)
tools/mgmt-tester.c +119 -0
index 992351e2e3..850d38e4ce 100644
@@ -10667,6 +10667,114 @@ static const char load_irks_le_public_param_1[] = {
 	0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
 };
 
+static const uint8_t host_rpa_report_param[] = {
+	0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc,
+	0x01,
+	0x00,
+};
+
+static const struct bt_hci_cmd_le_set_scan_parameters host_rpa_unfiltered = {
+	.filter_policy = 0x00,
+};
+
+static const struct bt_hci_cmd_le_set_scan_parameters host_rpa_filtered = {
+	.filter_policy = 0x01,
+};
+
+static int host_rpa_unfiltered_check(const void *param, uint16_t length)
+{
+	const struct bt_hci_cmd_le_set_scan_parameters *cp = param;
+
+	if (length != sizeof(*cp))
+		return -EINVAL;
+
+	return cp->type != 0x00 || cp->filter_policy != 0x00;
+}
+
+static int host_rpa_filtered_check(const void *param, uint16_t length)
+{
+	const struct bt_hci_cmd_le_set_scan_parameters *cp = param;
+
+	if (length != sizeof(*cp))
+		return -EINVAL;
+
+	return cp->type != 0x00 || cp->filter_policy != 0x01;
+}
+
+static const struct generic_data host_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_SCAN_PARAMETERS,
+	.expect_hci_param = &host_rpa_unfiltered,
+	.expect_hci_len = sizeof(host_rpa_unfiltered),
+	.expect_hci_param_check_func = host_rpa_unfiltered_check,
+};
+
+static const struct generic_data host_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_SCAN_PARAMETERS,
+	.expect_hci_param = &host_rpa_unfiltered,
+	.expect_hci_len = sizeof(host_rpa_unfiltered),
+	.expect_hci_param_check_func = host_rpa_unfiltered_check,
+};
+
+static const struct generic_data host_rpa_no_irk_autoconnect = {
+	.setup_settings = settings_powered_le,
+	.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_SCAN_PARAMETERS,
+	.expect_hci_param = &host_rpa_filtered,
+	.expect_hci_len = sizeof(host_rpa_filtered),
+	.expect_hci_param_check_func = host_rpa_filtered_check,
+};
+
+static const struct generic_data host_rpa_no_irk_report = {
+	.setup_settings = settings_powered_le,
+	.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_SCAN_PARAMETERS,
+	.expect_hci_param = &host_rpa_filtered,
+	.expect_hci_len = sizeof(host_rpa_filtered),
+	.expect_hci_param_check_func = host_rpa_filtered_check,
+};
+
 static const uint8_t add_device_le_public_param_2[] = {
 	0x11, 0x22, 0x33, 0x44, 0x55, 0x66,	/* BDADDR */
 	0x01,					/* Type - LE Public */
@@ -15737,6 +15845,17 @@ int main(int argc, char *argv[])
 				&set_exp_feat_unknown,
 				NULL, test_command_generic);
 
+	/* Bluetooth 4.0 has no controller-side address resolution. */
+	test_bredrle("Host RPA - Auto-connect with IRK", &host_rpa_autoconnect,
+				setup_command_generic, test_command_generic);
+	test_bredrle("Host RPA - Background report with IRK", &host_rpa_report,
+				setup_command_generic, test_command_generic);
+	test_bredrle("Host RPA - Auto-connect without IRK",
+				&host_rpa_no_irk_autoconnect, NULL,
+							test_command_generic);
+	test_bredrle("Host RPA - Background report without IRK",
+			&host_rpa_no_irk_report, NULL, test_command_generic);
+
 	/* LL Privacy
 	 * Setup: Enable LE and Power On
 	 * Run: Add new device

base-commit: 9dc7e40962f11d1d9a5568f8a7633a695288329c

#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/1185254/

---Test result---

Test Summary:

CheckPatch                    PASS      0.40 seconds
GitLint                       PASS      0.23 seconds
BuildEll                      PASS      17.37 seconds
BluezMake                     PASS      259.90 seconds
CheckSmatch                   PASS      245.53 seconds
bluezmakeextell               PASS      88.14 seconds
TestFunctional                PASS      1025.63 seconds
IncrementalBuild              PASS      266.77 seconds
ScanBuild                     PASS      992.30 seconds

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

---
Regards,
Linux Bluetooth

author
#2 lore raw
In reply to Kyle Pepper

Just checking in on this patch. Is there anything else I can do to help it move forward?

Quoted 174 lines · Kyle Pepper

Check unfiltered passive scanning for IRK peers on controllers without LL Privacy, with auto-connect and background-report controls.

Assisted-by OpenCode:gpt-6.1-sol

---
Companion to the kernel v2 "Bluetooth: hci_sync: scan unfiltered for host-resolved RPAs", responding to Luiz's mgmt-tester request in:
https://lore.kernel.org/linux-bluetooth/[email protected]/

This is the first submission of these BlueZ tests, not a v2 and not a cross-project apply-order series. It applies independently on BlueZ 9dc7e40962f1. The IRK cases intentionally fail on an unfixed kernel.

Native results on bluetooth-next 609a23989d63, KASAN/lockdep enabled:
upstream revised kernel

  Auto-connect with IRK           FAIL       PASS
  Background report with IRK      FAIL       PASS
  Auto-connect without IRK        PASS       PASS
  Background report without IRK   PASS       PASS

These assert passive-scan programming, not physical address rotation or successful radio reconnect. On the complete 512-case mgmt run, upstream has 503 pass/four fail/five not run; revision has 506 pass/one fail/five not run. Both have the "Set Static Address - Success 2" timeout. The upstream run also fails the two new IRK tests and the already-listed flaky "LL Privacy - Set Flags 3 (2 Devices to RL)" test. The latter's pass is not attributed to the RPA fix. No captured KASAN/lockdep alerts.

Maintainer-mode sanitizer build and 35/35 unit binaries pass. The complete mgmt suite is not clean; no physical hardware test is claimed.

 tools/mgmt-tester.c | 119 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 119 insertions(+)
tools/mgmt-tester.c +119 -0
index 992351e2e3..850d38e4ce 100644
@@ -10667,6 +10667,114 @@ static const char load_irks_le_public_param_1[] = {
 	0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
 };
 
+static const uint8_t host_rpa_report_param[] = {
+	0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc,
+	0x01,
+	0x00,
+};
+
+static const struct bt_hci_cmd_le_set_scan_parameters host_rpa_unfiltered = {
+	.filter_policy = 0x00,
+};
+
+static const struct bt_hci_cmd_le_set_scan_parameters host_rpa_filtered = {
+	.filter_policy = 0x01,
+};
+
+static int host_rpa_unfiltered_check(const void *param, uint16_t length)
+{
+	const struct bt_hci_cmd_le_set_scan_parameters *cp = param;
+
+	if (length != sizeof(*cp))
+		return -EINVAL;
+
+	return cp->type != 0x00 || cp->filter_policy != 0x00;
+}
+
+static int host_rpa_filtered_check(const void *param, uint16_t length)
+{
+	const struct bt_hci_cmd_le_set_scan_parameters *cp = param;
+
+	if (length != sizeof(*cp))
+		return -EINVAL;
+
+	return cp->type != 0x00 || cp->filter_policy != 0x01;
+}
+
+static const struct generic_data host_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_SCAN_PARAMETERS,
+	.expect_hci_param = &host_rpa_unfiltered,
+	.expect_hci_len = sizeof(host_rpa_unfiltered),
+	.expect_hci_param_check_func = host_rpa_unfiltered_check,
+};
+
+static const struct generic_data host_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_SCAN_PARAMETERS,
+	.expect_hci_param = &host_rpa_unfiltered,
+	.expect_hci_len = sizeof(host_rpa_unfiltered),
+	.expect_hci_param_check_func = host_rpa_unfiltered_check,
+};
+
+static const struct generic_data host_rpa_no_irk_autoconnect = {
+	.setup_settings = settings_powered_le,
+	.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_SCAN_PARAMETERS,
+	.expect_hci_param = &host_rpa_filtered,
+	.expect_hci_len = sizeof(host_rpa_filtered),
+	.expect_hci_param_check_func = host_rpa_filtered_check,
+};
+
+static const struct generic_data host_rpa_no_irk_report = {
+	.setup_settings = settings_powered_le,
+	.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_SCAN_PARAMETERS,
+	.expect_hci_param = &host_rpa_filtered,
+	.expect_hci_len = sizeof(host_rpa_filtered),
+	.expect_hci_param_check_func = host_rpa_filtered_check,
+};
+
 static const uint8_t add_device_le_public_param_2[] = {
 	0x11, 0x22, 0x33, 0x44, 0x55, 0x66,	/* BDADDR */
 	0x01,					/* Type - LE Public */
@@ -15737,6 +15845,17 @@ int main(int argc, char *argv[])
 				&set_exp_feat_unknown,
 				NULL, test_command_generic);
 
+	/* Bluetooth 4.0 has no controller-side address resolution. */
+	test_bredrle("Host RPA - Auto-connect with IRK", &host_rpa_autoconnect,
+				setup_command_generic, test_command_generic);
+	test_bredrle("Host RPA - Background report with IRK", &host_rpa_report,
+				setup_command_generic, test_command_generic);
+	test_bredrle("Host RPA - Auto-connect without IRK",
+				&host_rpa_no_irk_autoconnect, NULL,
+							test_command_generic);
+	test_bredrle("Host RPA - Background report without IRK",
+			&host_rpa_no_irk_report, NULL, test_command_generic);
+
 	/* LL Privacy
 	 * Setup: Enable LE and Power On
 	 * Run: Add new device

base-commit: 9dc7e40962f11d1d9a5568f8a7633a695288329c

#3 lore raw
In reply to Kyle Pepper

This is an automated email and please do not reply to this email.

Dear Submitter,

This series was picked up by the CI more than 2 weeks ago and the pull request created for it is still open, which means the series was never applied to the tree.

Series: [RFC] mgmt-tester: Add host-resolved RPA scan checks
Pull Request: https://github.com/bluez/bluez/pull/2676
Created: 2026-10-14 06:48:53+00:00

The pull request has been closed and no further action is taken on this series.

If the change should still be considered, it must be resent to the Linux Bluetooth mailing list ([email protected]) so that it is picked up again.

---
Regards,
Linux Bluetooth