Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1549888rwb; Wed, 26 Jul 2023 14:31:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlEseI0+QgSAebAEFx9bsH8yQ8uJxmYwQFTKMTCZFXHymHpG/xlM8yMih6EXqWJ6XDsOYsSk X-Received: by 2002:a17:906:77dc:b0:98e:f13:e908 with SMTP id m28-20020a17090677dc00b0098e0f13e908mr276471ejn.60.1690407071494; Wed, 26 Jul 2023 14:31:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1690407071; cv=pass; d=google.com; s=arc-20160816; b=S0AnBUvdUpBymQn4TYSAMRWy0e6oPqhNFWixsSCaneeNo/6yAGLEAQsnI8b2b9x4gA Aw5jTBjRecjarvFtPoTprj+xgTfmm1GhQ2C+kGCDKRUI66KRxmHCQfJSJK/pL117MG/5 KzltALWd3gt8DXtQYLWikib5uPfMFfDT4tPLSn9xP2n/zwNzUVitJdzUv6ZKn5Hfon2q vcjyu8Gzfwp7xpLN3yLV62MmTZBi9VFOIpUr5lbDHzMgICRO9C7kqLQNJ/dRf9aML46x r2PBGNtVvp57x52wKeS+1U4/KpjKHopML3PdkYSqQtlk7BwaKcNSd33gFT0IDlCU6+K+ Ih2g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7DNUUcIqQRI29RfL+gzzuUWprMVU8P/baS0HhcuDiT4=; fh=raBgKoRsHCwQLc6ReOhmOoEQ+DtSaNc74fugaHBwryI=; b=0mUv1VLal5VM6ijnF95rOgv2yiF1QpnNwssXYnCI/OmMfhxKXB5XiMbq55S2TuM79S oFVMtvQylNxQt2Sq6JB7V/cZ6pPZrNS0wvqPZEGCtewUBkBLoXEhCBY4z+FcwWXxQ+f5 s+vwdeWTotZontyoBjY3WkuveWJdoo96OwMr5BpzF2guAH60lYqvg4UvYi8xqO+3vP4T 1WH2Leyd+XyTSFz2UGbksig4dkj1+wKSN7LEnN02Z5D/5v5DQMNkjDhEQC055qcyAzp7 J4rYemgA7WD5mI+d73XqVPuXURzOjYGS0Ip/1pMvwlGutb8LvaWa001tbr+/Bnx7TW2h Gt0g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@iki.fi header.s=lahtoruutu header.b=p73JBeAE; arc=pass (i=1); spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d24-20020a17090694d800b00992bfd00fdbsi9766238ejy.971.2023.07.26.14.30.47; Wed, 26 Jul 2023 14:31:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@iki.fi header.s=lahtoruutu header.b=p73JBeAE; arc=pass (i=1); spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230385AbjGZVZh (ORCPT + 99 others); Wed, 26 Jul 2023 17:25:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230194AbjGZVZe (ORCPT ); Wed, 26 Jul 2023 17:25:34 -0400 Received: from lahtoruutu.iki.fi (lahtoruutu.iki.fi [IPv6:2a0b:5c81:1c1::37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DDEC2691 for ; Wed, 26 Jul 2023 14:25:27 -0700 (PDT) Received: from monolith.lan (91-152-120-101.elisa-laajakaista.fi [91.152.120.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pav) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4RB6Pc6ZBTz49QB3; Thu, 27 Jul 2023 00:25:24 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1690406724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7DNUUcIqQRI29RfL+gzzuUWprMVU8P/baS0HhcuDiT4=; b=p73JBeAE2lbmwSFvCkJSmd7EukEMr1bADTGU4QCxQaI6ljZUcfYXT5ZeD58ujc3qZiSwgE coFZFap2b8HmkkKtbwImjq72Ekp/912BODdc3kAIr6V/QeslgcQT+cw2hClY1cv4R+4kNv HpC27/kSx6eK9P76W9/Q0XvabjXVKa24sEwjDvL7Do1S7f0RD+HyZFY6TKdYIkyBsAFGv0 xjtlGIP9Ypc4G00UlzBedq4IhHT8ybrGSjzYCbxf7QVNvR1wrlEkVMvFkDdYzbs9pLgSsL lom55gWV3IFzCKEY/qbae4eW5qxIJk1dSEPvTMNJ2FixLmuiOb+8U21Qk/HoPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1690406724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7DNUUcIqQRI29RfL+gzzuUWprMVU8P/baS0HhcuDiT4=; b=ibMBBYN1QKFSUlbBGFTn499IfS7Z97Yb9INsvATQ9Osgqr+iv8eY6BsRmmJf6nmSYUCDDH cSwtwp6cE3jEaP9Hlc0CKMAnk9BeyKnXdiBNT302+xZZ2aD5+BfoL7nu36NHQE/0jgdvGB nnQn0q/m+h/m71jsB8Rie3gf5G9Meer1T75NEha7Ani5z9fukj5AnGcnKns1rmfBnjICWo tZdFEfj0ETTE87WF6OqeucmETsV3xzjUeK9i73qa2L/iEg3m8gkgaJOeY37W9Ow6pWkkQI dfLabeQoTF8CHYtg3XU05YwNOyDugm3XuMHdxN3cM2URL33sJmFDEpPgbkTypw== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=pav smtp.mailfrom=pav@iki.fi ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1690406724; a=rsa-sha256; cv=none; b=cIgTC2qsU7jjhDQma3YRsVUDDjMHbNC1UMGsJ317ok4FRAy0s6oP0jaA17IoIQqaTT83ym ZOThRYYG/TJQidr3xr1UB135e0KcuL2GnQlvGtv9Y424H7yFs5LkOoda1LP05I8uGCd3F+ sPTLvX3aNUGVtaQTlk2ilngA5AWv9CjUyI8VscPTjCH/kZBZ+EJZsCNltukAP6dstCkxbp HyDLIYJIml7+R6g4a4LB3S5Prt80bN6LPgxn5m0uIZkSrMG4AVRJx/V4A5y2r5v5hvtMRl q/xYOMBFh9mB4Fx6YoWDO5lxWowsnbYf4EadDlzuhMIvs6tqMuGJq2MWBvElUQ== From: Pauli Virtanen To: linux-bluetooth@vger.kernel.org Cc: Pauli Virtanen Subject: [PATCH BlueZ 3/5] iso-tester: test with large CIS_ID and invalid CIG_ID/CIS_ID Date: Thu, 27 Jul 2023 00:25:17 +0300 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Add test with a large CIS_ID and multiple CIS so it hits an error condition in current kernels (which is why the AC configuration is used). Add tests for invalid configurations with bad or duplicate IDs, and for trying to connect two CIS in same CIG without BT_DEFER_SETUP. ISO QoS CIG 0xF0 - Invalid ISO QoS CIS 0xF0 - Invalid ISO Connect2 CIG 0x01 - Success/Invalid ISO AC 6(ii) CIS 0xEF/auto - Success ISO AC 6(ii) CIS 0xEF/0xEF - Invalid --- Notes: Current bluetooth-next/master fails these tests with ISO QoS CIG 0xF0 - Invalid Timed out 2.301 seconds ISO QoS CIS 0xF0 - Invalid Failed 0.117 seconds ISO Connect2 CIG 0x01 - Success/Invalid Failed 0.189 seconds ISO AC 6(ii) CIS 0xEF/auto - Success Failed 0.196 seconds tools/iso-tester.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/tools/iso-tester.c b/tools/iso-tester.c index 8f43d7bec..9f853a0f9 100644 --- a/tools/iso-tester.c +++ b/tools/iso-tester.c @@ -95,6 +95,10 @@ QOS_FULL(0x01, 0x02, \ {}, QOS_IO(_interval, _latency, _sdu, _phy, _rtn)) +#define QOS_OUT_1_EF(_interval, _latency, _sdu, _phy, _rtn) \ + QOS_FULL(0x01, 0xEF, \ + {}, QOS_IO(_interval, _latency, _sdu, _phy, _rtn)) + #define QOS_IN(_interval, _latency, _sdu, _phy, _rtn) \ QOS_FULL(BT_ISO_QOS_CIG_UNSET, BT_ISO_QOS_CIS_UNSET, \ QOS_IO(_interval, _latency, _sdu, _phy, _rtn), {}) @@ -172,6 +176,7 @@ */ #define AC_6ii_1 QOS_OUT_1(10000, 10, 40, 0x02, 2) #define AC_6ii_2 QOS_OUT_1(10000, 10, 40, 0x02, 2) +#define AC_6ii_1_EF QOS_OUT_1_EF(10000, 10, 40, 0x02, 2) /* different CIS ID */ /* Two unidirectional CISes. Unicast Server is Audio Sink and Audio Source. * #1 - CIG 1 CIS 1 (input) * #2 - CIG 1 CIS 2 (output) @@ -801,6 +806,16 @@ static const struct iso_client_data connect_reject = { .expect_err = -ENOSYS }; +static const struct iso_client_data connect_cig_f0_invalid = { + .qos = QOS_FULL(0xF0, 0x00, {}, QOS_IO(10000, 10, 40, 0x02, 2)), + .expect_err = -EINVAL +}; + +static const struct iso_client_data connect_cis_f0_invalid = { + .qos = QOS_FULL(0x00, 0xF0, {}, QOS_IO(10000, 10, 40, 0x02, 2)), + .expect_err = -EINVAL +}; + static const uint8_t data_16_2_1[40] = { [0 ... 39] = 0xff }; static const struct iovec send_16_2_1 = { .iov_base = (void *)data_16_2_1, @@ -960,6 +975,22 @@ static const struct iso_client_data reconnect_ac_6ii = { .disconnect = true, }; +static const struct iso_client_data connect_ac_6ii_cis_ef_auto = { + .qos = AC_6ii_1_EF, + .qos_2 = AC_6ii_2, + .expect_err = 0, + .mconn = true, + .defer = true, +}; + +static const struct iso_client_data connect_ac_6ii_cis_ef_ef = { + .qos = AC_6ii_1_EF, + .qos_2 = AC_6ii_1_EF, + .expect_err = -EINVAL, + .mconn = true, + .defer = true, +}; + static const struct iso_client_data connect_ac_7i = { .qos = AC_7i_1, .qos_2 = AC_7i_2, @@ -2371,6 +2402,29 @@ static void test_connect2_seq(const void *test_data) setup_connect(data, 0, iso_connect2_seq_cb); } +static void test_connect2_nodefer(const void *test_data) +{ + struct test_data *data = tester_get_data(); + int sk, err; + + /* Second connect() shall fail, because CIG is then busy, + * but the first connect() shall succeed. + */ + setup_connect(data, 0, iso_connect_cb); + + sk = create_iso_sock(data); + if (sk < 0) { + tester_test_failed(); + return; + } + + err = connect_iso_sock(data, 1, sk); + if (err != -EINVAL) + tester_test_failed(); + + close(sk); +} + static void test_bcast(const void *test_data) { struct test_data *data = tester_get_data(); @@ -2518,6 +2572,12 @@ int main(int argc, char *argv[]) test_iso("ISO QoS - Invalid", &connect_invalid, setup_powered, test_connect); + test_iso("ISO QoS CIG 0xF0 - Invalid", &connect_cig_f0_invalid, + setup_powered, test_connect); + + test_iso("ISO QoS CIS 0xF0 - Invalid", &connect_cis_f0_invalid, + setup_powered, test_connect); + test_iso_rej("ISO Connect - Reject", &connect_reject, setup_powered, test_connect, BT_HCI_ERR_CONN_FAILED_TO_ESTABLISH); @@ -2545,6 +2605,10 @@ int main(int argc, char *argv[]) setup_powered, test_connect2); + test_iso2("ISO Connect2 CIG 0x01 - Success/Invalid", &connect_1_16_2_1, + setup_powered, + test_connect2_nodefer); + test_iso("ISO Defer Send - Success", &connect_16_2_1_defer_send, setup_powered, test_connect); @@ -2630,6 +2694,14 @@ int main(int argc, char *argv[]) setup_powered, test_reconnect); + test_iso2("ISO AC 6(ii) CIS 0xEF/auto - Success", + &connect_ac_6ii_cis_ef_auto, + setup_powered, test_connect); + + test_iso2("ISO AC 6(ii) CIS 0xEF/0xEF - Invalid", + &connect_ac_6ii_cis_ef_ef, + setup_powered, test_connect); + test_iso("ISO Broadcaster - Success", &bcast_16_2_1_send, setup_powered, test_bcast); test_iso("ISO Broadcaster Encrypted - Success", &bcast_enc_16_2_1_send, -- 2.41.0