From patchwork Fri Jan 17 14:06:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 858328 Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazon11013045.outbound.protection.outlook.com [40.107.162.45]) (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 DB9F842AA6 for ; Fri, 17 Jan 2025 14:06:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.162.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737122821; cv=fail; b=beoU/SEQBHci352BNzmEhS43B7pup2fLDEP7+mJgqJUVq0WydZqvdrUX0fsgRh3x4n7Zb2iuX4HZskSk58yg7H+sbhLUJDO08+jK176Z8IEmI4GqqlDJ5vDOkJqjIop2hQUi9n/SVontcpl/s5ZMatuzBoDWIgXjyUOKrU+uUv0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737122821; c=relaxed/simple; bh=yLI/EnB83faayDZI4XTB90R+3krSh9ood25f6Vxb/Oo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=dWptQ+OX/+xZoF6BYnY1R/Bjs60aSxKhMhk7QKALPkMNEfRdrFYmIezPbdeMnuRXlWLwHPC4V9viQKtY1fb/On0wRmpq2GOSfb34tNV2Kfi9uZDHjRUnh25j6MsAZkgPysNG475wsgkRBxZVc5VJTbore61CrhUkwlFZnBDeEOA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=HdC92K5c; arc=fail smtp.client-ip=40.107.162.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="HdC92K5c" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PQiwmN65JY4C3hTNSZewqRUqeortv7UEccAT1hq3l3wrqh98Jmx3DUI4Q17t+P9z+xMNkcjyzFFgclhIIlGBGUPJLZ/GEFqAqHKWPIR6hwnm6s4ThDO2EEPXUDN8Meba+CWeo4HzW5L03lU6o4xG8lT6nkAG8qd7KIcm3ZrB2ni/sxRS5Lvj9WibPKu49wOZ9tHFSpxapk/83zKknG98rWkFP/209APvBxErzTHd4lBE7CWh6SpV301b9pOorgMhmE3U4nkJSgZKg+0aKv3JaCYvSdUSw5EzVl/UIJW2aD/BblQgbUEzWQjVGTxpuZtULdO53kncRRrWOf0PbXrwhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HJjQAJyT6SIDopFjxSTSa/cAyI7tQPGHK97mL6TR9JQ=; b=Egoq4NoX10k0EN+fPRKKGKX0pacLYxdzOjND5p5gyZZLyZI1z7+NMMVwVKZfENQyvSMua0QEUZDI5ubRGtBEq4E+Vl7oVfIMsRCO8W5IR3un6L5U0ucoSoChbM3hqSwWK4CI7eiXCJ4Dnou88cYgsmCmPGnkANV/ko51k4HYMlDEeasxItkl7wVbaUzMcQj65yZX9cLd7/tupwIzMUSZD5t0A0KAuj4x190yiarzeDMia8zQpImi8TNTX1qx7JsKmjOQgo4EOIm+i9UGUHTkIRITAEIY49EsU3hkgUab5zRtcYHQhX9VcfntYJgVwci+OLSowpeP1Y/4PT8WgnWvxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HJjQAJyT6SIDopFjxSTSa/cAyI7tQPGHK97mL6TR9JQ=; b=HdC92K5cTZqb4W1r4F/ELWoAMAE+E7wG8g+LPOPAsYfCF1HOCdMEleSHVCdBDd96kHdtjYIB2JHFoi/qYueFATJxCPwA59m5w1/geZBVNVHPMuAPMHNvOFELlUmA5e9ItU8r6u3UKWp5qSMdLp8ANFGV/Hef0X0otXxVE4frv/W58z3ZReHfuBqgvPFPBA6R4D7EXcaNHmQMByLrb2SQG0GL99UP32G3wq8YY1/PubO+KJcypGS7316GDrmCs/HDbB3bzDPJazVUbDp9DTzVzMSWZBVz9gWLv9BsBD4yC+VeyZE0synG9KDz/Muehxi2qh9h1eUL6dwtg8zkArMZ5g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8909.eurprd04.prod.outlook.com (2603:10a6:102:20c::19) by GVXPR04MB10201.eurprd04.prod.outlook.com (2603:10a6:150:1b7::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.16; Fri, 17 Jan 2025 14:06:56 +0000 Received: from PAXPR04MB8909.eurprd04.prod.outlook.com ([fe80::d39b:a5b:8f24:ae30]) by PAXPR04MB8909.eurprd04.prod.outlook.com ([fe80::d39b:a5b:8f24:ae30%6]) with mapi id 15.20.8335.017; Fri, 17 Jan 2025 14:06:55 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 1/2] btio: Set correct length for getsockopt Date: Fri, 17 Jan 2025 16:06:31 +0200 Message-ID: <20250117140632.120501-2-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250117140632.120501-1-iulia.tanasescu@nxp.com> References: <20250117140632.120501-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM4PR0302CA0004.eurprd03.prod.outlook.com (2603:10a6:205:2::17) To PAXPR04MB8909.eurprd04.prod.outlook.com (2603:10a6:102:20c::19) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8909:EE_|GVXPR04MB10201:EE_ X-MS-Office365-Filtering-Correlation-Id: 88879bb6-371c-464e-f5a7-08dd3700332d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: 9iXmedsZR2CZoy3bufSJsFpWzYYGJrTSkro4Z3UsnmDdHwawN7YdyvTG9+f5wkMQMddI2yD8xXedy2m7dXMcLE7ggWRdroIfidASjvk2PskmCN5wgGWiSaitF0e7MSEj88iyd1wY7rWpv7S0WKD1uXBDYcm4anMWQfRM58bclumTnSBlfDsLIBcnKmodkHxI/YxvCvUH9VNdOaWuHJrKHbYFDnU1X/fdwOePqL60wQUX/tVIkdW7LsrxYKsMrYPrwm8BiSCuibBQl2yWus7Fn3ZONA/Km0qU6b+4ttGGyUYpk1d8kklSzr+sEtvymaS/yKuLUCy3Pr8N4QKmEJxCizmzj2GE8XMzEpOPIHH03pQuG4/lXHcsGSmcTGNaSH9/2r+mBrZu7Pdqf60Rbsu4dLRS/QnWW69UK/9GRXIGdOGjnsJXgX3YmVoPHvAzgDVwW3w1VXOH3e4yMpIJYMf985ePohthnQdBrPmyIMEMBUUb1sXd1fBnKmj6gJI/4sBaxT2dw0IThhHOloP5rdR27qUspQpbLiIEWCq7ZKOVrv4LITiczz3FkR8FKJWYyjAC9hHwmidPbuOEE/WuCUSdFBqskWeIexx08MPQE5DN3GNTrt+3I18F8PBWeytMPUmagVEw7/Jn2WxFdHbP0I2c7VStsee85bnQ8Nueti2tngO2wzdanS9Lt3vvk1EhRFciLbGdMj8tL99s/w145N1b8sI50OfDVDvWCa6x5YCgjjsSVGMRNNtFo0ZyrHm7joEGgzjtjomP0+wEkRfWAHjAnHIfAF6dMNFSVhIPuZqJruvJg6FDxvIG6C24PbhXBjWlYZQZF08tvqTPfJx6nDKM7+ymVGE8hMvXdLZ1am99FfX+EF4KeatXY+/U41ABgutt+WmGH9UTbhqljyhdPXM4PXXg3wnHAXd3IxbjlvWwEFNOUdy38784DYXjNHO8gfIQmc9C+R9pxglkggt+W58SKsMt5zXDBlh796pGpN76cne4+LPMkOMWhDCOOG5ymsTxhfpkAAqYFIS7cTvEzMdMFOQjqt8AWBbiRPQ0ID7NF5DrUYdUna4PYT2tMAIybXB7btV+/NVk36JFKfWmBPTaddU4MHEqcdKzoOW3Ek9j7y5hGJpbGxFkKSuFrQdWlu1+4OgTWdajaGTcmQVXiUwffKIU2TSTrBR2mz5cmPrrc8ZP3NU+zKdNTSw3Q7IghRbF1QHTfkw7EXI+lvoDupCCyvZ4YoLn/mWTR/Kor+qKbiIzFJQFoCiVqEeGWEx6lbJ8Hw07JdrXeLvH7Gf0B8CmtXQLsMZ7ijeF2V0aivRdeL0vc4/wH5n9w4/XVfs3tVbDlVNXT972JadBXtHudQ/8HNzSXLu2ciRGsIRjMdTgpMWrAE+iQUC7wtv6Oj1rchkh X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8909.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WXPC+bpv7JmNAnVKFWn0EOc7wDU2ui/TedhIBv2ythebKpjTRh7KQc1POa4IYHP8En2zZkAQETWDiPdgxJdzNnLxx5Yjf/CZBA1IdopkRBsbxicRJosRj7U6rJx/hsX/oceajINyYqWSsEwDs8Azy2yc7E3MkGDo1TLEXNDn+uF1tYO2Ugoj72ssWRPEn6YZMrM0vApZqcVUurCLaPAQ8Khqfv7Zg6QsYgf/NrNpGQKf6y0RUbIZrtMN8JDZKwFE2VRtOV1FEGxAtI+RDP/brfZbrFzXpqqyRGs/s1LwpMMXGIJuJKdiXr3l2PmGBbdZOb+6s4KOitEI8A0nebpcoNQXc1kmatFoeYzUemprQ/ORlLirsvOWDHWZj8qQ6OK5QvihVLQlfJL3otVVDPC/HUoFkALMCXs9Wrd01yfAhtT4EeEafUBgJecGRZZkkI2LqXr95oquCrARlk/D/MPJdo7vnDxvoer8TK8lufp/N556BDg7KWRd5gPRseU6njt8urWyD7nbCrud+cZaYGS6ZMD0NnTGI4yjCumH5bru1q1HfxkvnBoVUWakavSo6gGYRhvk7MMnfVFEDj7ugjhyXvpLU84STYUPaZIqZWisKrojx98cQ1cnPVSst6T3Ytyh4IPluUvhh7n1uMY4hX7sXs7EnLzz+QPM+di/YLJXaMK1EAh0rXnffLMwxwzCUwQmoWkMaDySEfwq43sWNXytLQ1tTC4iB57o+D8hVL1XAax3jGfjcH+EM9wQyKka5KhdaWt/q+pgKcIYnVIcJm+Nrn86LS0sF86tCnHmt+PwBftdPlKAtKeakgapzPrrt1qQHLJQreEj7Y+MN6FJ+7WQsvfkPdhky4GnSq2SfpNa7cmQH62xYQjLKNLBCoW07QCnMjnrHG1OXQJVjHc93YNfBlmCoMa73A/lYtApbBXiSbNgqk9o2dd2evmLteQjxwRRPgUWK77OSShQIHzb5Sszb3R3FUNq3RGaINbRMrgNqUPZLDviMzYYVmTfYjfWGi095UF6dzaJET9aRufGHTQSIG0vqXi6sjhXMMvUHvvYZCjso44LlXu/octe1yewUK1KwYZ6dGwCEIJvqL4IiWqQJfHOxLPwiJf+nn0RYcup1RNioff5D/xSE3jefaH0hNDz3dlAZjoyxPrKbCboLBKY7ORAKmvYlY7YAU+VlGVWxAg2ns23VROZI0ZZkvY3bhStQGK0MWBpUgJVj7QMaEai1kswkK6dkyhRLU/Am/5DJ90Jtf1W2c1weTJfGzveS0D2Ta7vt6AtCvIUy147MuKzNa9o7yNXCuQcP2K3ouGh5iTxQAXpUoJqtpGok7qDfpqezUQvNDHzL7EOGlGa/ODXZrqczGc9Z/k02wqRyrO7wQvwQofF+LukJrHdeimDDZr35i/QCw2n2+rFl7P9GpdwieLQebYnsTuyvedXMInPYhPZrJzflmYOneO7LxfKDAXoR1Lv+denllrzMs5JtxDzSxiAG/D57TggXwMokQseDwUDBXrXPCCerQA+uBkgeFgYJ5JULJxpVigLip67dIAobn1INYHjxlRdVSUzg0R4b7bu8dpixy7Mw9snkpA+aAh/cSkKMc2bZH7owOkml/5yfg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88879bb6-371c-464e-f5a7-08dd3700332d X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8909.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2025 14:06:55.6855 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FiuWi9TOxb613H2JG8zYKRu4NiD9T6hwBQdThkhJdWYHfQ2M0x3VhUSKP+7YO7aaKAeoUMpkwnbevb4+1jHPGg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10201 When calling getsockopt for BT_ISO_BASE, this initializes the length argument to the maximum size of the buffer where the bytes are placed. This fixes the fact that, on a Broadcast Sink, if the BASE discovered from a Broadcast Source exceeds a certain length, the bytes will be incompletely read, causing issues when parsing the LTVs. --- btio/btio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/btio/btio.c b/btio/btio.c index 2d277e409..f32fbd509 100644 --- a/btio/btio.c +++ b/btio/btio.c @@ -5,7 +5,7 @@ * * Copyright (C) 2009-2010 Marcel Holtmann * Copyright (C) 2009-2010 Nokia Corporation - * Copyright 2023-2024 NXP + * Copyright 2023-2025 NXP * * */ @@ -1654,6 +1654,7 @@ static gboolean iso_get(int sock, GError **err, BtIOOption opt1, va_list args) return FALSE; } + len = BASE_MAX_LENGTH; if (getsockopt(sock, SOL_BLUETOOTH, BT_ISO_BASE, &base.base, &len) < 0) { ERROR_FAILED(err, "getsockopt(BT_ISO_BASE)", errno); From patchwork Fri Jan 17 14:06:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 859878 Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazon11013045.outbound.protection.outlook.com [40.107.162.45]) (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 5571F1FFC5B for ; Fri, 17 Jan 2025 14:07:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.162.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737122823; cv=fail; b=s51yTqZy9S+dalxlZqpc091ILq423DunkRDbCkeB+EgimFsBvcBE6zrTMAbqLdUCsDUcRON7h8WNWKXURXxen5RDOrIXN/bhfYI7qZ6zFFiX6r8P7pAL2hLB7NB7Zck1jJ2blu1NBso/OL3IEYOIMHlsGAQdk4vVJlCAbL0idPE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737122823; c=relaxed/simple; bh=1hqs7Ymm0Zc6AMGm/ok5wrRfgBicZaqVDL9L/5u/IHA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=qKefQnzaTHSHf0RnKTdNA2jwprJeL7lWtRmH2v/FadTb/muQqkMOl+DyR53uMVoalb/MZWxBMO+AFwEeIAx0joRrTE3EK/MM+nCYpfmGsrQpx5DLfGTRxqhrHZJxluR1jYxWNW9221l9zzmhM9N7LmmKt1yn7S+Rv2SnPGT5V7Y= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=lbfelFL2; arc=fail smtp.client-ip=40.107.162.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="lbfelFL2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ec9GUff+j7ZKwK65xDBGD/2GHHNMjRccFHQ3hHEFfSCZvouHGOVdEBbnnTeZxOCgEQxkFQt+DmX9wXajzQrHB9RdD2/w7FSkb77UV7iq7Q/rZnyXlSZ/jwrN/k3MHd9/3J9pt/aFpOui/vcawhGUVQwk2N1eFsG0rqJZ7Hqw91PL/w5y0hKPLtYZuLJegGhPPYzBqZA35ZBARG9G7sccvBfaH/vN2cbQdSX6ZEabr4l6wXd75OGn6RGk3aDjQ5yoLbUivNZ2ZFl2XXOigbYXNv/OHLEJdz8r/HnOHnHpirWHKRTlct66oMo8Wddv6tQMbwQ2x3QbsqR5lZGddWorpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=N8aWeYrV7zfyYLj6SwuXJh6GKyuTuC38HMeSiTDtuOY=; b=LwWCU05kpXBR18MqZFQm84XcIg7HmfSmiL9xtPUfR0c5jeb1JJ10fm3jZstJH/iYLqJRBzbDTIwQER+wjExn1zG4p/IvwL6y/vziMJCfF+RuyyPIFPLoBRSRfFLbUUhd4IKjdYIfJLBMfzxWVijGftZka1GyY23ckGxCt5bNjtcqbpyT+N2ot7EB+A166T7iIpmuy/6QIILLHGbVuNZ0JHvccK2S/XjaMEAL+AWUs9TRW0r9h0hcSap5LX0togeKwqbUaWOIl/8TU9c3yV/+1AVlnDoMPuRd6KNOfEm6oofZY+Ff6LnXE4cQSz8yDJ3OnRo1TJcjWwj7ikt55a61eA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N8aWeYrV7zfyYLj6SwuXJh6GKyuTuC38HMeSiTDtuOY=; b=lbfelFL2wzzCxnG6Vbop1/fjbFU98kpSTZ73h4lQlxjoIU6/glXkBqKC1CoQpmeKbPa6Xu20tIAKj1iGyycQl47Yzy1XVj0EMzMiW2zS1iOIr+Aciha0BnGRbJabY/UuC4jmgHYntqshwwgrBwlxMaUV1AyU9OZobXVZtQVC7IHZhwroLOap1RU671LVx84pRrc9lVKPTSYpFfkMyG/CycvBHA4i4eWkx07I9pXOiJyB/TCHr+E8l8HGoUo5WZ8JNnlBMYPocxpIUd6LolForL90JX3sipUtnM9bkV9TeBJZAkRLg11/1JuuIt7mvn3RhMeaAn3F/+XBzgrOAOadIA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8909.eurprd04.prod.outlook.com (2603:10a6:102:20c::19) by GVXPR04MB10201.eurprd04.prod.outlook.com (2603:10a6:150:1b7::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.16; Fri, 17 Jan 2025 14:06:59 +0000 Received: from PAXPR04MB8909.eurprd04.prod.outlook.com ([fe80::d39b:a5b:8f24:ae30]) by PAXPR04MB8909.eurprd04.prod.outlook.com ([fe80::d39b:a5b:8f24:ae30%6]) with mapi id 15.20.8335.017; Fri, 17 Jan 2025 14:06:59 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 2/2] shared/bap: Append extra L3 LTVs to BIS config Date: Fri, 17 Jan 2025 16:06:32 +0200 Message-ID: <20250117140632.120501-3-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250117140632.120501-1-iulia.tanasescu@nxp.com> References: <20250117140632.120501-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AS4PR09CA0022.eurprd09.prod.outlook.com (2603:10a6:20b:5d4::14) To PAXPR04MB8909.eurprd04.prod.outlook.com (2603:10a6:102:20c::19) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8909:EE_|GVXPR04MB10201:EE_ X-MS-Office365-Filtering-Correlation-Id: e6490cfe-8108-40f6-5e03-08dd3700354d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: vnTp4ix4sux4gkYIMf3t+VjQY1FBmPhWoFBlftKLMEOtffHPwtSg2nKn2lGTEU7wr8JAMy9Idu8DwzAdXnw6UZVwcVjbxfC7ZiRIVEMLioqMgdAT74z0cxclI2tRGgSbN8+2KRHdtVsVjWuC3bJHlvh6vg0z7ZrWp8mOZbUyh2tT2cRJws+6BAbQzbHG3bR3r/+WbC+GGv/7hQpFcDizue7nBqpvFktDASxGY37rGcLh4lmjhxuBrWrvmGMKCkxTrkWgEVvUtlwGlPslby/q57Gt7OFDrx1P3v8mBaB+VMa/k51Ptk4IN5hbpbDa92CJltDJWp+u2+8TEhl+jAF+IeJSUnEZRPxy1kfcWidHAttSOi2TiMMjcxCE7vn5LSYc4teHWB8Qwug3TIjutyZDszGA6v9MHc4Hy8hTfEeRl1qVAnG/rx8FrHQ4Lo0/kHbiTSlgt/f+VNshGTdZdU5itIvenw58MmzGqCChnB+eMoHHcAirkHBsz2cos9DplYetnTREsUtLepyry9mFXHcmOymw5t7uGusWbQ3oi20OPKprh4Bnep53EN0vEcegdFsSURTCHCHIibLFl+2YYoJPD7lsNCNQu6gqvxmI6ffVWf2Ed5R1IZB7XH8iEvbHmbh6Ok4pZR53Ag9ORiA8Z+ua+NwueJg9XJzgr7IU0cd3AYYOzDnh3m8O8igPNXKJXvnlDJAofqLSev6I3nA0oyJpzzdUqLSv4EKdpaxsL/TdPqfFU1RvENBIlx9PcDBeIyg70H1ZEsLNlK8veZmeUqMhA6BRIFsRXggvhShsjsvftKXjyCRkidTCZ3IrcZsIrABy9G5lNiedX9SlkJw7invJ9Un146Ir/0QlWUY+HgW6/McwPCDvDGHRsUTgtE4vcZCj/B2WXLct1T68Jda4mlKF1lJCp9QzMHfhnvekQW6t/SXYbpur2R+tNdVSnQBzwG9438YuffHfqjjgRoIT1b4wU0V0+GcHQSFlLpsetY3kg9ht/TuCUr4LWTcd6A/MroCpSSiICtG4VKT13nuJlBhi5KeKGlzviP90mr2SV86R0DcNUfyjPmE4RASfFxajGEf4TLmB8gpUmSdskW4f9/TaNdW175aQFScl6/l8QtbiEe0wVJWDimysgnVA0MhSrRlOkzTEU96TQ/l5S75walrDwYh5/D4vzT570AYYnO/BxLspJ6FUkGBXlWeEtNWGydKCLuu4GA8wMC31dVSrFTfq+1oC5obeW1rKlIB9Em7Z7L1OEgFQouSLikceHG3Jkpc7WTiPqe4M6XwtWXNy02hDthGZBoYVGsj4hw/cQ7PCUuoVZqk7RbBNBIkbSPI4VQmnyNPqSt/SEWUKqFm+GOekDS5QjVRhmBQ65xg5Qnu/ZV58quE51TgtwRBMwjDRKorB X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8909.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Tbtxms0EaLx80eoSAILna04aok65JOGwCyvB8pZiRFep+MDqVq+ws+w9CwpQYb4R8EG756F7+kaOXhuPDIgbBO6HHIRLvIH1vxGf5l+nHnuLgqz42hosWD1qHTfkOZMdHytyBdV/RzEavKcJCyHiBjrcTOICvFGUcXlAgaGtq0eZK2h+bfkVrOT+Coo8S27cfP9EwBud3yO7mD+c02BRHvsXa6diekRPxHqeDzt6k3QUTWaY7YzOTIvu1mcJkiGUHaLD9n1Xzkf3DFYq0XuS9v3z11UineHcHTNk8em3OpoCdJ7Nucu+79FbaoYkdzsze2AW/WpuFm93bDR0f6+Ex5S9mjnokU3CyEsHEmynmSMETNf/2kiqrXR0+SVrcLP+ZKaFepp6fOrKHUpeKGR2SPlaWPNWZIPskmJ+6gN9r3cxhrR0GjhN9txn1/c+S8mhgI8hzXMl+sBPplTw6StfNd05vchzgxX8XG9+BvfBrYy+ZXMZDOpCc3nI9oqaZvkWAVB5N98ZpiYMIgO+LQoAVcPwScyB2bA+2IgK+QYRvVRiX5DajKOHb9dnxRdnoTCZHvIF5G+iHa23KG6FM6G1Zax/rbtAfpGMKhx8NyBphXcj3ErzH2dSqPnF1uVIjBjUPtOPYkhkPPgXaORzWUKktT9usDMvRP5MDo4+yG3ABGNcGAKltcRltdtlDJFFPxcfGfsnLQcfwq25V5rpQ7gCuKssFc5XrwbrDLtL1FBhCbNAAQ47WlX8DpS2q1B4RUwRysmiXRa7ignBWtoh+oBagAdVyO2Mw3FBRnsbVXB3aYHzSHryf5MiakHzneuz9EtFPl4hWaGGXigWzeM64upruGO46RCdi9zWw8EKpCUQT2ugeeVeE8KdmDuBNIJ/nSwDp+hu7y5GCzPJ0hBIU2UuROTrHEPP9dBqlR3yfZQX1x3q1IeZd0VxGLRGpsTVUzfRptVvlKB0EaQH4XA9QRawFiHFqTcCn24FTsA9guslB0Kl+87W0l5xhAYZ1UO6a6RC7dyPJbkqyOx8LQHrq8lO2oWYalTYV9m5DTO6I3rZTkxh64/cfvNq5RtgGC9q/G2PlbCNltIrBzkSaS7W4YTRtNbvRDIi2TwfyfqEo23GlwLiiNu9QJGZguNaw8tno8LbhhozfgsIeZgvDcAXk0TJirCBhXekOrOFiN4HPrkIESZbqSHnTHGzPNvO2WmdPDvkjsA/9+vDt8tXDviGDD8TKE6Vav9Ejp8oKLJdDMIb42dRlxurgIONCuu9q4iHHk3twgIfsuYJPIwFp/IW5me+2AYwTHqnGgh4EmmPr/VJpCtKyD6xHr5CECInHk88h3PwbvbgICoiCdNv9G/SEtJD6bfEH9i7HB4MS0mh2km321mkushloVmdZ/LhFksA3iytzEeOHdbFg2/MObuRjnqv/w3MUu+cSk0QduJ8+DVKVuDyYiSl/kjO/TAhdKsAy2Ub+vjQmnmdvvQRj0FEIxVvC2WCbV02JBYtirWvJN4P0ZAFGBkR4nM0k1QcpIVoT09WoI+knx2mFkt8mUOGG84MhutZOQ4bNUxAuWvhzl22pQFgW40oCjbNde4ciPa0thiUbpmhOFYjrd8C0YUCn2kVyA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6490cfe-8108-40f6-5e03-08dd3700354d X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8909.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2025 14:06:59.3487 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zU2QF6l+UQZK2M7OMqjiW8pmw9EC1fByOF49S65OBBUQksOg6nhVfCxuusaEtx3t/T/g4iMjRtX8jBurEdVX5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB10201 According to the BAP spec, the level 3 of the BASE contains codec configuration LTVs specific to each BIS, in addition to the configuration provided at level 2 (subgroup level) (v1.0.1, section 3.7.2.2 Basic Audio Announcements). Currently, when a Broadcast Sink parses the BASE discovered from a Broadcast Source, level 3 LTV types that are not also present at level 2 are not included in the final BIS cofiguration, causing incorrect stream handling. This updates the BASE parsing logic to consider level 3 LTVs. --- src/shared/bap.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 167501282..6ffeefa41 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -4,7 +4,7 @@ * BlueZ - Bluetooth protocol stack for Linux * * Copyright (C) 2022 Intel Corporation. All rights reserved. - * Copyright 2023-2024 NXP + * Copyright 2023-2025 NXP * */ @@ -6921,6 +6921,24 @@ static void bap_sink_check_level2_ltv(size_t i, uint8_t l, uint8_t t, util_ltv_push(merge_data->result, l, t, v); } +static void bap_sink_append_level3_ltv(size_t i, uint8_t l, uint8_t t, + uint8_t *v, void *user_data) +{ + struct bt_ltv_extract *merge_data = user_data; + + merge_data->value = NULL; + util_ltv_foreach(merge_data->result->iov_base, + merge_data->result->iov_len, + &t, + bap_sink_check_level3_ltv, merge_data); + + /* If the LTV at level 3 was not found in merged configuration, + * append value + */ + if (!merge_data->value) + util_ltv_push(merge_data->result, l, t, v); +} + static void check_local_pac(void *data, void *user_data) { struct bt_ltv_match *compare_data = user_data; @@ -7028,6 +7046,14 @@ struct iovec *bt_bap_merge_caps(struct iovec *l2_caps, struct iovec *l3_caps) NULL, bap_sink_check_level2_ltv, &merge_data); + /* Append LTVs at level 3 (BIS) that were not found at + * level 2 (subgroup) + */ + util_ltv_foreach(l3_caps->iov_base, + l3_caps->iov_len, + NULL, + bap_sink_append_level3_ltv, &merge_data); + return merge_data.result; }