Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp100079lqc; Thu, 7 Mar 2024 11:24:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV/a4vmysEhlOBxR8zv+QxnL2tP+OZH1Xpo6oukmn87mJUCIfJ7e/uZqVlyHZ9+NyH3zvzX20IlONQkCpttHGq0H6jrjIuxweED1tLn6w== X-Google-Smtp-Source: AGHT+IEEhQiwkqitguoiMMn8pGXb+/a23kGkk8fJCDZ5t7AjQiKJy9D0ZsdIut4be713OgX/wr+W X-Received: by 2002:a05:620a:10aa:b0:788:2682:9f5f with SMTP id h10-20020a05620a10aa00b0078826829f5fmr9478644qkk.76.1709839487191; Thu, 07 Mar 2024 11:24:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709839487; cv=pass; d=google.com; s=arc-20160816; b=kj6vvXd3WOkpWMIP0FsIuLnnrmfW1l9d8OPFaZOJzEIMGT1qZM6Eg8hw8yb+Xaslah Q9D4YyJkLDgdEzLhYHJhd4SBzOlYFPqWG2usNhUMupixX0itCAuO9839rJuoVo7mtjED nxLrE/wMjd2OyFzDz0eH94TTwR+bd4CDL5aRxpc/ALRKsdS3TH92tlvU5AupkvPEzC1V ksDtRVZ/N/+mIdVMj/2dyWia+c5kpp3+cxlayRTgbl9Ik6HRs5cKKUhPDk/PCr/Wsiw0 YY1VSnznbAc+iUPbEWsnWMHLBDiRKgIFK2GyHPpnuxlD51OxJGn6aBsRpTRp+vlpMPRj OUYw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=TiFAV90SIpd7wY4LKDgEcw02Uaeyn9m/sAsJWGY3kJE=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=PReLWsiNpPLmC0LmHCK2z5WvqPchC61ibeYQc0kXDkpDK6qQvtsDCfHOh5I6sHHGk/ LOdN1YwiVsVVFYPLpAMKNs7MWAoNEHgmU8YUmplIvpOaSROBJefAxocHyc8u6Htj/Lt6 PRPyAWbDUmQD704+u6pdEH7pmT8O0HS3IMa2kJBbm6rplOp9S41IG/gKXyuURS8LEJH+ qH0OnPh7Hit/pWj3muqdrtWK9pGWzLkWpVI8i3U0OK41iyMr6IxEDUd3uV1WN0tyUcup Ns5HbA0KRF1qlnpKdorUi95HKWQ/HmARR+6Dbr3bV6y07VbHsRvw+0o5CMrNCTqx2PgB ZOfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=eYQeRgAN; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-bluetooth+bounces-2362-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-2362-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c19-20020a05620a11b300b0078819573ce5si12612894qkk.576.2024.03.07.11.24.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 11:24:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-2362-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=eYQeRgAN; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-bluetooth+bounces-2362-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-2362-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D93401C216E2 for ; Thu, 7 Mar 2024 19:24:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 224E8136666; Thu, 7 Mar 2024 19:24:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="eYQeRgAN" X-Original-To: linux-bluetooth@vger.kernel.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 C1C00135417 for ; Thu, 7 Mar 2024 19:24:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709839477; cv=none; b=B2paQXgsBgQXhXq4K/tpN2BuvBPyImLBojlp/ab59AqjS0+r/s0Et39KHt1EGCyKXOiGpUcNMir5mYCGv1IavHOr0na0Pox4C/Aqqo/+EAOeMtaqvZJNd81mTzgpBogOjxSpxAc6RmrfoSw8sdnuZu2zag/MKAISqNNq+qkdIH0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709839477; c=relaxed/simple; bh=ps9tvKvFJLIBIO8CgVJbN3BXGiGVoICtbGtw5diAeKs=; h=From:To:Subject:Date:Message-Id:MIME-Version:Content-Type; b=QzxJGqu6PxYo5DtBQ/L+y6E8eP6UXMveFh1cDIwBLvTJSktta0EOGcSX5vuaDnCFtq2XGcIuMGnTldB9WolmrwwB83+wiMEkLQhrcGjSZmuGy2YEpFXwOuIsvXXVTzf39wrkYyXA29Mw5X307hebGUnR2VRfLWZ4Zt/IM3lMQMc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=eYQeRgAN; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1709839474; bh=ps9tvKvFJLIBIO8CgVJbN3BXGiGVoICtbGtw5diAeKs=; h=From:To:Subject:Date:From; b=eYQeRgANUMO+/hJiLjCpJUZAFpHdPUoMTs4YDtpYPXh5RyCb+vLoNDMI/0uV1a5QV TBmzSHxmrSCGwMV2QVcx53UjkcCH1+yJ5yabzXWkgcf2zXg7d0EzsA5fsEv0+IMiQl QR6ubrKTph3oxDX0EqhjOJmzXNZ09GCXoXoJ7UOBkfW9UIJS6pCYqi8b8GcNzrb86X PGTqZFtSLqDrY2VzoA0kC1DkWho5zRKrAf2k338PnAUY+pxemyu8Ppj9NUFxnzL65+ WaCVvGaX00ar3nl2jEiCV2pLUVAl3Jm+JKugf2iXDdC3JLXl5//0yHP8yb3QAqYuHO 1B/xfy8YVni1g== Received: from fdanis-XPS-13-9370.. (cola.collaboradmins.com [195.201.22.229]) (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) (Authenticated sender: fdanis) by madrid.collaboradmins.com (Postfix) with ESMTPSA id EC7323780B5F for ; Thu, 7 Mar 2024 19:24:33 +0000 (UTC) From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= 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 Message-Id: <20240307192427.1022124-1-frederic.danis@collabora.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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