Commit graph

24,075 commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada
43dede5acc Bluetooth: Host: settings: Add early len check without strncpy/cmp use
Add early len check, remove use of strcpy, strncpy and
strncmp.

Co-authored-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-01-22 13:01:07 -05:00
Vinayak Kariappa Chettimada
230453b6ea Bluetooth: Host: settings: Fix truncation detection after strncpy
Fix truncation detection after strncpy, as strlen cannot be
used if the src was truncated due to insufficient size of
dst.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-01-22 13:01:07 -05:00
Vinayak Kariappa Chettimada
d98c2cf0d8 Bluetooth: Host: Rework settings without snprintk to return error
Rework settings implementation for not reusing the OS
snprintk implementation with CONFIG_PRINTK=n and to return
error if path buffer is insufficient.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-01-22 13:01:07 -05:00
Vinayak Kariappa Chettimada
d8f3e43b20 Bluetooth: Host: Rework settings without snprintk use
Rework settings implementation for not reusing the OS
snprintk implementation with CONFIG_PRINTK=n.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-01-22 13:01:07 -05:00
Vinayak Kariappa Chettimada
2db3f7978f Bluetooth: Host: settings without snprintk use
Update settings implementation for not reusing the OS
snprintk implementation with CONFIG_PRINTK=n.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-01-22 13:01:07 -05:00
Vinayak Kariappa Chettimada
4a914bf281 Bluetooth: Host: ATT: Do not use bt_addr_le_to_str when CONFIG_LOG=n
Do not use bt_addr_le_to_str() when CONFIG_LOG=n.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-01-22 13:01:07 -05:00
Robert Lubos
5a0f33b31f net: sockets: tls: Enforce minimum TLS version
Enforce the minimum TLS version on mbed TLS, based on the protocol
version provided by the application when creating socket. This ensures
that when application creates a TLS 1.3 socket, mbed TLS won't downgrade
the session to TLS 1.2 for instance.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-22 12:56:12 -05:00
Flavio Ceolin
59a57722ae pm: Fix wrong type promotion
In pm_system_suspend there is a possible invalid type promotion
in sys_clock_set_timeout(MAX(0, ticks - exit_latency_ticks), true);

ticks is int32_t and exit_latency_ticks is uint32_t consequently
ticks is promoted to uint32_t resulting in a possible underflow and
setting a wrong value in sys_clock_set_timeout().

Fixes #100005
Coverity CID: 535628

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2026-01-22 12:54:52 -05:00
Lingao Meng
d845a2230e fs: nvs: prevent ATE writes at sector boundary
In NVS, allocation table entries (ATEs) are written backwards within
each sector. Under delete-only or delete-heavy workloads, a sector may
contain only delete ATEs, causing the ATE write pointer to approach the
sector boundary.

Without an explicit boundary check, ATE writes may occur at offset 0 of
the current sector, allowing the write pointer to underflow into the
previous sector and corrupt unrelated data or metadata.

Fix this by disallowing ATE writes when the write pointer is at the
sector boundary. This ensures that ATE writes remain confined to the
current sector and prevents pointer underflow across sectors.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2026-01-22 14:09:23 +00:00
Vinayak Kariappa Chettimada
73c182509c Bluetooth: Controller: LLL prepare at margin Kconfig
Introduce Kconfig option to enfore LLL prepare at margin
irrespective of whether there is an overlapping state/role.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-01-22 14:09:11 +00:00
Vinayak Kariappa Chettimada
5fe53aaa84 Bluetooth: Controller: Use PPI/DPPI to start s/w switch timer
Use PPI/DPPI to start s/w switch timer to reduce current
consumption.

Explicitly starting the s/w switch timer at prepare meant
current being consumed in the prepare margin duration. Use
of PPI/DPPI ensure s/w switch timer is start when event
timer is started after the prepare margin.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-01-22 14:09:11 +00:00
Vinayak Kariappa Chettimada
0b1b099196 Bluetooth: Controller: Fix PAST sync_offset_us calculation
Fix the missing use of remainder value in the sync_offset_us
calculations. Also, Periodic Sync reception is relative to
Peripheral event hence ticks_anchor does not require the
ticker margin and event jitter to be subtracted.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-01-22 14:09:11 +00:00
Valerio Setti
77d603a5e0 storage: flash_map: remove legacy Mbed TLS crypto for integrity check
Remove Kconfig and code related to legacy Mbed TLS crypto for SHA-256.
This was used for the integrity check functionality as alternative to
PSA Crypto API. This support was already deprecated and now it's removed
in order to prepare for the next Mbed TLS 4.0 release where legacy crypto
won't be available anymore.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-01-22 14:03:06 +00:00
Yangbo Lu
05c1fecb5b drivers: ethernet: dsa: move dsa_tag_netc driver out of subsys
Moved dsa_tag_netc driver out of subsys. Maintained it in
drivers/ethernet/dsa as vendor driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-01-22 08:41:00 +00:00
Yangbo Lu
1b14cb18a2 net: dsa: support dsa protocol registering with iterable section
Supported dsa protocol registering with iterable section.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-01-22 08:41:00 +00:00
Yangbo Lu
d9d46c0ce3 net: dsa: make dsa_tag.h as common header file
Moved dsa_tag.h to include folder as common header file.
And we will support iterable section for vendor dsa tag
protocol drivers registering.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-01-22 08:41:00 +00:00
Ibrahim Abdalkader
0c5e7a6a95 sensing: sensor_mgmt: Use kernel heap for allocations
Use the kernel heap instead of the libc heap, improving
security and consistency.

Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
2026-01-22 08:38:34 +00:00
Ibrahim Abdalkader
afa47a2765 mgmt: mcumgr: grp: Use kernel heap for allocations
Use the kernel heap instead of the libc heap, improving
security and consistency.

Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
2026-01-22 08:38:34 +00:00
Mark Wang
f66ce9c251 bluetooth: shell: a2dp: include error code in failure messages
Add error code parameter to all A2DP shell error messages to provide
more detailed diagnostic information when operations fail. This applies
to configure, establish, release, start, suspend, delay report, and
abort response handlers.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2026-01-22 08:37:41 +00:00
Mark Wang
d8eb0ce5f4 bluetooth: shell: a2dp: use bt_shell_error for error messages
Replace bt_shell_print() calls with bt_shell_error() for all error
conditions and failure cases in the A2DP shell implementation to
properly distinguish error messages from informational output.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2026-01-22 08:37:41 +00:00
Mark Wang
313478b026 bluetooth: shell: a2dp: use bt_shell_xxx instead of shell_xxx
Replace all shell_print() and shell_error() calls with bt_shell_print()
and bt_shell_error() respectively to use the common Bluetooth shell
printing functions throughout the A2DP shell implementation.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2026-01-22 08:37:41 +00:00
Mark Wang
36ab1ba154 Bluetooth: shell: a2dp: Update a2dp sdp profile version
The newest a2dp spec set the profile version as 1.4.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2026-01-22 08:37:41 +00:00
Mark Wang
6f0b31c709 bluetooth: shell: a2dp: improve a2dp shell cmds
add abort req and rsp callbacks, improve register_ep cmd to support delay
report, check buf tailroom for sending media, add get_conn cmd to test
bt_a2dp_get_conn.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2026-01-22 08:37:41 +00:00
Mark Wang
c92d617855 bluetooth: shell: a2dp: use common function to check a2dp initialization
Before every cmd, call one common function to check whether a2dp is
initialized.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2026-01-22 08:37:41 +00:00
Supper Thomas
bd9bf13a0e logging: Fix backoff calculation to use K_CYC instead of K_TICK
The backoff timeout calculation in z_log_msg_claim_oldest() was
incorrectly using K_TICK macro. Changed to K_CYC to properly convert
cycle-based timing differences to kernel timeouts for accurate backoff
in multi-domain message processing.

Signed-off-by: Supper Thomas <78900636@qq.com>
2026-01-21 20:07:56 +01:00
Tahsin Mutlugun
2de323cd3e testsuite: Correct broken link to coverage documentation
The existing documentation link pointed to a non-existent page.
Update the link to use the current documentation URL.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
2026-01-21 17:09:07 +01:00
Jeroen Broersen
a10f7f3541 net: lwm2m: senml opaque base64 encoding fix
The SenML-JSON specification mentions base64-encoded data with the
URL-safe alphabet and padding omitted.
For sending data, zephyr used normal base64 with padding. Change the
base64 data to use the URL-safe format without padding when sending opaque
data via SenML-JSON.
Fixes #102390

Signed-off-by: Jeroen Broersen <jeroen.broersen@wioniq.com>
2026-01-21 17:08:41 +01:00
Robert Lubos
fbd9079148 net: dns: Implement CONFIG_DNS_RESOLVER_ADDITIONAL_QUERIES
There was a Kconfig option defined to limit the number of additional DNS
queries sent for aliases received in CNAME records (to avoid potential
query loops), however it was not implemented. This commit implements the
feature - the resolver will now only send up to
CONFIG_DNS_RESOLVER_ADDITIONAL_QUERIES follow-up queries after
receiving CNAME record with an alias w/o any IP addresses.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-21 17:08:29 +01:00
Robert Lubos
38d9c632d6 net: dns: Fix query redirection in case of CNAME result
In case CNAME record is received with no IP addresses, DNS resolver will
attempt to re-send the query for the name indicated by the CNAME record.
The logic for scheduling the new query was inconsistent though:
dispatcher_cb() assumes that it'll reuse the query context with the same
query id, while dns_read() cancelled the query, which shouldn't really
happen, as that would cause an error to be reported to the application
via callback.

Fix that by skipping the query cancel in case of DNS_EAI_AGAIN result.
The query context will be properly reused then, and freed either when
reply for another query arrives, or the query times out.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-21 17:08:29 +01:00
Robert Lubos
2a1b814f7b net: dns: Don't report CNAME records via callback
Don't report CNAME records via application callback (as it used to be
done). They don't carry any data in the info struct and are only used
internally to redirect DNS queries.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-21 17:08:29 +01:00
Evgenii Kosenko
7deab5e334 Bluetooth: Shell: Add per-bearer pool for GATT operations
The original implementation used a single global parameter structure for
GATT operations, preventing concurrent operations on different bearers. By
introducing a per-bearer context pool, each bearer can maintain its own
operation state, enabling simultaneous GATT operations.

Signed-off-by: Evgenii Kosenko <Evgenii.Kosenko@silabs.com>
2026-01-21 13:01:42 +00:00
Jamie McCrae
917404f5d7 mgmt: mcumgr: transport: uart: Change Kconfig to depends on
Changes CONFIG_MCUMGR_TRANSPORT_UART from selecting
CONFIG_UART_MCUMGR to instead of depending upon it, as it should
never have selected a driver Kconfig and instead always depended
upon it, and is needed for supporting different UART transports

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-21 11:21:46 +00:00
Tom Hughes
8ea64b7b33 bluetooth: audio: Fix redundant initialization
When building the bluetooth.general.tester_le_audio test with clang and
-Winitializer-overrides, it warns:

subsys/bluetooth/audio/mpl.c:318:2: error: initializer overrides prior
initialization of this subobject [-Werror,-Winitializer-overrides]
  318 |         .add_group = NULL,
      |         ^~~~~~~~~~~~~~~~~
subsys/bluetooth/audio/mpl.c:317:15: note: previous initialization is here
  317 |         .add_track = NULL,
      |                      ^~~~

Remove redundant initializer for add_group which overlaps with add_track
in an anonymous union.

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2026-01-20 20:09:06 -05:00
Benjamin Cabé
25448bc996 task_wdt: adopt SHELL_HELP in task watchdog shell
Use SHELL_HELP macro for help strings to ensure consistency across
various shell modules.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-01-20 20:07:37 -05:00
Carlo Caione
c4a5c5cc32 lorawan: loramac-node: Use zephyr_library_compile_definitions_ifdef
Replace zephyr_compile_definitions_ifdef with
zephyr_library_compile_definitions_ifdef to avoid setting options globally.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-01-20 14:34:44 -05:00
Fin Maaß
77c4fd9a53 console: add functions to set the timeout
While the tty_* api already has functions
to set the rx and the tx timeout, the console_*
api didn't had one.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-01-20 14:34:29 -05:00
Fin Maaß
2ed0e04dc8 console: use k_timeout_t internally
use k_timeout_t internally, that way
the timeout has only to be calculated, when setting it and not
every time when it is used.

Also use the ys_timepoint* api instead of
counting the ms.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-01-20 14:34:29 -05:00
Flavio Ceolin
cc1391b5f7 random: entropy: Always check device is ready
Use a proper branch instead of an assert to check if the device
is ready. It can potentialy lead to improper random
value that can compromise security.

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2026-01-20 14:34:13 -05:00
Flavio Ceolin
213b1605d8 random: ctr_drbg: Fix sys_csrand_get types
This implementation of sys_csrand_get was using a
different type for the length parameter.

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2026-01-20 14:34:13 -05:00
Chaitanya Tata
0305a9f157 net: l2: ethernet: Fix build error
When Ethernet management is not enabled, the respective calls should
also be compiled out. In case there are no callers the toolchain will
remove this, hence it worked till date.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2026-01-20 14:33:58 -05:00
Chaitanya Tata
0907ffb370 net: lib: shell: Add TX injection command
This to make the interface operationally UP to allow data packets in RAW
socket mode.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2026-01-20 14:33:58 -05:00
Chaitanya Tata
23ba648b82 net: lib: zperf: Add raw socket upload support
This helps in benchamrking raw socket (packet socket) performance in the
lines of UDP/TCP.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2026-01-20 14:33:58 -05:00
Jamie McCrae
e3371aaf24 mgmt: mcumgr: Add name to CMake libraries
Adds names to these libraries to prevent using auto-generated
names of the paths, which can be longer than the maximum supported
length on the current version of gcc for windows

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-20 15:31:50 +00:00
Jamie McCrae
42ee9832b4 mgmt: mcumgr: kconfig: Fix various issues
Fixes various issues in the Kconfigs including not properly having
abbreviations in the correct case, line lengths, duplicating other
Kconfigs, etc.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-20 15:31:50 +00:00
Emil Gydesen
a25598eab9 Bluetooth: CSIP: Fix set member register issue
Fix issue with re-registering CSIS where it relied on
a stack allocated value during the service unregistering
and reset. To fix this properly, and to allow for further
optimization, the register function was refactored to dynamically
create the service, rather than relying on a static allocation
and dynamically remove unwanted characteristics.

Additionally this new approach also allow us to rely on
IS_ENABLED and remove some #if defined, as well as reducing
both ROM and RAM memory usage.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-01-20 13:23:28 +00:00
Lyle Zhu
ef7b132bfd Bluetooth: Classic: Fix initialization to support re-initialization
In current implementation, the Classic L2CAP server list will be
cleared when the function `bt_enable()` called. It causes the
registered Classic L2CAP servers are unregistered. However, the
higher-ups were completely unaware of this behavior. It causes the
Classic L2CAP server cannot work after executing the sequence
`bt_enable()`, `bt_disable()`, and `bt_enable()`. Also this behavior
is inconsistent with LE L2CAP server.

Remove the initialization of Classic L2CAP server list from function
`bt_l2cap_br_init()` to fix the issue.

Make Bluetooth Classic profile initialization functions idempotent
by adding static initialized flags to prevent re-initialization.
Change return type from int to void since errors are now logged
but not propagated.

Changes include:
- Add initialized flag to prevent multiple initialization
- Change return type to void for init functions
- Mark err variables as __maybe_unused where appropriate
- Improve error logging with error codes
- Handle -EEXIST and -EALREADY errors for re-registration
- Initialize connection pools before checking initialized flag
  in AVRCP to support re-initialization scenarios
- Remove unnecessary sys_slist_init in bt_l2cap_br_init

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-01-20 13:23:14 +00:00
Lyle Zhu
4146c053d2 bluetooth: shell: Fix error code formatting in BR/EDR shell
Fix incorrect error code formatting in Bluetooth BR/EDR shell commands.
Error codes are already negative values, so remove the redundant negation
when printing error messages. Also update PSM registration message to
print the PSM value in hexadecimal format for consistency.

Changes:
- Remove negation of error codes in shell_error() calls
- Change PSM format specifier from %u to %04x for hex display
- Affects l2cap_disconnect, l2cap_send, l2cap_credits, l2cap_echo_reg,
  l2cap_echo_unreg, l2cap_echo_req, and l2cap_echo_rsp commands

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-01-20 13:23:03 +00:00
Håvard Reierstad
f5f7bb4461 Bluetooth: Host: Add bt_keys config flag
Adds a flag `cfg_flags` to the `bt_keys` struct  and a version field
`cfg_version` in order to be able to detect configuration changes
between firmware updates. This is needed because the `bt_keys` struct
has fields which are compiled in depending on which Kconfig options are
enabled, enabling the possibility of stored data being intepreted
wrongly if the struct changes.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2026-01-20 13:22:05 +00:00
Jamie McCrae
9700579f6a bluetooth: Update to use SOC_SERIES_NRF Kconfigs without X suffix
Updates usage of the old Kconfig to use the new Kconfig

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-20 13:21:38 +00:00
Kyra Lengfeld
ed5683250c Bluetooth: Host: make TX processor stack size configurable
While the tx processor thread is needed to prevent deadlocks and is as
such always enabled, its stack size may be adjusted based on need.
What is needed is dependent on which features are enabled in the
zephyr host as well as other project configurations impacting the
zephyr host.

Signed-off-by: Kyra Lengfeld <kyra.lengfeld@nordicsemi.no>
2026-01-20 13:21:17 +00:00