Commit graph

24,075 commits

Author SHA1 Message Date
Henrik Brix Andersen
b439029296 net: lib: sockets: can: always verify length in zcan_sendto_ctx()
Always verify the length in zcan_sendto_ctx().

Fixes: #104652

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2026-02-27 15:31:55 +01:00
Tim Pambor
4d6de96ad4 net: ipv4: avoid casting unaligned address to net_in_addr
This change addresses an alignment problem reported by UBSAN by
using a copy of the address. This avoids the need for extensive
rework to support net_if_ipv4_maddr_lookup_raw variant.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-02-27 15:31:26 +01:00
Alberto Escolar Piedras
61e6c0b2a1 mgmt: updatehub: Use renamed network APIs
In
d45cd6716b
f27a26f9ec
the mayority of this code was changed to use the new native networking
API naming, but one macro was forgotten.

Let's change it now so this code builds also without
CONFIG_NET_NAMESPACE_COMPAT_MODE

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-27 13:56:24 +01:00
Alberto Escolar Piedras
eed8d23140 net: shell: pmtu: Fix net API use
In d45cd6716b the mayority of the
Zephyr codebased was changed to use the Zephyr native net_ prefixed
types, but some were forgotten.
Without this fix/change the code still builds as we are by now setting
CONFIG_NET_NAMESPACE_COMPAT_MODE. But when this is not set, things
fail to build.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-27 13:56:24 +01:00
Alberto Escolar Piedras
4e04b519d1 net: sockets: tls: Fix net API use
In d45cd6716b the mayority of this code
was changed to use the Zephyr native net_/zsock_ prefixed types/functions
but some were forgotten.
Let's fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-27 13:56:24 +01:00
Alberto Escolar Piedras
6ef9e8f2d2 net: lwm2m: Use ZTESTABLE_STATIC instead of STATIC
Use the ZTESTABLE_STATIC macro to define symbols which need to be
accessible from ztests, instead of redefining STATIC which causes
trouble with some hals.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-27 11:50:41 +01:00
Alberto Escolar Piedras
ef2773dffe fs: nvs: Use ZTESTABLE_STATIC instead of STATIC
Use the ZTESTABLE_STATIC macro to define symbols which need to be
accessible from ztests, instead of redefining STATIC which causes
trouble with some hals.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-27 11:50:41 +01:00
Alberto Escolar Piedras
c77d74fa7d Bluetooth: Classic: Shell: Use ZTESTABLE_STATIC instead of STATIC
Use the ZTESTABLE_STATIC macro to define symbols which need to be
accessible from ztests, instead of redefining STATIC which causes
trouble with some hals.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-27 11:50:41 +01:00
Jordan Yates
7344fa4db9 debug: thread_analyzer: ISR info to callback
Run the user provided callback for the ISR stacks, instead of ignoring
the callback and printing the summary.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-02-27 07:57:33 +01:00
Alberto Escolar Piedras
8c06719191 net: lwm2m: Remove use of fcntl.h macros from messages
Just for consistency with the code and to avoid finding them on searches,
use the actually used macro names in the log messages.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-02-26 21:25:31 +00:00
Emil Gydesen
49bb9e2034 Bluetooth: ISO: Fix bad sys_get for {c,p}_latency
The fields in the HCI events are 24-bits but were treated
as 16-bit values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-26 21:24:34 +00:00
Aleksandr Mirlenko
c26eda3b71 bluetooth: host: add support for CS IPT procedures
Add support for CS IPT (Channel Sounding Inline PCT Transfer)
in the Bluetooth host stack.

Changes include:
* definition of new CS IPT HCI opcodes;
* handling of CS IPT control procedures;
* integration with existing CS infrastructure;
* necessary updates to public headers.

Signed-off-by: Aleksandr Mirlenko <aleksandr.mirlenko@nordicsemi.no>
2026-02-26 16:53:17 +00:00
Valerio Setti
e8cb9ba0d7 net: lib: http_server: remove legacy Mbed TLS header inclusion
This was a leftover from the previous commit that removed usage of
legacy crypto in favor of PSA API.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-02-26 08:48:27 -06:00
Kyra Lengfeld
354e3cb040 Bluetooth Host: Fix memory leak in ATT prep_pool
Before this we have a memory leak in the prep_pool when reassembly fails
in :c:func:`att_exec_write_rsp`. Now on error the buffer is dequeued and
freed, as are remaining queued prepare buffers.

Signed-off-by: Kyra Lengfeld <kyra.lengfeld@nordicsemi.no>
2026-02-26 12:36:03 +01:00
Shay Gi
fa321c1c2d Bluetooth: Fix typo of supervision
Fixed typos in code of "supervison" to supervision.

Signed-off-by: Shay Gi <s02998491@gmail.com>
2026-02-26 12:32:14 +01:00
Pete Johanson
dbe1e63d36 ipc: Move to barrier_sync_synchronize()
Move the IPC subsystem to the new barrier_sync_synchronize()
wrapper API.

Signed-off-by: Pete Johanson <pete.johanson@analog.com>
2026-02-25 18:47:53 +01:00
Julien Vermillard
0a64b9aae3 net: lwm2m: send scheduler: gate path formatting to DBG logs
The send scheduler formatted LwM2M paths with `lwm2m_path_log_buf()` even
when debug logging was not enabled for the module, causing build issues
with CONFIG_LOG off.

Signed-off-by: Julien Vermillard <julien@clunkymachines.com>
2026-02-25 13:23:07 +01:00
Andreas Anderberg
aa9fd2ea73 fs: zms: Add zms_mount_force()
zms_mount_force() behaves like zms_mount() but automatically wipes and
reinitializes the partition if the initial mount attempt fails.

A corresponding Kconfig option SETTINGS_ZMS_FORCE_MOUNT is added to the
settings subsystem to enable this behavior when using ZMS as the
settings backend.

Signed-off-by: Andreas Anderberg <andreas.anderberg@u-blox.com>
2026-02-25 13:04:53 +01:00
Johann Fischer
7158c64690 include: drivers: usb: rename UDC buffer to USB buffer
Rename it to USB buffers so we can use it in host support without
confusion. Keep the UDC_* macros for now, we can deprecate and remove
them later.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-02-24 16:01:21 -06:00
Robert Lubos
caa6273301 net: shell: Add FTP module
Add FTP shell module covering basic FTP client operations.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-02-24 15:37:25 +01:00
Robert Lubos
991ea36f70 net: lib: ftp_client: Add FTP client library
Add FTP client library, based on the FTP client library from nRF Connect
SDK.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-02-24 15:37:25 +01:00
Emil Gydesen
dd72c4c711 Bluetooth: BAP: SD: Fix issues with pa sync requests
The implementation only used the receive state's PA sync state
to determine whether to call the PA sync req or PA sync term req,
but that state does not include the syncing state.

Rather than using the receive state's PA sync state, we add a local
boolean to keep track of whether the PA sync was requested, so if
we receive a mod_src with PA sync == BT_BAP_BASS_PA_REQ_NO_SYNC then
we request a termination, even if the PA sync was not established yet.

Some cleanup in the mutex handling was also done as part of this.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-24 15:35:54 +01:00
Jukka Rissanen
0747bca9e1 net: ipv4: Do packet length checks before starting fragment reassembly
Make sure to check packet length check before starting the
IPv4 fragmentation reassembly process. This way we can drop the
malformed packet without consuming resources.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-02-24 13:53:25 +01:00
Lingao Meng
f9d4e653d1 nvs: fix delete ATE length inconsistency during GC
Delete entries in NVS are represented by an ATE with len == 0 and
no associated data.

However, when GC is triggered by a delete operation, the
propagated ATE length may become non-zero due to unconditional CRC
addition, leading to inconsistent semantics and potential mount or
space calculation issues.

Introduce nvs_data_len_with_crc() to centralize the logic of
conditionally adding the data CRC size. This ensures that delete
entries always retain len == 0 and restores consistency across write,
GC and space calculation paths.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-02-24 10:41:31 +01:00
Wojciech Jablonski
9806fab79b llext: Option for customizing FLIX generation
Compiler-generated FLIX instructions are currently disabled for LLEXT due
to a historic issue with LLEXT feature that appears to be already
resolved. However, another issue with FLIX is now being investigated.
The latter issue is not related to LLEXT but userspace feature.
To mitigate impact of global complier settings, this change adds a kconfig
choice for controlling FLIX generation independently for LLEXT modules.

Signed-off-by: Wojciech Jablonski <wojciech.jablonski@intel.com>
2026-02-23 13:32:47 -06:00
Szymon Janc
7f044f0a00 Bluetooth: GATT: Fix writable appearance Kconfig choice name
Make sure choice option name is not same as actual config option
that is enabling it. Use _SECURITY suffix for clarity of what
choice is actually about.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2026-02-23 17:00:16 +00:00
Martin Moya
996feaea91 bluetooth: services: cts: Add local time information characteristic
CTS is missing the Local Time Information characteristic and this
commit adds the UUID and the full characteristic to its service.

The peripheral example has been updated as well to use this and
implement it on the example so it is easy to test it out.

Signed-off-by: Martin Moya <moyamartin1@gmail.com>
2026-02-23 16:58:13 +00:00
Vinit Mehta
0d387be9b6 bluetooth: host: add kconfig for evt synchronous buffer pool
- Add kconfig for HCI event synchronous buf pool to allow vendors
to configure buffer count based on the application/host platform
requirements

Signed-off-by: Vinit Mehta <vinit.mehta@nxp.com>
2026-02-23 11:35:42 +00:00
Jukka Rissanen
3a40c90b98 net: dns: Check that DNS packet contains also query type and class
When receiving a DNS query, make sure that the packet contains
also query type and class fields before trying to access them.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-02-23 08:53:00 +01:00
Lingao Meng
fe111defaf fs: nvs: fix NVS recovery to handle trailing delete ATEs
Use ate_end_addr >= data_end_addr instead of > to ensure the
last delete ATE is scanned and recovered correctly.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-02-21 15:34:58 +00:00
Jay Beavers
f5867550af net: usbd: Set default traffic class TX count
Fixes zephyrproject-rtos/zephyr#103442
Origin: Original

Adds a separate TX traffic class for CDC-ECM and CDC-NCM in USBD Next
to prevent a deadlock during interface provisioning.

Tested with a custom nRF53-app firmware which combines CDC-ECM /
CDC-NCM (both tested) with mDNS with USB hosts MacOS, iPadOS, and
Alpine Linux.

Signed-off-by: Jay Beavers <jay@tolttechnologies.com>
2026-02-21 15:34:44 +00:00
Tomasz Moń
cbe1958809 usb: device_next: dfu: actually fail requests
Control read handlers handle_get_status(), handle_get_state() and
handle_upload() return value is used to set errno. Setting errno inside
the functions and then returning 0 therefore does not fail the request
as intended.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2026-02-20 14:58:46 +01:00
Dipak Shetty
cae71714de bluetooth: services: add Elapsed Time Service support
Added support for elapsed time service (ETS). The service
is introduced currently with the experimental tag.

Signed-off-by: Dipak Shetty <shetty.dipak@gmx.com>
2026-02-20 13:30:34 +01:00
Emil Gydesen
12c30e526a Bluetooth: TBS: Allow join in alerting/dialing state
The TBS spec only specificially disallows join for calls in
the incoming state. The Alerting and Dialing state in Zephyr
were disallowed, but that fails some TBS join tests.

Removed the (implicit) checks for alerting and dialing and
updated the state changer code to be more explicitly so that
all call states, except for incoming, is explicitly handled.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-20 10:11:46 +01:00
Emil Gydesen
dd4a01af48 Bluetooth: TBS: set_uri_scheme_list single string instead of array
Refactor bt_tbs_set_uri_scheme_list to take a single string instead
of an array of URIs. This should not affect applications much
in any way (and may actually be easier to use), but simplifies
the implementation significantly, and reduces memory footprint.

Additionally it also make the client and server more similar
as bt_tbs_client_read_uri_list just returns it as a single
string as well.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-20 10:10:38 +01:00
Emil Gydesen
796ac63086 Bluetooth: PACS: Add missing checks before assert in register
bt_pacs_register would assert if e.g.
CONFIG_BT_PAC_SRC_NOTIFIABLE=y but param.src_pac = false.

Add checks for setting the attributes, only if the parameter
actually enables the characteristics.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-20 10:09:15 +01:00
Lauren Murphy
ebf1f9d019 tests: llext: fixes for arcmwdt, gcc
Adds fixes for build and runtime issues using MWDT:

* Rename sections for llext_memblk.c buffers as MWDT cannot initialize
  sys_mem_blocks struct with buffer address when the section name of
  sys_mem_blocks struct (its variable name) is identical to the
  buffer's section name
* Adds --no-check-sections flag for MWDT on final stages of
  linking. Unlike other toolchains, MWDT's default behavior is to
  strictly check and fail on section overlap. Using SLIDs requires
  overlap; see llext-sections.ld
* Modifies inspect test case's ifdef around rodata sections, as
  not all Harvard platforms using MWDT have .rodata_in_data sections -
  their creation is triggered by passing the -Hccm flag to CCAC.
  As an example, nsim/nsim_em doesn't have them and nsim/nsim_vpx5 does
* Removes -Hccm flag when building with CONFIG_LLEXT_RODATA_NO_RELOC
  as it causes CCAC to mark the custom section llext.rodata.noreloc
  writable (SHF_WRITE) though it has only read-only data, making it
  impossible for for LLEXT to recognize it and put it in the
  appropriate region; see llext_load.c's llext_map_sections
* Adds name to unnamed first argument of threads_objects_test_setup,
  removing warning about omitting parameter names being a
  C2x extension

Also fixes a build warning for GCC about pointer arithmetic in
the INSTR_FETCHABLE macro.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2026-02-20 07:07:52 +01:00
Gaetan Perrot
951f8d48b0 bluetooth: audio: bap_stream: Fix possible NULL dereference
Avoid dereferencing `stream` in the debug log message when checking
for invalid input parameters.

The previous log printed `stream->ep` and `stream->conn` inside a
combined NULL check, which could trigger static analysis warnings
about a possible NULL pointer dereference.

Align the implementation with the existing pattern used in the file
by logging a generic "Invalid stream" message instead.

No functional change.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-02-19 10:04:50 -06:00
Lingao Meng
49e7643671 tests: nvs: expose nvs_flash_al_wrt_streams for testing
Make nvs_flash_al_wrt_streams() non-static when CONFIG_ZTEST is
enabled so it can be unit tested.

Add test_nvs_write_stream to verify correct concatenation and
write behavior for different head/data/tail combinations.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-02-19 10:02:36 -06:00
Lingao Meng
292beaae8d fs: nvs: pack data during GC and flush tail via buffered block move
Rework the NVS garbage collection data move path to support
write-block–aligned packing of consecutive records.

Introduce struct nvs_block_move_ctx to buffer unaligned tail
bytes during GC. Data is moved in write_block_size-aligned chunks
only, and any remaining bytes smaller than one write block are
temporarily buffered and prepended to the next write. The final
tail is flushed before GC completion.

Extend struct nvs_flash_wrt_stream to support an optional
header buffer, allowing head/data/tail segments to be written
as a single contiguous stream while respecting flash alignment
requirements.

This enables packed back-to-back data movement during GC without
introducing additional padding between records. CRCs are not
recomputed for moved data, preserving on-flash format and
compatibility.

No changes are made to normal nvs_write() alignment semantics
outside of GC.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-02-19 10:02:36 -06:00
Lingao Meng
e9ff9a5c5b fs: nvs: allow pending write to be committed during GC
Extend the NVS garbage collection path to optionally commit a
pending write request while GC is running.

Introduce struct nvs_gc_write_entry to describe a write operation
that may be handled during GC. When space is insufficient and GC is
triggered from nvs_write(), the write request is passed to
nvs_gc(). If the entry being updated is encountered in the sector
currently being garbage collected, the old copy is skipped and the
new data may be written directly into the active sector, provided
there is sufficient space.

This avoids unnecessary data movement where the old entry would
otherwise be copied during GC and then immediately superseded by a
new write.

The existing GC behavior is preserved when no pending write is
provided.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-02-19 10:02:36 -06:00
Lingao Meng
56ea1e6619 fs: nvs: introduce stream-based aligned flash write helper
Introduce nvs_flash_al_wrt_streams() to support aligned flash
writes composed of a primary data buffer and an optional tail buffer.

This refactors the existing aligned write path to allow multiple
contiguous buffers to be written as a single logical stream while
respecting flash write-block alignment requirements. The new helper
enables cleaner handling of cases where data must be extended with
additional metadata (e.g. CRC) without temporary concatenation
buffers or partial pre-writes.

nvs_flash_data_wrt() is updated to use the stream-based interface
for CRC handling. The existing nvs_flash_al_wrt() API is preserved
as a thin wrapper for backward compatibility.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>

iiii

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-02-19 10:02:36 -06:00
Emil Gydesen
b438540a09 Bluetooth: CAP: Log ADV address when starting via handover
When starting adv via handover, we log the address used
for the advertising set for debugging purposes.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-02-19 10:00:26 -06:00
Radosław Koppel
1fa8739af7 Bluetooth: Host: Conn: Add GAP service validation
Implement the validation if there is exactly one GAP service
in GATT database.
The validation is performed as soon as the GATT database
is available and forbids to enable the Bluetooth if the configuration
is not compatible with the Bluetooth Specification.
The verification may be disabled by the user for better performance
or deliberate implementation that is not compliant with the
specification.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
2026-02-19 09:58:49 -06:00
Radosław Koppel
9f33889066 Bluetooth: gap_svc_default: Set user_data for name characteristic to NULL
Set the unused argument of the name characteristic to NULL.
This removes the reference from GAP service to the hci_core.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
2026-02-19 09:58:49 -06:00
Radosław Koppel
95e9f27939 Bluetooth: gap_svc_default: Update attribute len checking in write_name
Remove offset form the attribute length checking as the offset
is tested before to be 0.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
2026-02-19 09:58:49 -06:00
Radosław Koppel
233495d234 Bluetooth: gap_svc_default: Add BT_ prefix to DEVICE_xxx_GATT_WRITABLE_
Rename the DEVICE_NAME_GATT_WRITABLE_ kconfig options to
BT_DEVICE_NAME_GATT_WRITABLE_.
Rename DEVICE_APPEARANCE_GATT_WRITABLE_AUTHEN to
BT_DEVICE_APPEARANCE_GATT_WRITABLE_AUTHEN.

The old options are marked as deprecated.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
2026-02-19 09:58:49 -06:00
Radosław Koppel
e5258ed86d Bluetooth: Host: Extract GAP service from GATT
Remove Generic Access Service implementation from gatt files and move it
into separate file in services directory.
The default service implementation can be disabled by the user in purpose
of providing the GAP implementation directly in the application.

Signed-off-by: Radosław Koppel <r.koppel@k-el.com>
2026-02-19 09:58:49 -06:00
Krzysztof Chruściński
ef085c6898 logging: frontends: improve Kconfig for Coresight STM frontend
Add missing fields in arm,stmesp binding and limit Coresight STM
frontend to SoCs which have the required hardware.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-02-19 12:53:43 +01:00
Krzysztof Chruściński
f1e1711995 logging: frontends: Enable special alignment for cbprintf packages
Use specific alignment when STM logging frontend is used on RISCV
core (PPR or FLPR). It fixes the case where 64 bit variable were
incorrectly logged.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-02-19 12:53:43 +01:00