Commit graph

24,075 commits

Author SHA1 Message Date
Robert Lubos
7bd45cd39b net: dns: Fix potential buffer overflow when unpacking labels
As the loop unpacking the DNS name from records checks the current
label length on each iteration, it's also needed to update the remaining
buffer length on each iteration, otherwise the buffer length checks
doesn't work as expected.

Additionally, the remaining buffer checks while technically worked, they
were conceptually wrong and unintuitive. The buf->data pointer doesn't
move, so comparing against this pointer when adding new labels doesn't
make sense. It's more intuitive to simply compare the label size vs
the remaining buffer space.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-11-21 11:40:44 -05:00
Robert Lubos
6be292c35e net: tcp: Wake pending threads if non-blocking connect fails
If a thread was sleeping in poll(), monitoring POLLIN only, it should
still be notified if an asynchronous connection, triggered by
non-blocking connect(), failed. Currently that's not the case.
In result the application would never know whether the connection
was successful or not and would be stuck with a disconnected socket
that would not report anything with poll().

This was not an issue if POLLOUT was monitored as well, because POLLOUT
sets up a connect semaphore that was reset in case of errors. POLLIN
however only monitors the recv fifo, which was not waken up in such
case.

Fix this by canceling any pending waits on recv fifo and recv
condition variable.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-11-21 09:47:50 -05:00
Alexander Svensen
87997afeb2 bluetooth: audio: scan_delegator: Reject remove when PA synced
- BASS mandates that a remove_source operation is not done if
  we are synced to PA or BIS. This PR fixes that
- Update BabbleSim tests to reflect this behavior
- Fixes BASS/SR/SPE/BI-05-C

Signed-off-by: Alexander Svensen <alexander.svensen@nordicsemi.no>
2025-11-21 09:47:10 -05:00
Jukka Rissanen
61d57c35ff net: Disable namespace compatibility support for tests
Do not enable network compatibility mode flag for network tests
so that we will get better coverage of the wrong network APIs
used.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-21 12:01:31 +01:00
Alberto Escolar Piedras
8ecbda3283 net: lwm2m: Remove use of fcntl.h
Use the underlaying zsock_ prefixed fcntl macros instead of the
POSIX_API fcntl renames.
After d45cd6716b and this, we do not
anymore use fcntl directly but use the underlaying Zephyr APIs.
So, let's also remove this include.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-11-21 12:01:31 +01:00
Jukka Rissanen
8046a24104 net: Fix network API calls that were not namespaced
Some of the networking calls were not namespaced so fix it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-21 12:01:31 +01:00
Peter Büchler
8d01323b2f net: lib: ptp: fix BTCA grandmaster selection and related state transition
The BMCA comparator ptp_btca_ds_cmp() did not follow the IEEE1588
ranking order: priority fields handled only the “greater” case, causing
valid winners to fall through to the clockIdentity tie-breaker and
resulting in incorrect grandmaster selection. This also caused the
state transition from TIME_TRANSMITTER to GRAND_MASTER to be missed.

Fixes: #99562
Fixes: #99566

Signed-off-by: Peter Büchler <peter.buechler@gmail.com>
2025-11-21 11:59:49 +01:00
Tomasz Moń
7e11bc5817 usb: device_next: msc: Reduce memory usage
MSC BOT can work with just one buffer because buffer to receive CBW is
never queued at the same time as CSW. SCSI buffer needs to be multiple
of bulk endpoint wMaxPacketSize and therefore is suitable for handling
both CBW and CSW. Take advantage of this to reduce memory usage.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2025-11-21 10:09:49 +02:00
Tomasz Moń
1243aba8e5 usb: device_next: msc: Implement double buffering
Double buffering make it possible to significantly increase the transfer
rates by avoiding idle states. With two SCSI buffers, one buffer can be
used by disk subsystem while the other is being used by UDC (ideally
with DMA).

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2025-11-21 10:09:49 +02:00
Tomasz Moń
78291d4fc2 usb: device_next: msc: stall endpoints on enqueue error
When endpoint enqueue fails the device has no reliable means of recovery
other than a reset. Implement 6.6.2 Internal Device Error handling on
failed enqueue.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2025-11-21 10:09:49 +02:00
Alberto Escolar Piedras
bdfb7604c0 subsys/crc/crc_shell: Fix check for host libc
Let's use CONFIG_NATIVE_LIBC to detect builds with the host C library
instead of pressuming that any build targetting the POSIX architecture
uses it. This has not been the case for several years now, as we can
select different C libraries when targetting the POSIX architecture.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-11-21 10:09:08 +02:00
Alberto Escolar Piedras
bc77cfafe6 shell: Fix check for host libc
Let's use CONFIG_NATIVE_LIBC to detect builds with the host C library
instead of pressuming that any build targetting the POSIX architecture
uses it. This has not been the case for several years now, as we can
select different C libraries when targetting the POSIX architecture.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-11-21 10:09:08 +02:00
Robert Lubos
da5c9c8630 net: sockets: tls: Prefix overlooked CID-related symbols
Some CID-related symbols were prefixed but not updated in sockets_tls.c
as that configuration was not built by the tests/net/all test suite,
hence easy to miss.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-11-20 17:15:15 +00:00
Kfir Bracha
c53f050e02 net: http_server: Support reason phrase for chunked encoded response
Add HTTP reason phrases in chunked transfer-encoded responses

Signed-off-by: Kfir Bracha <kfirous@gmail.com>
2025-11-20 17:15:05 +00:00
Alberto Escolar Piedras
764e21032f net: l2: wifi_shell: remove unnecessary include
Since we are using sys_getopt now we do not need to pull unistd.h
for anything amore.
Let's remove it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-11-20 17:14:57 +00:00
Alberto Escolar Piedras
c3cd5d1c86 subsys/net wifi/wifi_shell: Fix use of sys_getopt global status
sys_getopt has now its global status variables prefixed with sys_getopt_
Let's fix the use here. Note this worked as Zephyr's POSIX_C_LIB_EXT
keeps a replica of these variables without the prefix.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-11-20 17:14:57 +00:00
Alberto Escolar Piedras
24277bca8d subsys/crc: Fix getopt/sys_getopt use
sys_getopt has now its global status variables prefixed with sys_getopt_
Let's fix the use here. Note this worked as Zephyr's POSIX_C_LIB_EXT
keeps a replica of these variables without the prefix, and it is
enabled by default.
And since sys_getopt was split from POSIX_C_LIB_EXT this component
only needs to enable GETOPT and no the whole POSIX_C_LIB_EXT.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-11-20 17:14:57 +00:00
Jukka Rissanen
77bdec412f net: openthread: Remove invalid assert
There is no openthread_instance so the assert will always fail so
remove it to prevent compilation issue.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-20 16:00:46 +00:00
Emil Gydesen
797fa99f57 Bluetooth: BAP: Shell: Refactor receive states
Refactor how receive states are handled in the BAP
shell.

The scan delegator's receive states are not available from
the broadcast sink, and the broadcast sink makes sure to
properly set the pa_sync object in the receive state
struct.
The receive states are now also using the BAP service data to
identity the receive state when using PAST.

The broadcast assistant will now cache data from a remote device,
and makes it available to e.g. CAP.
Additionally if there is a broadcast source, we cache the values
neccesary to identity if a remote receive state represents our
local broadcast source.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-11-20 09:00:27 -05:00
Emil Gydesen
be874a2aaf Bluetooth: BAP: Missing assignment to aggregated_bis_syncs
When using the add_src and mod_src APIs the
aggregated_bis_syncs variable was only ever set to 0
and never updated, thus making all calls to
bis_syncs_unique_or_no_pref to be true.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-11-20 08:59:49 -05:00
Cheng Chang
5959016f1b Bluetooth: classic: obex: Fix active client validation logic
Fix the active client validation in OBEX abort operations to
handle concurrent request scenarios. The check now
ensures that if there is an active client and it's different
from the current client, the operation is rejected with -EBUSY.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2025-11-20 06:02:24 -05:00
Cheng Chang
ca1a522f93 bluetooth: classic : shell : Add test visibility for static functions
Add STATIC macro definition to conditionally expose static functions
for testing purposes. When CONFIG_ZTEST is enabled, STATIC expands
to nothing, making functions globally visible for unit tests.
Otherwise, STATIC expands to 'static' for normal builds.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2025-11-20 06:01:23 -05:00
Jamie McCrae
1995b669a1 mgmt: mcumgr: grp: settings_mgmt: Allow saving single setting
Adds functionality that allows saving a single setting to NVM using
the newly added function in the settings subsystem. This also
replaces calling the subtree save function if it the underlying
Kconfig is enabled to reduce code paths in settings mgmt

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-11-19 15:56:49 -05:00
Jamie McCrae
4616a8ac77 settings: Add function for saving (unchanged) single item/subtree
Adds a function that allows saving of a single setting item without
changing the value, or saving a subtree of settings, to the storage
backend

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-11-19 15:56:49 -05:00
Alexander Svensen
78729f4ff0 bluetooth: audio: scan_delegator: Fix validation
- Fixes bug where bis_sync_requests were wrongfully validated.
  - Two BISes across subgroups should not have the same bits set
- Remove use of internal->bis_syncs before it's updated in mod_src.

Signed-off-by: Alexander Svensen <alexander.svensen@nordicsemi.no>
2025-11-19 15:54:23 -05:00
Alberto Escolar Piedras
9fee526365 net: Fix EVENTFD kconfig selection
Since 820cd34dbb these net components
use ZVFS_EVENTFD directly instead of thru EVENTFD.
So, let's select ZVFS_EVENTFD directly instead of indirectly
thru EVENTFD.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-11-19 15:53:19 -05:00
Timothy Keys
6bfa6fa9a8 bluetooth: host: shell: Add SCI shell commands
This adds support for Shorter Connection Interval commands in the bt
shell.

Signed-off-by: Timothy Keys <timothy.keys@nordicsemi.no>
2025-11-19 09:15:18 -05:00
Timothy Keys
c14dcaf199 bluetooth: host: Change uses of interval to interval_us
Since Shorter Connection Intervals changes the unit that connection
intervals can be represented in. It is necessary to change how
they are stored and represented.

This commit deprecates interval in favour of interval_us.

Remove use of interval in internal bt_conn struct since it is no longer
needed.

Signed-off-by: Timothy Keys <timothy.keys@nordicsemi.no>
2025-11-19 09:15:18 -05:00
Timothy Keys
e2cd247ec4 bluetooth: host: Add Shorter Connection Intervals support
This commit adds support for the Shorter Connection Intervals feature to
the Bluetooth host.

Signed-off-by: Timothy Keys <timothy.keys@nordicsemi.no>
2025-11-19 09:15:18 -05:00
Jamie McCrae
d9c2bdf51a mgmt: mcumgr: grp: os_mgmt: Add memory pool statistics command support
Adds support for the memory pool statistics (mpstat) command, which
will list details on various memory heaps on the device

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2025-11-19 06:54:40 -05:00
Jamie McCrae
2f42addef7 mgmt: mcumgr: grp: img_mgmt: Use common reset function
Replaces the img_mgmt specific function with the common SMP
function for resetting the zcbor buffer and allowing a new response
to be sent

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2025-11-19 06:54:40 -05:00
Jamie McCrae
89b01d5c93 mgmt: mcumgr: transport: Add zcbor buffer reset function
Adds a common zcbor reset buffer function, this allows for the
buffer to be reset after data has been added already to add a
different response, e.g. an error response

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2025-11-19 06:54:40 -05:00
Pavel Vasilyev
b7b35b89ed bluetooth: host: Deprecate CONFIG_BT_SIGNING
This commit deprecates:
- the `CONFIG_BT_SIGNING` Kconfig option
- `BT_GATT_CHRC_AUTH` property

IOW, this commit deprecates the LE Security mode 2 support.

Explanation:

Erratum ES-26047 introduced in Bluetooth Core Specification v6.2
requires SingCounter to be persistently stored to prevent replay
attacks.

Currently, the Host doesn't store SignCounter, therefore the device is
vulnerable to replay attacks after reboot.

Additionally, the current implementation doesn't assume that SignCounter
of a received message can be incremented by more than one and thus may
not validate correct message.

The Bluetooth Security and Privacy Best Practices Guide recommends to
not using Data signing and recommends to use LE Security mode 1 levels
2, 3 or 4 instead.

The Signed Write Without Response sub-procedure, which is the only user
of Data signing, is optional (see Vol 3, Part G, Table 4.1).

See also ES-18901.

The aforementioned reasons make no sense to keep this feature.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-11-19 06:52:38 -05:00
Nicolas Pitre
051623c808 boards: arm: fvp: Add Cortex-A320 board variant support
Add Cortex-A320 support to the unified FVP board structure with ARMv9.2-A
specific configuration parameters.

New board target:
- fvp_base_revc_2xaem/a320

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-11-18 17:49:40 -05:00
Nicolas Pitre
2aef4fbe5b arch: arm64: Add ARMv9-A architecture and Cortex-A510 CPU support
Add ARMv9-A architecture support with Cortex-A510 CPU as the default
processor for generic ARMv9-A targets.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-11-18 17:49:40 -05:00
Aleksandr Khromykh
613d228002 bluetooth: mesh: update max oob size till 32 bytes
Commit updates maximum OOB authentication size from 8 bytes
till 32 bytes according to specification errata ES-27446.
Since previous OOB API does not allow to expose OOB values
with such width the new API has been introduced.
The previous API was deprecated and hidden under
BT_MESH_PROV_OOB_API_LEGACY option and left for backward
compatibility with existing code base.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-11-18 10:48:18 -05:00
Aleksandr Khromykh
6bf8409e39 bluetooth: mesh: adjust adv stack dependency and size
Commit removes legacy dependancy on Host crypto.
Additionally, it adapts advertiser stack size if
provisioner feature has been enabled (tested with
mesh_shell and thread analyzer).

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-11-18 10:48:18 -05:00
Aleksandr Khromykh
8b2e37f0e2 bluetooth: mesh: prevent getting wrong authentication size
Commit moves SHA256 authentication size under SHA256 macro.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-11-18 10:48:18 -05:00
Aleksandr Khromykh
760d190723 bluetooth: mesh: zeroing not used part of auth array
Commit set zero to not used part of authentication array
to prevent garbage from the previous provisioning using.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-11-18 10:48:18 -05:00
Aleksandr Khromykh
666950efff bluetooth: mesh: improve oob size checking
Commit improves oob size checking to catch wrong size
as early as possible and prevents zero size.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-11-18 10:48:18 -05:00
Jamie McCrae
2e54630612 mgmt: mcumgr: grp: img_mgmt: Add support for up to 8 images
Adds slot/image information for using up to 8 images on a device

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-11-18 10:46:40 -05:00
Jamie McCrae
764b61f306 dfu: boot: mcuboot: Add support for up to 8 images
Adds slot/image information for using up to 8 images on a device

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-11-18 10:46:40 -05:00
Jukka Rissanen
22f9ef0a33 sys: getopt: Rename getopt to sys_getopt to avoid conflicts with Posix
Summary:

As Zephyr getopt is not really compatible with Posix getopt, rename
Zephyr getopt to sys_getopt.

Background:

Zephyr getopt module was introduced in #31356 to be used by the shell.
Zephyr's getopt is not the standard one. It has multiple APIs which make
it more suited for a system like Zephyr where different components may
want to use it for different purposes. Including APIs to init it,
get and set its internal state etc.
Several Zephyr modules (shell, net, wifi, ztest) use this getopt with
these special APIs. The getopt module is bundled in the POSIX
compatibility API subsystem (CONFIG_POSIX_C_LIB_EXT).

Problem description:

As it is not the standard getopt(), no C library can possibly provide
a Zephyr compatible version (even if such C library were to provide a
standard getopt()). As it is bundled in Zephyr's POSIX API in
CONFIG_POSIX_C_LIB_EXT), multiple components that depend on it are
selecting CONFIG_POSIX_C_LIB_EXT. Zephyr core components should not
depend on the POSIX API in this way.

Changes done in this commit:

Rename the getopt*() APIs to sys_getopt*() and move them into a module
under lib/utils with its own Kconfig option to enable it.
Zephyr's users are changed to use this new component.
The POSIX subsystem can continue providing getopt() by calling the new
sys_getopt() and in that way retain backwards compatibility for external
users.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-18 10:46:29 -05:00
Nicholas Lowell
e6d1941c30 shell / logging: shell log backend output Kconfig
Gives access to all log output format flag configurations
for shell backend.

shell log backend doesn't use log_backend_std_get_flags()
and it's debateable if it should, so give it its own fullly
configurable format set for maximum backend bandwidth control

Signed-off-by: Nicholas Lowell <Nicholas.Lowell@lexmark.com>
2025-11-18 08:12:38 -05:00
Alexander Svensen
fa8c244313 Bluetooth: Audio: CSIS: Check all pending notifications
- When a bonded device is reconnected, check flags for pending
  notifications for:
 - Lock
 - SIRK
 - Size

Previously only lock was checked

Signed-off-by: Alexander Svensen <alexander.svensen@nordicsemi.no>
2025-11-18 08:12:06 -05:00
Henrik Brix Andersen
3cba0beef6 logging: mark custom header inclusion as experimental
Mark the custom logging header support as experimental.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2025-11-18 08:10:51 -05:00
Henrik Brix Andersen
a4a173b43d shell: mark custom header inclusion as experimental
Mark the custom shell header support as experimental.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2025-11-18 08:10:51 -05:00
Fabian Blatz
99a8cf59b8 shell: Fix method name typo
Fix issue where method names contained bacskpace instead of backspace.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2025-11-18 08:08:40 -05:00
Jukka Rissanen
ddf17adc93 log: backend: net: Remove Posix dependency
The network backend needs nothing from Posix so remove the
dependency.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-17 14:01:32 -05:00
Jukka Rissanen
55457ee4b8 net: zperf: Change old code to pass compliance checker
Compliance checker complains

   TYPO_SPELLING: 'in in' may be misspelled - perhaps 'is in'?

for code like this

   static struct net_sockaddr_in in_addr_my = {

so change the variable to ipv4_addr_my. Similar change is
done for IPv6 variables for consistency.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-11-17 14:01:32 -05:00