mgmt-tester: Fix eir name length related tests
PATCH 1/1 mgmt-tester: Fix eir name length related tests
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(-)
tools/mgmt-tester.c +32 -34
@@ -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" */ };
Signature · 1 line
2.34.1
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=833551
---Test result---
Test Summary:
CheckPatch PASS 0.48 seconds GitLint PASS 0.32 seconds BuildEll PASS 24.19 seconds BluezMake PASS 1766.14 seconds MakeCheck PASS 13.45 seconds MakeDistcheck PASS 177.53 seconds CheckValgrind PASS 246.26 seconds CheckSmatch PASS 349.12 seconds bluezmakeextell PASS 120.72 seconds IncrementalBuild PASS 1715.70 seconds ScanBuild PASS 1041.43 seconds
---
Regards,
Linux Bluetooth
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 10 lines · On Thu, 7 Mar 2024 20:24:27 +0100 you wrote:
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"
[...]
Here is the summary with links:
- [BlueZ] mgmt-tester: Fix eir name length related tests
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a23239f591d7
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html