This fixes a bug where the shell will reject setting available
context to 0x0. This has now been moved to only affect supported
context instead.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
In the case that a broadcast sync fails for any reason, we need to
set the BIS_Sync value for all subgroups to 0xFFFFFFFF
(BT_BAP_BIS_SYNC_FAILED) as per the BAP spec.
This commit adds a new define for this and modifies
both the scan delegator and broadcast sink to support this.
The change is validated by a modification to the broadcast
assistant test that verifies that the value is set in the
case of an invalid broadcast code (which indicates a
failed BIG sync).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Update the string formatter according to the type of the
variables that it is printing to eliminate compilation
warnings.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
bt_aics_client_free_instance_get can be called from multiple threads
and as such the atomic_test_and_set_bit should be used instead
of a atomic_test_bit followed by a atomic_set_bit.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
For code clarity, this commit adjusts the use of `return` statements
in functions with a void return type as follows:
- Transform `return foo();` into separate statements:
`foo();`
`return;`
- Remove unnecessary `return` statements when
they don't affect control flow.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Replace the busy boolean flag with an atomic value.
This also modifies the order of how this value is
controlled to avoid any race conditions.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Currently, dfu_suspended() sets the phase SUSPENDED
directly in the structure, bypassing the dfd_phase_set() function.
This prevents the phase change callback in the bt_mesh_dfd_srv_cb
structure from receiving the SUSPENDED event.
Signed-off-by: Emilio Aguila Escalante <emilio.aguila@hotmail.com>
MICP requires support for the bondable mode for both
the MICP microphone device and MICP microphone controller.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
BAP mandates support for bondable mode for all central and
peripheral roles.
Due to Kconfig circular dependencies, some additional
Kconfig changes had to be made.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Removed the experimental status from the BT_GATT_AUTHORIZATION_CUSTOM
Kconfig option used in the Bluetooth Host GATT layer. This feature
has been present in Zephyr for almost a year without any issue reports
or API modifications.
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
Adds HCI support for:
- LE CS Read Remote Supported Capabilities
- LE CS Read Remote FAE Table
Callbacks have been added to the conn object to allow upper layers to
make use of the cache commands, with which it will be possible to store
this information and provide it again in the case of a disconnect
and reconnect to the same device.
Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
Removed the experimental status from the BT_BONDABLE_PER_CONNECTION
Kconfig option used in the Bluetooth Host SMP layer. This feature
has been present in Zephyr for over a year without any issue reports
or API modifications.
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
Replace several bools in volume controller with an atomic value.
Update how these values are modified so that we can better
prevent race conditions.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Rename the volume flag field from the generic "flags"
to "vol_flags" as the generic "flags" will be used for
other values in a future commit.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
We don't own the thread that calls the final `bt_conn_unref()`. The
users might not be aware that they are re-using that poor thread's
stack.
Putting it on the system workqueue gives a predictable stack size and
thread priority for the invocation of the recycled handlers.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Why is it ok to use the sync pool?
Because command complete/status is processed in prio: that means on the
same stack as the `bt_recv()` call from the driver.
Why does it fix the issue?
Because the complete/status event goes into a pool that is guaranteed to
have one free buffer any time `bt_recv()` is not executing.
Since the driver is the one calling bt_recv(), it (hopefully) will
finish one `bt_recv()` before starting another one.
Fixes#78223
Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Removed deprecated native_posix as test platform.
Added unique sim_ids for tests with the psa as a overlay.
Fixed clang-format issues.
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
When a message with invalid parameters is received, we must ignore it.
In this commit we check invalid parameters first.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If use `IS_ENABLED` macro inside if statements but not as preprocessor
directives, we can always compile the code for settings even if settings
are not used. This allows to reduce amount of firmwares we need to build
in CI to ensure that code compiles.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
We must tcheck if buf has enough tailroom to fit another pair of keys or
pair addresses with direction.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If relay feature doesn't have own adv set, it should use the main adv
set to send messages.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
When a synchronous API is used, the content of `buf` will not be
valid by the time the thread that called the synchronous API is woken up
again.
Therefore, the simplest way to solve this is when a user allocates the
buffer which will be filled up with the content of the buffer passed to
the model callback.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
When relaying a Network PDU to another subnet, we need to update sub
field of rx structure so that correct credentials are used. We also need
to update NID field of the Network PDU.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
The initial implementation of RPL check for Subnet Bridge wasn't fully
correct. It decides whether to relay or not a PDU based on RPL of only
received messages. However, the spec section 3.9.8 says:
```
In addition, a Subnet Bridge node shall implement replay protection for
all Access and Transport Control messages that are sent to bridged
subnets.
A Subnet Bridge node shall maintain the most recent IVISeq value for
each source address authorized to send messages to bridged subnets.
Messages received by the Subnet Bridge node with the IVISeq value less
than or equal to the last stored value from that source address shall
be discarded immediately upon reception. When a message is retransmitted
to a bridged subnet, the stored IVISeq value shall be updated. In this
way, bridged subnets are protected against replay attacks from other
subnets.
```
This was noticed with MESH/NODE/SBR/NET/BV-02-C test. It passes when
PTS misses the message at step 3 and 4, and fails when PTS manages to
receive the message.
This commit fixes the wrong behavior by removing argument for
`bt_mesh_rpl_check` function making store a new message and bypassing
`local_match` check in case of Subnet Bridge node.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Though nvs backend checks whether the data passed to it is identical to
the stored one, this isn't guaranteed by other the settings api. We can
also avoid going into the settings subsystem since we know what was
actually changed.
This commit adds 2 flags that allow to control whether Subnet Bridge
or Bridging Table states were changed and skips storing if the certain
state was not changed.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
We store only filled up entries, but want to restore the entire table.
`bt_mesh_setting_set` fails if the restored length didn't match the
provided length.
This commit fixes the restoring of the bridging table by allowing to
restore any size as long as the stored size is less than the allocated
one and it is a multiple of the size of a single entry.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Adds subnet bridging functionality to the network layer.
Also fixes brg_cfg_srv for minor issues to get it working.
Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
Adds implementation for the Bridge Configuration Server model.
Updates `brg_cfg` module to add sanity check for
bt_mesh_brg_cfg_tbl_remove() API. Also, updates the unit test
accordingly.
Adds documentation for the Bridge Configuration Server model
Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
Implements the Bridge Configuration Client model.
Adds opcodes for all Bridge messages to `foundation.h`. Adds client-side
support for these messages.
Adds a new Kconfig option for the Bridge Configuration Client model to
configure the waiting time for respones for acked messages.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
The `brg_cfg` module implements the states needed for subnet bridge
feature. It provides two states - enable state, and bridging table
state. APIs are provided to access and modify the states. The module
handles responsibility of persistence of the states.
Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
Adding documentation and function calles for the API's
in Bridge Configuration Client model and Bridge
Configuration Server model.
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
Any places that checked for GTBS is now always enabled
as GTBS is mandatory to support, and the Kconfig option
was removed.
Also removed a duplicate Kconfig option for TBS,
BT_TBS_SERVICE_COUNT, as it was unused.
The other Kconfig option BT_TBS_BEARER_COUNT is used
instead exclusively to set it if needed.
Since GTBS can now exist alone, it must also
support having its own calls and other values.
This means that the GTBS and TBS instances now share
the same underlying struct.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Replace the busy boolean flag with an atomic value.
This prevents any race conditions with the MPL implementation.
Modifies where the new atomic value is set and cleared
so that initialization gets to finish before allowing
any reads.
Due to how the MPL is structured, and how a select cannot
be rejected from OTS, this does not give a perfect solution.
Ideally we need a separate object per OTS object, rather than
a shared one, and/or the OTS implemenation would allow
us to reject a select if the object is not currently
available or ready.
This commit does not fix the above issues, as that is a
larger undertaking.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Aligns the logging unhandled vs events with the regular ones.
Now it prints out the code and length.
Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
Use a new file and command for this where all CS commands
can live.
Added support for bt_cs_set_default_settings command.
Added test case where shell is built with CS to ensure code
is built in CI.
Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
Added support for a new API for setting default channel
sounding settings, this is mainly a wrapper around the HCI
command.
For this add a new module for channel sounding, where new
channel sounding APIs will go.
Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
Define a macro to validate aux offset value as it is checked
both in LLL and ULL execution contexts.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Controller hang due to infinite looping caused by
duplicate node_rx enqueued in auxiliary context.
When LLL scheduling is not applied due to invalid aux offset
then ULL scheduling too would skip setting up the reception
after similarly checking the validity of aux offset required
to schedule the reception of auxiliary PDU. This check in
ULL was after the received node_rx being enqueued into the
auxiliary context causing a loop in the list of node_rx.
Dequeue of a list with a loop of node_rx caused an infinite
loop execution in the Controller.
Regression introduced in commit 3590bd648f ("Bluetooth:
Controller: Fix missing invalid aux offset check").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add assertion check to catch infinite loop due to incorrect
node_rx release.
If same node_rx is released twice then it can lead to
infinite looping when releaseing link or node_rx buffers.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Replace the booleans used by the VOCS client to use
an atomic value instead.
The flags are modified to be used in a way that prevents
race conditions.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Replace the boolean values for the BAP Broadcast Assistant
with an atomic value. This prevents a rare, but possible,
race condition.
The busy flag has been replaced with 3 atomic values which
provide better granularity in error handling, and allows for
some concurrent write and read requests.
To describe the new behavior, the return values in the documentation
has been updated, and the error handling in the API
functions has improved.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add a bool fn so there is some room for a comment explaining why this is
not guarded by an IS_ENABLED().
Also add an optimization when building with an onboard controller.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>