Commit graph

21541 commits

Author SHA1 Message Date
Robert Lubos
bd56fecc61 net: iface: Add missing interface mutex locks
net_if_ipv4/6_addr_rm() were missing the iface mutex lock, this commit
adds it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-09-17 17:45:34 +01:00
Simon Walz
5af3fbadfd net: lwm2m: check each block for TLV header
For composite operations, we should always check whether the TLV header
is present. Otherwise, all blocks are assigned to one resource.

Signed-off-by: Simon Walz <simon.walz@autosen.com>
2024-09-17 17:45:17 +01:00
Simon Walz
e20ef4443e net: lwm2m: check lwm2m path level while getting the block ctx
The Block1 context for composite operations is not found, as all path
levels are compared. The incoming path level should therefore always be
taken into account.

Signed-off-by: Simon Walz <simon.walz@autosen.com>
2024-09-17 17:45:17 +01:00
Jamie McCrae
87a18400dd mgmt: mcumgr: grp: os_mgmt: Add optional bootloader info hook
Adds an optional hook that allows for appending additional
responses to the bootloader info command

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-09-17 17:45:04 +01:00
Jukka Rissanen
9acf53e412 net: context: Set IPv4 address properly for sendmsg()
When using sendmsg() and if CONFIG_NET_IPV4_MAPPING_TO_IPV6 is
enabled, then the addr4 variable was set too late which was causing
null pointer access.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-17 05:22:48 -04:00
Ingar Kulbrandstad
d41e834bbe tests: bluetooth: mesh: Removed native_posix and renamed sim_ids
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>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev
e0f5f3acf4 bluetooth: mesh: brg_cfg_srv: ignore message with invalid parameters
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>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev
dd7b6757f4 bluetooth: mesh: brg_cfg: use IS_ENABLED macro optimally
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>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev
945e320e75 bluetooth: mesh: brg_cfg_srv: check buf tailroom before packing data
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>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev
f44ee3c50c bluetooth: mesh: adv_ext: resched main adv set if relay doesn't have own
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>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev
76f015b61f bluetooth: mesh: brg_cfg_cli: copy buf in synchronous api
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>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev
6c94d3bec6 bluetooth: mesh: net: bridge traffic regardless of relay state
The Subnet Bridge node must bridge traffic regardless of the Relay
state.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev
957bb4754a bluetooth: mesh: net: use subnet credentials when relaying
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>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev
abf02719c4 bluetooth: mesh: rpl: fix rpl for subnet bridge
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>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev
f06f69a8b8 bluetooth: mesh: brg_cfg: store tbl when changed only
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>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev
ceba348ca4 bluetooth: mesh: brg_cfg: fix restoring bridging table
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>
2024-09-17 05:22:32 -04:00
Ingar Kulbrandstad
0e2f8b21cf Bluetooth: Mesh: Fixed bugs found in PTS testing
Fixed bugs found while running PTS test.

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Omkar Kulkarni
fc4576ce3f Bluetooth: Mesh: Add bridging functionality
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>
2024-09-17 05:22:32 -04:00
Omkar Kulkarni
8210d2da1b Bluetooth: Mesh: Populate Bridge Config Server
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>
2024-09-17 05:22:32 -04:00
Håvard Reierstad
50a4c2d17a Bluetooth: Mesh: Add brg_cfg_cli commands to shell
Adds the Bridge Configuration Client commands to Mesh shell.

Unifies documentation for shell Kconfig options.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Håvard Reierstad
d49068e608 Bluetooth: Mesh: Implement Bridge Config Client
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>
2024-09-17 05:22:32 -04:00
Omkar Kulkarni
092f808ea4 Bluetooth: Mesh: Adds subnet bridge states
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>
2024-09-17 05:22:32 -04:00
Ingar Kulbrandstad
709c006b58 Bluetooth: Mesh: Bridge Configuration Client/Server API
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>
2024-09-17 05:22:32 -04:00
Emil Gydesen
eb22e1fc98 Bluetooth: TBS: Make GTBS mandatory
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>
2024-09-17 09:45:48 +02:00
Emil Gydesen
4b68043ebb Bluetooth: MPL: Replace busy bool with atomic
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>
2024-09-16 20:18:39 +02:00
Olivier Lesage
788d1a908e bluetooth: host: improve log for unhandled vs events
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>
2024-09-16 20:17:57 +02:00
Keith Packard
94043dbefe subsys/shell: cmd_date_set uses gmtime_r, a POSIX function
Define _POSIX_C_SOURCE for this file to make sure gmtime_r is visible.

Signed-off-by: Keith Packard <keithp@keithp.com>
2024-09-16 20:17:35 +02:00
Keith Packard
88359d998c subsys/llext: Allow .exported_sym to be between other data sections
There's no reason for the .exported_sym data to always land at one end of a
data region; the order of sections depends on the whim of the compiler and
assembler.

Ignore overlaps between that region and other data regions.

Signed-off-by: Keith Packard <keithp@keithp.com>
2024-09-16 20:17:35 +02:00
Keith Packard
40ac96aa57 net: dns: Ignore GCC warnings in mdns_responder.c
GCC complains about struct sockaddr accesses due to the various
address-family-specific variants being of differing sizes. Let's not
mess with code (which looks correct), just silence the compiler.

Signed-off-by: Keith Packard <keithp@keithp.com>
2024-09-16 20:17:35 +02:00
Sean Madigan
aa67cb238a bluetooth: shell: Add CS to BT shell with set default settings command
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>
2024-09-16 10:02:58 +02:00
Sean Madigan
aedb330c70 bluetooth: host: Add support for CS set default settings
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>
2024-09-16 10:02:58 +02:00
Sean Madigan
7dff1c1374 bluetooth: kconfig: Add channel sounding kconfigs
Add new controller and host kconfigs for Bluetooth 6.0
Channel Sounding.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2024-09-16 10:02:58 +02:00
Vinayak Kariappa Chettimada
50b07f9480 Bluetooth: Controller: Add missing branch prediction in lll_scan_aux
Add missing branch prediction likely/unlikely hint.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-09-13 17:29:53 -05:00
Vinayak Kariappa Chettimada
176d8ff760 Bluetooth: Controller: Define a macro to validate aux offset value
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>
2024-09-13 17:29:53 -05:00
Vinayak Kariappa Chettimada
9fa18600ee Bluetooth: Controller: Fix hang due to loop in node_rx list
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>
2024-09-13 17:29:53 -05:00
Vinayak Kariappa Chettimada
437bfa5b1a Bluetooth: Controller: Infinite loop assertion on node_rx release
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>
2024-09-13 17:29:53 -05:00
Emil Gydesen
49bd80828d Bluetooth: VOCS: Replace bools with atomic
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>
2024-09-13 11:38:27 -05:00
Jukka Rissanen
cd4b854c89 net: bridge: Ignore promisc mode errors for native-sim
We do not need promiscuous mode setting in host side when testing
bridging with native-sim, so just ignore errors in this case.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-13 13:42:20 +02:00
Tomasz Moń
4c6b1e5a65 usb: device_next: uac2: Support multiple sample rates
Add callbacks for setting and getting the sample rate. The callbacks are
optional if all Clock Source entities support only one sample rate.

This commit results in working High-Speed operation with Windows UAC2
driver when the Clock Source is host-programmable. Windows UAC2 driver
won't work if setting sample rate fails even if Clock Source supports
only one sample rate.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-09-13 09:21:58 +02:00
Tomasz Moń
d5aa42f93a usb: device_next: uac2: Write feedback as soon as possible
Queue explicit feedback write once the previous one finishes in order to
make it possible to cope with 8x faster High-Speed pace. This matches
the originally intended behavior described in comment.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-09-13 09:21:58 +02:00
Tomasz Moń
2551ddca11 usb: device_next: uac2: Support High-Speed operation
Generate Full-Speed and High-Speed descriptors based on full-speed and
high-speed instance properties. Use appropriate descriptor set based on
active speed.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-09-13 09:21:58 +02:00
Tom Chang
0726198776 mgmt: ec_host_cmd: npcx: workaround for backend SHI
There is an issue on the SHI hardware peripheral to detect CS
rising/failing with bits CSnFE/CSnRE in the EVSTAT2 register in
npcx9m7fb chip. This commit workarounds it by using MIWU to detect the
CS rising and failing.

Signed-off-by: Tom Chang <CHChang19@nuvoton.com>
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2024-09-13 09:17:23 +02:00
Valerio Setti
6be57aaedf net: sockets_tls: add support for TLS 1.3
Enables TLS 1.3 sockets based on Mbed TLS.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-09-12 13:31:20 -04:00
Valerio Setti
33931cf8e1 mbedtls: remove unused option MBEDTLS_SSL_EXPORT_KEYS
According to Mbed TLS changelog this feature was set default ON
since 3.1.0 release, so the build symbol is no more available.
This commit removes it from Zephyr.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-09-12 13:31:20 -04:00
Guennadi Liakhovetski
5332393066 llext: make loader parameters "const"
LLEXT loader parameters are input-only, make them "const."

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-12 13:02:59 -04:00
Emil Gydesen
ae6c20d324 Bluetooth: BAP: BA: Replace bools with atomic
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>
2024-09-12 13:01:48 -04:00
Jonathan Rico
02c8659748 Bluetooth: Host: run clang-format on auto-init-procedures fns
Does what it says on the tin.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-09-12 13:00:54 -04:00
Jonathan Rico
ac8889907a Bluetooth: Host: Remove an indentation level in auto procedures
The else branch was unused.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-09-12 13:00:54 -04:00
Jonathan Rico
585c1f951f Bluetooth: Host: Refactor auto feature exchange
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>
2024-09-12 13:00:54 -04:00
Jonathan Rico
3f17bdfaf6 Bluetooth: Host: refactor 2M PHY auto-update
The code was a bit hard to read. From what I understood, the intent is
to not send the PHY update if we are already on 2M symmetric.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-09-12 13:00:54 -04:00