From: "Frédéric Danis" <frederic.danis@collabora.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ] mgmt-tester: Fix eir name length related tests
Date: Thu, 7 Mar 2024 20:24:27 +0100 [thread overview]
Message-ID: <20240307192427.1022124-1-frederic.danis@collabora.com> (raw)
According to Section 1.2 of Core Specification Supplement Part A the
complete or short name strings are defined as utf8s, which should not
include the trailing NULL for variable length array as defined in Core
Specification Vol1 Part E Section 2.9.3.
This patch remove the trailing NULL in expected packets, and update the
lengths accordingly, to be in sync with Kernel patch "Bluetooth: Fix eir
name length"
---
tools/mgmt-tester.c | 66 ++++++++++++++++++++++-----------------------
1 file changed, 32 insertions(+), 34 deletions(-)
diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index e85fbacda..884078905 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -1839,14 +1839,13 @@ static const char set_adv_set_local_name_param[260] = { 'T', 'e', 's', 't', ' ',
'n', 'a', 'm', 'e' };
static const uint8_t set_adv_scan_rsp_data_name_1[] = {
- 0x0c, /* Scan rsp data len */
- 0x0b, /* Local name data len */
+ 0x0b, /* Scan rsp data len */
+ 0x0a, /* Local name data len */
0x09, /* Complete name */
0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, /* "Test name" */
- 0x00, /* null */
/* padding */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const struct generic_data set_adv_on_local_name_test_1 = {
@@ -1879,17 +1878,16 @@ static const struct setup_mgmt_cmd set_advertising_mgmt_cmd_arr[] = {
};
static const uint8_t set_adv_scan_rsp_data_name_and_appearance[] = {
- 0x10, /* scan rsp data len */
+ 0x0f, /* scan rsp data len */
0x03, /* appearance data len */
0x19, /* eir_appearance */
0x54, 0x65, /* appearance value */
- 0x0b, /* local name data len */
+ 0x0a, /* local name data len */
0x09, /* complete name */
0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, /* "test name" */
- 0x00, /* null */
/* padding */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
@@ -7852,8 +7850,8 @@ static const uint8_t add_advertising_param_name[] = {
};
static const uint8_t set_scan_rsp_data_name_fits_in_scrsp[] = {
- 0x0c, /* Scan rsp data len */
- 0x0b, /* Local name data len */
+ 0x0b, /* Scan rsp data len */
+ 0x0a, /* Local name data len */
0x09, /* Complete name */
0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, /* "Test name" */
/* padding */
@@ -7878,8 +7876,8 @@ static const struct generic_data add_advertising_name_fits_in_scrsp = {
};
static const uint8_t set_scan_rsp_data_shortened_name_fits[] = {
- 0x0d, /* Scan rsp data len */
- 0x0c, /* Local name data len */
+ 0x0c, /* Scan rsp data len */
+ 0x0b, /* Local name data len */
0x08, /* Short name */
0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x31,
/* "Test name1" */
@@ -7905,8 +7903,8 @@ static const struct generic_data add_advertising_shortened_name_in_scrsp = {
};
static const uint8_t set_scan_rsp_data_short_name_fits[] = {
- 0x07, /* Scan rsp data len */
- 0x06, /* Local name data len */
+ 0x06, /* Scan rsp data len */
+ 0x05, /* Local name data len */
0x08, /* Short name */
0x54, 0x65, 0x73, 0x74,
/* "Test*/
@@ -7946,16 +7944,16 @@ static const uint8_t add_advertising_param_name_data_ok[] = {
};
static const uint8_t set_scan_rsp_data_param_name_data_ok[] = {
- 0x1e, /* Scan rsp data len */
+ 0x1d, /* Scan rsp data len */
/* scan rsp data */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0b, /* Local name data len */
+ 0x0a, /* Local name data len */
0x09, /* Complete name */
- 0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x00,
+ 0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65,
/* "Test name" */
/* padding */
- 0x00,
+ 0x00, 0x00,
};
static const struct generic_data add_advertising_name_data_ok = {
@@ -8050,19 +8048,19 @@ static const struct setup_mgmt_cmd add_advertising_mgmt_cmd_arr[] = {
};
static const uint8_t set_scan_rsp_data_name_data_appear[] = {
- 0x1e, /* Scan rsp data len */
+ 0x1d, /* Scan rsp data len */
0x03, /* appearance len */
0x19, /* EIR_APPEARANCE */
0x54, 0x65, /* appearance value */
/* scan rsp data */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
- 0x0b, /* Local name data len */
+ 0x0a, /* Local name data len */
0x09, /* Complete name */
- 0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x00,
+ 0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65,
/* "Test name" */
/* padding */
- 0x00,
+ 0x00, 0x00,
};
static const struct generic_data add_advertising_name_data_appear = {
@@ -8976,11 +8974,11 @@ static const uint8_t set_ext_scan_rsp_data_name_fits_in_scrsp[] = {
0x01, /* handle */
0x03, /* complete data */
0x01, /* controller should not fragment */
- 0x0c, /* Scan rsp data len */
- 0x0b, /* Local name data len */
+ 0x0b, /* Scan rsp data len */
+ 0x0a, /* Local name data len */
0x09, /* Complete name */
/* "Test name" */
- 0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x00,
+ 0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65,
};
static const struct generic_data add_ext_advertising_name_fits_in_scrsp = {
@@ -9003,11 +9001,11 @@ static const uint8_t set_ext_scan_rsp_data_shortened_name_fits[] = {
0x01, /* handle */
0x03, /* complete data */
0x01, /* controller should not fragment */
- 0x0d, /* Scan rsp data len */
- 0x0c, /* Local name data len */
+ 0x0c, /* Scan rsp data len */
+ 0x0b, /* Local name data len */
0x08, /* Short name */
/* "Test name1" */
- 0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x31, 0x00,
+ 0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x31,
};
static const struct generic_data add_ext_advertising_shortened_name_in_scrsp = {
@@ -9030,13 +9028,13 @@ static const uint8_t set_ext_scan_rsp_data_param_name_data_ok[] = {
0x01, /* handle */
0x03, /* complete data */
0x01, /* controller should not fragment */
- 0x1e, /* Scan rsp data len */
+ 0x1d, /* Scan rsp data len */
/* scan rsp data */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0b, /* Local name data len */
+ 0x0a, /* Local name data len */
0x09, /* Complete name */
- 0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x00,
+ 0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65,
/* "Test name" */
};
@@ -9073,16 +9071,16 @@ static const uint8_t set_ext_scan_rsp_data_name_data_appear[] = {
0x01, /* handle */
0x03, /* complete data */
0x01, /* controller should not fragment */
- 0x1e, /* Scan rsp data len */
+ 0x1d, /* Scan rsp data len */
0x03, /* appearance len */
0x19, /* EIR_APPEARANCE */
0x54, 0x65, /* appearance value */
/* scan rsp data */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
- 0x0b, /* Local name data len */
+ 0x0a, /* Local name data len */
0x09, /* Complete name */
- 0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x00,
+ 0x54, 0x65, 0x73, 0x74, 0x20, 0x6e, 0x61, 0x6d, 0x65,
/* "Test name" */
};
--
2.34.1
next reply other threads:[~2024-03-07 19:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 19:24 Frédéric Danis [this message]
2024-03-07 21:08 ` [BlueZ] mgmt-tester: Fix eir name length related tests bluez.test.bot
2024-03-08 16:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240307192427.1022124-1-frederic.danis@collabora.com \
--to=frederic.danis@collabora.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).