* [PATCH BlueZ 0/2] shared/bap: Fix BASE parsing
@ 2025-01-17 14:06 Iulia Tanasescu
2025-01-17 14:06 ` [PATCH BlueZ 1/2] btio: Set correct length for getsockopt Iulia Tanasescu
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Iulia Tanasescu @ 2025-01-17 14:06 UTC (permalink / raw)
To: linux-bluetooth
Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu,
luiz.dentz, Iulia Tanasescu
This patch adds some fixes for the BASE parsing logic in BAP:
The first commit fixes the getsockopt call for BT_ISO_BASE, to
make sure that the correct BASE length is read from the kernel.
The second commit adds a missing case in the BASE parsing logic
for Broadcast Sinks: the BASE structure might contain level 3
(BIS specific) configuration LTV types that are not present at
level 2 (subgroup level). These values should also be appended
to the final BIS configuration.
Iulia Tanasescu (2):
btio: Set correct length for getsockopt
shared/bap: Append extra L3 LTVs to BIS config
btio/btio.c | 3 ++-
src/shared/bap.c | 28 +++++++++++++++++++++++++++-
2 files changed, 29 insertions(+), 2 deletions(-)
base-commit: 2ee08ffd4d469781dc627fa50b4a015d9ad68007
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH BlueZ 1/2] btio: Set correct length for getsockopt 2025-01-17 14:06 [PATCH BlueZ 0/2] shared/bap: Fix BASE parsing Iulia Tanasescu @ 2025-01-17 14:06 ` Iulia Tanasescu 2025-01-17 15:06 ` shared/bap: Fix BASE parsing bluez.test.bot 2025-01-17 14:06 ` [PATCH BlueZ 2/2] shared/bap: Append extra L3 LTVs to BIS config Iulia Tanasescu 2025-01-17 18:10 ` [PATCH BlueZ 0/2] shared/bap: Fix BASE parsing patchwork-bot+bluetooth 2 siblings, 1 reply; 5+ messages in thread From: Iulia Tanasescu @ 2025-01-17 14:06 UTC (permalink / raw) To: linux-bluetooth Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu, luiz.dentz, Iulia Tanasescu 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 <marcel@holtmann.org> * 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); -- 2.43.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: shared/bap: Fix BASE parsing 2025-01-17 14:06 ` [PATCH BlueZ 1/2] btio: Set correct length for getsockopt Iulia Tanasescu @ 2025-01-17 15:06 ` bluez.test.bot 0 siblings, 0 replies; 5+ messages in thread From: bluez.test.bot @ 2025-01-17 15:06 UTC (permalink / raw) To: linux-bluetooth, iulia.tanasescu [-- Attachment #1: Type: text/plain, Size: 1863 bytes --] 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=926463 ---Test result--- Test Summary: CheckPatch PENDING 0.37 seconds GitLint PENDING 0.27 seconds BuildEll PASS 20.19 seconds BluezMake PASS 1456.82 seconds MakeCheck PASS 13.06 seconds MakeDistcheck PASS 157.07 seconds CheckValgrind PASS 213.06 seconds CheckSmatch WARNING 269.09 seconds bluezmakeextell PASS 97.96 seconds IncrementalBuild PENDING 0.36 seconds ScanBuild PASS 851.68 seconds Details ############################## Test: CheckPatch - PENDING Desc: Run checkpatch.pl script Output: ############################## Test: GitLint - PENDING Desc: Run gitlint Output: ############################## Test: CheckSmatch - WARNING Desc: Run smatch tool with source Output: src/shared/bap.c:296:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:296:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:296:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures ############################## Test: IncrementalBuild - PENDING Desc: Incremental build with the patches in the series Output: --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH BlueZ 2/2] shared/bap: Append extra L3 LTVs to BIS config 2025-01-17 14:06 [PATCH BlueZ 0/2] shared/bap: Fix BASE parsing Iulia Tanasescu 2025-01-17 14:06 ` [PATCH BlueZ 1/2] btio: Set correct length for getsockopt Iulia Tanasescu @ 2025-01-17 14:06 ` Iulia Tanasescu 2025-01-17 18:10 ` [PATCH BlueZ 0/2] shared/bap: Fix BASE parsing patchwork-bot+bluetooth 2 siblings, 0 replies; 5+ messages in thread From: Iulia Tanasescu @ 2025-01-17 14:06 UTC (permalink / raw) To: linux-bluetooth Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu, luiz.dentz, Iulia Tanasescu 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; } -- 2.43.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH BlueZ 0/2] shared/bap: Fix BASE parsing 2025-01-17 14:06 [PATCH BlueZ 0/2] shared/bap: Fix BASE parsing Iulia Tanasescu 2025-01-17 14:06 ` [PATCH BlueZ 1/2] btio: Set correct length for getsockopt Iulia Tanasescu 2025-01-17 14:06 ` [PATCH BlueZ 2/2] shared/bap: Append extra L3 LTVs to BIS config Iulia Tanasescu @ 2025-01-17 18:10 ` patchwork-bot+bluetooth 2 siblings, 0 replies; 5+ messages in thread From: patchwork-bot+bluetooth @ 2025-01-17 18:10 UTC (permalink / raw) To: Iulia Tanasescu Cc: linux-bluetooth, claudia.rosu, mihai-octavian.urzica, andrei.istodorescu, luiz.dentz Hello: This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>: On Fri, 17 Jan 2025 16:06:30 +0200 you wrote: > This patch adds some fixes for the BASE parsing logic in BAP: > > The first commit fixes the getsockopt call for BT_ISO_BASE, to > make sure that the correct BASE length is read from the kernel. > > The second commit adds a missing case in the BASE parsing logic > for Broadcast Sinks: the BASE structure might contain level 3 > (BIS specific) configuration LTV types that are not present at > level 2 (subgroup level). These values should also be appended > to the final BIS configuration. > > [...] Here is the summary with links: - [BlueZ,1/2] btio: Set correct length for getsockopt https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=07e8e726758f - [BlueZ,2/2] shared/bap: Append extra L3 LTVs to BIS config https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=1479c86ec116 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-17 18:10 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-01-17 14:06 [PATCH BlueZ 0/2] shared/bap: Fix BASE parsing Iulia Tanasescu 2025-01-17 14:06 ` [PATCH BlueZ 1/2] btio: Set correct length for getsockopt Iulia Tanasescu 2025-01-17 15:06 ` shared/bap: Fix BASE parsing bluez.test.bot 2025-01-17 14:06 ` [PATCH BlueZ 2/2] shared/bap: Append extra L3 LTVs to BIS config Iulia Tanasescu 2025-01-17 18:10 ` [PATCH BlueZ 0/2] shared/bap: Fix BASE parsing patchwork-bot+bluetooth
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.