From patchwork Mon Jan 29 11:48:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jonas_Dre=C3=9Fler?= X-Patchwork-Id: 13535449 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A144D60871 for ; Mon, 29 Jan 2024 11:49:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706528959; cv=none; b=SLsfbm//sOmn7yFqcj16KcJkS6ULxQhfipJXjn6RHwuX9VDa4olyWmYNEw861cw+p5jyAIFxQfUDw2LGrio/qPfp7PcosMWtXJjUhHKCWCXYZiKZgOWCJt0vFK1fTe7EqeEohcC12XKWo2rC18RpbYR9AAdi6Yz52TIWoNRKyVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706528959; c=relaxed/simple; bh=oP7hkoD4y9SFvkJUps5sHkG78trHf0ZIoGP9okY2syI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jnaZ5ErEJ1plP8kdlFPgYqBj9pIcjJGdMy5O7y5biVEN6XbhBTceFXgDtNrdzXhveiSOe1vqpn0925y+hvbBbWm/zJRry2JKFaH+GnooAor6jt271WPMms6c9I3FBOsED3IOun/PgOjQKmPn+frCcoxFPYSB4V7nloRtC+Vk2hY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=v0yd.nl; spf=pass smtp.mailfrom=v0yd.nl; arc=none smtp.client-ip=80.241.56.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=v0yd.nl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=v0yd.nl Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4TNmmM2LYFz9sqj; Mon, 29 Jan 2024 12:49:07 +0100 (CET) From: =?utf-8?q?Jonas_Dre=C3=9Fler?= To: linux-bluetooth@vger.kernel.org, Luiz Augusto von Dentz Cc: =?utf-8?q?Jonas_Dre=C3=9Fler?= Subject: [PATCH BlueZ 1/4] mgmt-tester: Add a 0-opcode to expect_hci_list lists Date: Mon, 29 Jan 2024 12:48:57 +0100 Message-ID: <20240129114900.92919-2-verdre@v0yd.nl> In-Reply-To: <20240129114900.92919-1-verdre@v0yd.nl> References: <20240129114900.92919-1-verdre@v0yd.nl> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4TNmmM2LYFz9sqj In add_expect_hci_list() we iterate through the entries of the expect_hci_list as long as there is an opcode, which means currently this relies on overflowing the buffer to detect the end of the list. This is not great and when running with address sanitizer, the out-of-bounds read gets detected and mgmt-tester aborts. Fix it by adding a trailing 0-opcode to all those lists. --- tools/mgmt-tester.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index 7dfd1b0c7..ee12ed7d5 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -8798,6 +8798,9 @@ static const struct hci_cmd_data multi_ext_adv_add_second_hci_cmds[] = { .len = sizeof(le_set_ext_adv_enable_inst_2), .param = le_set_ext_adv_enable_inst_2, }, + { + .opcode = 0, + }, }; static const struct generic_data multi_ext_advertising_add_second_2 = { @@ -8845,6 +8848,9 @@ static const struct hci_cmd_data multi_ext_adv_remove_adv_hci_cmds[] = { .len = sizeof(advertising_instance1_param), .param = advertising_instance1_param, }, + { + .opcode = 0, + }, }; static const struct generic_data multi_ext_advertising_remove = { @@ -8877,6 +8883,9 @@ static const struct hci_cmd_data multi_ext_adv_remove_all_adv_hci_cmds[] = { { .opcode = BT_HCI_CMD_LE_CLEAR_ADV_SETS, }, + { + .opcode = 0, + }, }; static const struct generic_data multi_ext_advertising_remove_all = { @@ -8913,6 +8922,9 @@ static const struct hci_cmd_data multi_ext_adv_add_2_advs_hci_cmds[] = { .len = sizeof(set_ext_adv_data_test1), .param = set_ext_adv_data_test1, }, + { + .opcode = 0, + }, }; static const struct generic_data multi_ext_advertising_add_no_power = { @@ -10378,6 +10390,9 @@ static const struct hci_cmd_data ll_privacy_add_device_3_hci_list[] = { .param = set_resolv_on_param, .len = sizeof(set_resolv_on_param), }, + { + .opcode = 0, + }, }; static const struct generic_data ll_privacy_add_device_3 = { @@ -10495,6 +10510,9 @@ static const struct hci_cmd_data ll_privacy_add_device_9_hci_list[] = { .len = sizeof(le_add_to_resolv_list_param), .param = le_add_to_resolv_list_param }, + { + .opcode = 0, + }, }; static const struct generic_data ll_privacy_add_device_9 = { @@ -10823,6 +10841,9 @@ static const struct hci_cmd_data ll_privacy_set_device_flags_1_hci_list[] = { .param = set_resolv_on_param, .len = sizeof(set_resolv_on_param), }, + { + .opcode = 0, + }, }; static const uint8_t device_flags_changed_params_1[] = { From patchwork Mon Jan 29 11:48:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jonas_Dre=C3=9Fler?= X-Patchwork-Id: 13535450 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D77696086B for ; Mon, 29 Jan 2024 11:49:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706528959; cv=none; b=mQzQUAH/6KU/sqj+ZFDGm7P1LE9PKDcJna+WXBQk0ZC9pWRbY789+xchcrabbQTsYlMYrg2TH5I9LN2sOQLa2SE339yqJy04JyjoP9cmkI9cBQBog/MwZNzPB9FH0NCZA94/b92k9FWe/zD6tINNLyBNqt+sOKVpwrtAP11+MPg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706528959; c=relaxed/simple; bh=JrdX4gG/uCk0OZpF5qXRdtzFqv9g7kPjMhpd30rLtjQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PCnFkO1g4UaWeZmdDYZ1aK2zwKhRs96Dqq2AiqQTKITO4hxE3akmLgBeTX6ngpm30WYwkl5l99/QZ0cy4IBOACqhrhJD9sNcMp0oL0rNU6ntueiUan4UhhpnfUBSD5f8BXWURn1Nps4YtxLLxeVk3HrKjfdTvKFI9ui0ukLW9AI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=v0yd.nl; spf=pass smtp.mailfrom=v0yd.nl; arc=none smtp.client-ip=80.241.56.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=v0yd.nl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=v0yd.nl Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4TNmmN2S8bz9sZv; Mon, 29 Jan 2024 12:49:08 +0100 (CET) From: =?utf-8?q?Jonas_Dre=C3=9Fler?= To: linux-bluetooth@vger.kernel.org, Luiz Augusto von Dentz Cc: =?utf-8?q?Jonas_Dre=C3=9Fler?= Subject: [PATCH BlueZ 2/4] mgmt-tester: Adjust a test for recent kernel changes Date: Mon, 29 Jan 2024 12:48:58 +0100 Message-ID: <20240129114900.92919-3-verdre@v0yd.nl> In-Reply-To: <20240129114900.92919-1-verdre@v0yd.nl> References: <20240129114900.92919-1-verdre@v0yd.nl> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4TNmmN2S8bz9sZv With the changes in the kernel to move to hci_sync for connecting ACL devices (see kernel commit "Bluetooth: hci_conn: Only do ACL connections sequentially", https://lore.kernel.org/linux-bluetooth/20240108224614.56900-1-verdre@v0yd.nl/), the "ETIMEDOUT" error path for the "HCI Create Connection" command was changed, sending a "HCI Create Connection Cancel" after the timeout. This leads to the returned error in the "Pair Device - Power off 1" test to change from NOT_POWERED to DISCONNECTED, so adjust for that. --- tools/mgmt-tester.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index ee12ed7d5..7c9e63cbb 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -3216,7 +3216,7 @@ static const struct generic_data pair_device_power_off_test_1 = { .send_opcode = MGMT_OP_PAIR_DEVICE, .send_func = pair_device_send_param_func, .force_power_off = true, - .expect_status = MGMT_STATUS_NOT_POWERED, + .expect_status = MGMT_STATUS_DISCONNECTED, .expect_func = pair_device_expect_param_func, }; From patchwork Mon Jan 29 11:48:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jonas_Dre=C3=9Fler?= X-Patchwork-Id: 13535451 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46DE25D8FE for ; Mon, 29 Jan 2024 11:49:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706528961; cv=none; b=Z91/1QD2g0HqjswXsD0wAi6nI31AsGuTYsYKijYrCuIU9RdN6p6lF4gZbyKMLI93rZhcwdghX4WJyLzOPpSLRdxpptxOhJMioDqZEs9G14084ydScJn/2f5XqDYOGKHNYJJJr8qE8tuTTqOvFRXh1Vaqf8ArAtxg/tHJJAN4kqg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706528961; c=relaxed/simple; bh=tJ+QG345hAeqhkWfdmnPB882FgeVkgs+i41FMpoqWHk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ip8iFpTTyMAtW1ndI6FpWfjYHMFJUk1qxOpi9FpZNpLCofxR/vTYqzjtDax1m8e+oXrHW5TYWTvNi9dVK2oG2RaC+ZLVeo8PUx7a8LlNhrXwPEjK3Nw0vdXBDyQTHcQBiDrN+zoxxIc0RcgCKuHel1GeZuwg8MDJNJnoP9DN+fk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=v0yd.nl; spf=pass smtp.mailfrom=v0yd.nl; arc=none smtp.client-ip=80.241.56.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=v0yd.nl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=v0yd.nl Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4TNmmP1m7Xz9sPy; Mon, 29 Jan 2024 12:49:09 +0100 (CET) From: =?utf-8?q?Jonas_Dre=C3=9Fler?= To: linux-bluetooth@vger.kernel.org, Luiz Augusto von Dentz Cc: =?utf-8?q?Jonas_Dre=C3=9Fler?= Subject: [PATCH BlueZ 3/4] emulator/btdev: Send page timeout after 2 secs delay Date: Mon, 29 Jan 2024 12:48:59 +0100 Message-ID: <20240129114900.92919-4-verdre@v0yd.nl> In-Reply-To: <20240129114900.92919-1-verdre@v0yd.nl> References: <20240129114900.92919-1-verdre@v0yd.nl> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4TNmmP1m7Xz9sPy Real bluetooth adapters wouldn't send the page timeout immediately when trying to page a device, instead it would take a few seconds. Try to behave more realistically in the emulator and send the page timeout after two seconds. --- emulator/btdev.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index da94f29d1..a40117400 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -1281,6 +1281,27 @@ static void conn_complete(struct btdev *btdev, send_event(btdev, BT_HCI_EVT_CONN_COMPLETE, &cc, sizeof(cc)); } +struct page_timeout_data { + struct btdev *btdev; + uint8_t bdaddr[6]; + unsigned int timeout_id; +}; + +static bool page_timeout(void *user_data) +{ + struct page_timeout_data *pt_data = user_data; + struct btdev *btdev = pt_data->btdev; + const uint8_t *bdaddr = pt_data->bdaddr; + + timeout_remove(pt_data->timeout_id); + pt_data->timeout_id = 0; + + conn_complete(btdev, bdaddr, BT_HCI_ERR_PAGE_TIMEOUT); + + free(pt_data); + return false; +} + static int cmd_create_conn_complete(struct btdev *dev, const void *data, uint8_t len) { @@ -1298,7 +1319,14 @@ static int cmd_create_conn_complete(struct btdev *dev, const void *data, send_event(remote, BT_HCI_EVT_CONN_REQUEST, &cr, sizeof(cr)); } else { - conn_complete(dev, cmd->bdaddr, BT_HCI_ERR_PAGE_TIMEOUT); + struct page_timeout_data *pt_data = new0(struct page_timeout_data, 1); + pt_data->btdev = dev; + memcpy(pt_data->bdaddr, cmd->bdaddr, 6); + + /* Send page timeout after 2 seconds to emulate real paging */ + pt_data->timeout_id = timeout_add(2000, + page_timeout, + pt_data, NULL); } return 0; From patchwork Mon Jan 29 11:49:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jonas_Dre=C3=9Fler?= X-Patchwork-Id: 13535452 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E4735F879 for ; Mon, 29 Jan 2024 11:49:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706528962; cv=none; b=rW+nO8seIGS08MA+Pac/Tv4+SR0mdiiIaGCqIBIm7txytMJqutw+UymnIsdBNY7tvstMvMlryyC6NQs014O+q4J1t7eF6wuYrrXJRgV2/0IjGeXnNv0m3NiXCTJ4LG/jNLKVx3H202ANV5/fwNa9pmkgSmPHnhI8NwNqMATXaJo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706528962; c=relaxed/simple; bh=j5fH4V9hA95lM71XuXOuDaI9BGPe+sN6DFdj3snRNaE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kR/igzCfbsQHsCvvZGPrrXH7yc8Py17KcoJkR5GSzeqpOFu4mPVd+YzjA2BTGM/mtQ5vkjNgDq5dWivZ9yMoGcULh57BSQDgPv/kYJkNlnXDPM2i1sn+d7px3u/lBHpp572jv7bn6qrM3P0UZU48ZZ6YWdWGw9joPlEfsRk2VYo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=v0yd.nl; spf=pass smtp.mailfrom=v0yd.nl; arc=none smtp.client-ip=80.241.56.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=v0yd.nl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=v0yd.nl Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4TNmmQ1Tm0z9ssh; Mon, 29 Jan 2024 12:49:10 +0100 (CET) From: =?utf-8?q?Jonas_Dre=C3=9Fler?= To: linux-bluetooth@vger.kernel.org, Luiz Augusto von Dentz Cc: =?utf-8?q?Jonas_Dre=C3=9Fler?= Subject: [PATCH BlueZ 4/4] mgmt-tester: Add a test for connecting sequentially Date: Mon, 29 Jan 2024 12:49:00 +0100 Message-ID: <20240129114900.92919-5-verdre@v0yd.nl> In-Reply-To: <20240129114900.92919-1-verdre@v0yd.nl> References: <20240129114900.92919-1-verdre@v0yd.nl> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The kernel was recently changed to only connect to ACL devices sequentially (see kernel commit "Bluetooth: hci_conn: Only do ACL connections sequentially"), similar to how it already behaves for LE devices. Add some testing for this behavior to mgmt-tester and make sure that new "HCI Create Connection" commands only get sent after the previous "Pair Device" MGMT command has failed. --- tools/mgmt-tester.c | 106 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index 7c9e63cbb..39a3b59dd 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -12781,6 +12781,103 @@ static void test_hci_devcd(const void *test_data) tester_wait(test->dump_data->timeout + 1, verify_devcd, NULL); } +static const struct generic_data sequential_connect = { + .setup_settings = settings_powered_bondable, + .pin = pair_device_pin, + .pin_len = sizeof(pair_device_pin), + .client_pin = pair_device_pin, + .client_pin_len = sizeof(pair_device_pin), +}; + +struct pair_devices_data { + struct test_data *test_data; + unsigned int n_connect_failed_evts; + unsigned int n_create_conn_commands; +}; + +static void pair_device_command_callback(uint8_t status, uint16_t length, + const void *param, void *user_data) +{ + struct pair_devices_data *pd_data = user_data; + + if (status != MGMT_STATUS_CONNECT_FAILED) { + tester_warn("Unexpected status got %d expected %d", + status, MGMT_STATUS_CONNECT_FAILED); + tester_test_failed(); + free(pd_data); + return; + } + + tester_print("Connect failed for Pair Device"); + + pd_data->n_connect_failed_evts++; + if (pd_data->n_connect_failed_evts != pd_data->n_create_conn_commands) { + tester_test_failed(); + free(pd_data); + return; + } + + if (pd_data->n_connect_failed_evts == 3) { + test_condition_complete(pd_data->test_data); + free(pd_data); + } +} + +static bool connect_multiple_create_conn(const void *data, uint16_t len, + void *user_data) +{ + struct pair_devices_data *pd_data = user_data; + const uint8_t *status = data; + + if (*status == 0) { + tester_print("Create connection finished"); + + pd_data->n_create_conn_commands++; + if (pd_data->n_connect_failed_evts != pd_data->n_create_conn_commands - 1) { + tester_test_failed(); + free(pd_data); + } + } else { + tester_print("Create connection failed: 0x%02x", *status); + tester_test_failed(); + free(pd_data); + } + + return true; +} + +static void test_sequential_connect(const void *test_data) +{ + struct test_data *data = tester_get_data(); + struct pair_devices_data *pd_data; + static uint8_t param[8] = { + 0x31, 0xAB, 0xCD, 0x32, 0x34, 0x73, /* random bdaddr so we fail to connect */ + BDADDR_BREDR, + 0x03, /* NoInputNoOutput */ + }; + + pd_data = new0(struct pair_devices_data, 1); + pd_data->test_data = data; + pd_data->n_connect_failed_evts = 0; + pd_data->n_create_conn_commands = 0; + + hciemu_add_hook(data->hciemu, HCIEMU_HOOK_POST_CMD, + BT_HCI_CMD_CREATE_CONN, + connect_multiple_create_conn, pd_data); + + mgmt_send_nowait(data->mgmt, MGMT_OP_PAIR_DEVICE, data->mgmt_index, + sizeof(param), param, + pair_device_command_callback, pd_data, NULL); + param[2] = 0x09; /* change bdaddr a bit */ + mgmt_send_nowait(data->mgmt, MGMT_OP_PAIR_DEVICE, data->mgmt_index, + sizeof(param), param, + pair_device_command_callback, pd_data, NULL); + param[2] = 0x10; /* change bdaddr a bit */ + mgmt_send_nowait(data->mgmt, MGMT_OP_PAIR_DEVICE, data->mgmt_index, + sizeof(param), param, + pair_device_command_callback, pd_data, NULL); +} + int main(int argc, char *argv[]) { tester_init(&argc, &argv); @@ -14946,5 +15043,14 @@ int main(int argc, char *argv[]) test_bredrle_full("HCI Devcoredump - Dump Timeout", &dump_timeout, NULL, test_hci_devcd, 3); + /* Sequential connect + * Setup: Power on + * Run: Try connecting to multiple devices + * Expect: Connects time out sequentially + */ + test_bredrle_full("Sequential connect", + &sequential_connect, NULL, + test_sequential_connect, 7); + return tester_run(); }