Commit graph

24,075 commits

Author SHA1 Message Date
Brandon Edmonds
939559bc8e sensing: sensor_mgmt: Fix polling in sensing subsys.
The sensing subsystem currently calls fetch and get from a timer ISR
context. A TODO had been previously added to move this to the runtime
thread context, which has been done in this fix.

Signed-off-by: Brandon Edmonds <bedmonds91@gmail.com>
2026-02-03 14:28:15 -06:00
Lauren Murphy
085889e620 llext: sys_mem_blocks as alternate heap implementation
Adds sys_mem_blocks as an alternative implementation
for the heap. Users have reported that k_heap allocating
additional bytes for bookkeeping data when allocating e.g.
a LLEXT_PAGE for an extension region causes them to skip
an entire page for the next allocation. This also causes
problems RE: MPU slot usage. sys_mem_blocks stores bookkeeping
data outside of the memory it allocates from and does not
have this issue.

Note that sys_mem_blocks is only used to allocate extension
regions. Metadata is still stored in a k_heap.

Note also that tracking data for sys_mem_blocks must be stored
per extension, as unlike k_heap it can't deallocate with just
a pointer to the memory.

Further limitations:
* sys_mem_blocks is statically allocated, so this option
  cannot be used with CONFIG_LLEXT_HEAP_DYNAMIC
* A minimum of 1 block must be allocated per region
  regardless of size.
  * If using the MPU / MMU where small allocations are
    rounded up to LLEXT_PAGE regardless, this penalty
    is not quite as noticeable.
* sys_mem_blocks does not support aligned allocations. However,
  by selecting a sufficiently large power of 2 for the
  block size and aligning the backing buffer to the block size,
  any allocation will be automatically aligned for the block size
  and smaller powers of 2. For LLEXT, this means users must select
  a block size equal to or a multiple of the largest
  requested region alignment of regions going on the heap
* If your MPU selects CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT,
  large regions may cause unreasonably large maximum requested
  region alignments
* Block size must also be equal to or a multiple of
  LLEXT_PAGE_SIZE so each allocation is LLEXT page aligned

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2026-02-03 08:22:11 -06:00
Lauren Murphy
3172281e70 llext: add heap implementation kconfig option
Adds a Kconfig option to select LLEXT heap implementation.
Another choice, sys_mem_blocks, will be introduced in the
following commit.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2026-02-03 08:22:11 -06:00
Lyle Zhu
6e003239e5 Bluetooth: Host: GOEP: force 16-bit FCS for L2CAP ERTM
Set the FCS option to BT_L2CAP_BR_FCS_16BIT for enhanced retransmission
mode in both L2CAP accept and connect paths to work around an
interoperability issue with iPhone devices.

The issue occurs when connecting to iPhone for PBAP or MAP profiles,
where the iPhone expects the 'No FCS' option to be applied but does
not include the 'No FCS' option in its L2CAP_CONFIGURATION_REQ packet.
Forcing 16-bit FCS ensures proper configuration negotiation.

Changes include:
- Set rx.fcs to BT_L2CAP_BR_FCS_16BIT in goep_l2cap_accept()
- Set rx.fcs to BT_L2CAP_BR_FCS_16BIT in
  bt_goep_transport_l2cap_connect()

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-02-03 13:03:09 +01:00
Nicolas Pitre
7fb8f34c87 ztest: fix recursive panic when fatal error occurs pre-kernel
When a fatal error occurs before the kernel is fully initialized
(e.g., during early boot), the ztest fatal error handler would call
k_current_get() which now contains an assertion that fails if called
pre-kernel (added in commit 5ce408b647 ("kernel: assert if
k_current_get is called pre-kernel")). This assertion failure
triggers another panic, creating an infinite recursion that floods
the console with nonsensical values.

Check k_is_pre_kernel() to decide which method to use: _current
directly when pre-kernel (to avoid the k_current_get assertion), or
k_current_get() otherwise for proper userspace and TLS support.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-02-03 09:43:42 +01:00
Lyle Zhu
fe68ab16d5 Bluetooth: Classic: HFP AG: skip callback if AG is disconnected
Move state retrieval before error handling to ensure it's always
available for subsequent checks. Add a check to prevent executing
the callback when the AG connection is in a disconnected state.

This prevents potential use-after-free or invalid state access when
the callback is invoked after the AG has been disconnected, improving
the robustness of the notification work handler.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-02-03 09:39:51 +01:00
Paul Wedeck
ee80a68d29 logging: backend: Fix invalid return value in log_backend_net.c
log_backend_net supports both tcp and udp. If no tcp support is
compiled in, line_out will return an invalid number of consumed
bytes (-EINVAL). This patch removes the is_tcp flag if tcp support
is not compiled in and moves the error check into init_net.

Signed-off-by: Paul Wedeck <paulwedeck@gmail.com>
2026-02-03 09:26:20 +01:00
Fin Maaß
f471eb25d0 fs: littlefs: filter automount durring build
filter automount durring build.

Also add the automaticly enabled Kconfig option
CONFIG_FS_LITTLEFS_FSTAB_AUTOMOUNT, similar
to the fat fs and ext2 fs.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-02-02 11:40:12 -06:00
Fin Maaß
3dca26f5a1 fs: ext2: filter automount durring build
filter automount durring build.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-02-02 11:40:12 -06:00
Fin Maaß
82a77b1f3f fs: fatfs: filter automount durring build
filter automount durring build.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-02-02 11:40:12 -06:00
Fin Maaß
9fec4af772 fs: fatfs: enable automount by default if activated in dt
If automount is enabled in the devicetree for
a fatfs, then enable the Kconfig option by default.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-02-02 11:40:12 -06:00
Robert Lubos
476ae94f31 net: sockets: Fix userspace recvmsg() msg_namelen copying
The recvmsg() msg->msg_namelen was not updated if CONFIG_USERSPACE
was enabled.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-02-02 12:57:28 +01:00
Robert Lubos
6514e7bcf9 net: sockets: Set address in TCP recvfrom()
Sender address and address length were not set in recvfrom() when called
for TCP socket. Fix this by reusing the code used to set source address
on accept().

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-02-02 12:57:28 +01:00
Ren Chen
11a23fccb3 pmci: mctp: mctp_i3c_controller: fix missing STOP flag for i3c write msg
This commit adds the missing `I3C_MSG_STOP` flag for i3c
write message.

Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
2026-02-02 10:00:55 +01:00
Ren Chen
0fc925ee6a pmci: mctp: mctp_i3c_target: fix incorrect return code check
The return value greater than 0 from `i3c_target_tx_write()`
indicates the number of bytes written. This patch fixes
the incorrect check.

Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
2026-02-02 10:00:55 +01:00
Gaetan Perrot
7f93ac21c7 settings: settings_zms: make settings_zms_dst and settings_zms_src void
settings_zms_dst() and settings_zms_src() never reports errors and
always returns 0.
The error check at the call site is therefore dead code.

Make the function void and drop the unused error handling.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-01-31 17:30:07 +01:00
Ryan Smith
b54d787d3e shell: allow empty prompt
Setting the prompt to the empty string allows it to be hidden. This is the
intent of the shell command 'shell prompt off'. However, in the most recent
change to the prompt handling, this functionality was lost. Presumably,
the check for 'prompt_length == 0' was to avoid a NULL prompt. However,
NULL is already checked for. Remove the zero-length check and restore the
ability to set the prompt to the empty string.

Signed-off-by: Ryan Smith <elryno@elryno.com>
2026-01-31 17:29:18 +01:00
Robert Lubos
5cb214d263 net: ip: Add dependency to NET_NATIVE when reserving FD
Increasing FD count in the system for the network stack (native sockets)
only makes sense if native network stack is enabled. Otherwise, just
make it 0. This makes a difference for example when socket offloading is
used and the offloaded implementation makes its own reservation.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-30 18:04:12 +01:00
Karel Blavka
699e7c2ebc shell: add configurable bypass buffer size
The bypass mode in shell.c transfers data in a loop and doesn't need
a large buffer. The previous code conditionally used
CONFIG_SEGGER_RTT_BUFFER_SIZE_DOWN which unnecessarily tied the bypass
buffer size to RTT configuration and could increase stack usage when
RTT buffer is configured larger.

This adds CONFIG_SHELL_BYPASS_READ_BUF_SIZE with a default of 16 bytes,
which is sufficient for the iterative read loop. A build-time assert
ensures the buffer doesn't exceed SHELL_STACK_SIZE.

Fixes: db9dccdc8a

Signed-off-by: Karel Blavka <karel.blavka@hardwario.com>
2026-01-30 18:03:52 +01:00
Cristian Bulacu
a367c439f7 net: l2: openthread: border_router: Split IPV4/IPV6 service init
This commits splits the border router services initialization by
separating the ipv6 related services from ipv4 ones.
As there are cases in which a DHCPv4 server is not present in the
network setup, there is no reason to wait for an IPV4 address before
starting the border router. In this case, only IPV6 functionalities
would be exposed.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2026-01-30 18:03:36 +01:00
Michael Zimmermann
caaa0c696e net: mqtt_sn: udp: fix getting TTL
The length is an input parameter, which tells the kernel how big the
storage is. Depending on the socket implementation in use, not setting this
properly can (and should) fail depending on the value of the stack
variable.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2026-01-30 05:58:15 -06:00
Michael Zimmermann
41f68b6035 net: mqtt_sn: udp: simplify TTL code
5f5db5bf3c added support for IPV6_MULTICAST_HOPS by adding both IPv4 and
IPv6 variants in place where they are used. This made the code a bit
complicated, though. This commit introduces helper functions to solve this.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2026-01-30 05:58:15 -06:00
Ederson de Souza
e16af98a66 subsys/pmci/mctp: Allow UART RX to be stopped
There's a method to enable RX (`mctp_uart_start_rx`), but not one to
stop it. This patch adds `mctp_uart_stop_rx` to do so.

It will be handy at least for tests, as it allows two MCTP endpoints to
share a single UART device - as long as only one has RX enabled - and
"ping-pong" messages between them.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2026-01-30 09:17:39 +01:00
Sumit Batra
124b383945 pmci: mctp_usb: Arm initial OUT and harden disable cleanup
Arm the first OUT transfer when class is enabled
so the host's first write can complete.
On disable, cancel worker, drain FIFO, reset RX parser,
and unblock tx_lock if disconnect occurs mid-transfer.

Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
2026-01-29 16:10:49 -06:00
Sumit Batra
5ca15aa1cc pmci: mctp_usb: Add ZLP handling and track IN completions
Add optional ZLP after an IN transfer that is an exact multiple of the
endpoint MaxPacketSize. Track outstanding IN completions via in_pending
to release tx_lock exactly once.

Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
2026-01-29 16:10:49 -06:00
Sumit Batra
ca248cf3e7 pmci: mctp_usb: re-arm BULK OUT and parse RX via k_fifo
Switch RX handling to enqueue completed OUT buffers into a FIFO
and parse them in a worker.
Re-arm BULK OUT immediately to avoid host-side stalls.
Drop zero-length OUT completions without scheduling the worker

Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
2026-01-29 16:10:49 -06:00
Murali Iyengar
09f92ad393 tracing: add external tracing module support
Enhancement request:
zephyrproject-rtos/zephyr#37912

Code reference from
zephyrproject-rtos/zephyr#39552

Adds out of tree tracing backend support

Signed-off-by: Murali Iyengar <murali.r.iyengar@intel.com>
2026-01-29 17:20:22 +01:00
Guilherme Costa
2590401cfa testsuite: ztest_posix: Do not register -test if ZTEST_SHELL=y
The -test command line option can be used to filter tests for execution
on native_sim targets, but if ZTEST_SHELL is enabled this filtering can
be done via the shell itself, so the option loses its purpose and can be
disabled.

Signed-off-by: Guilherme Costa <glhrmcosta91@gmail.com>
2026-01-29 17:19:51 +01:00
Guilherme Costa
1c6b554a29 testsuite: Make TC_END_POST empty when ZTEST_SHELL is enabled
On POSIX targets, TC_END_POST calls posix_exit(), which terminates the
process after test execution. When tests are run via the ztest shell,
this behavior is undesirable, as the shell session is expected to remain
active for further interaction.

Change TC_END_POST to expand to an empty statement when CONFIG_ZTEST_SHELL
is enabled, preventing premature process termination.

Signed-off-by: Guilherme Costa <glhrmcosta91@gmail.com>
2026-01-29 17:19:51 +01:00
Guilherme Costa
e0a833a21e testsuite: Add missing functions to ztest_posix
When CONFIG_ZTEST_SHELL=y, the system failed to compile due unsatisfied
references to ztest_set_test_args and ztest_reset_test_args. This commit
fixes the issue by copying these functions from ztest_shell and
modifying libc calls to their nsi_host_* equivalents, fixing
compilation.

Signed-off-by: Guilherme Costa <glhrmcosta91@gmail.com>
2026-01-29 17:19:51 +01:00
Robert Lubos
5d0c9391cd net: tcp: Drop redundant depends on NET_TCP in Kconfig
The whole TCP Kconfig options block is already behind "if NET_TCP",
therefore "depends on NET_TCP" on certain options was redundant.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-29 17:19:03 +01:00
Robert Lubos
c60f51e2ab net: tcp: Add Kconfig option to preserve TCP contexts on iface down
Zephyr by default closes all TCP contexts associated with a given
network interface when the interface goes down. This leads to
reporting an error on the associated network socket, allowing the
application to reopen sockets (for example in case of a network or
an IP address change).
It's been reported however that in certain cases this behavior is
undesirable. If this option is enabled, the TCP stack won't
close any TCP contexts when the network interface is going down.
Therefore, it is the application's responsibility to monitor the IP
address or network interface state changes, and restart the TCP
sockets when needed. Enable this option only if you can guarantee
that the application handles that properly.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-29 17:19:03 +01:00
Robert Lubos
da563ebecd net: tcp: Don't close TCP contexts bound to any address on iface down
Contexts bound to any address are not associated with any specifc IP
address (sockets not connected yet or listening sockets bound to any),
therefore there's no need to shut down the connection context on the
interface down event. Hence, check the local address binding before
shutting down the context.

Note, that there's some extra logic involved when reading the TCP local
address, implemented in net_tcp_endpoint_copy(), therefore I've simply
reused that function for the purpose.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-29 17:19:03 +01:00
Yangbo Lu
ab0f29bbd6 net: bridge_input: move debug messages to proper location
Moved forward decision debug messages ahead of interface TX/RX
operations. That's proper to see forward decision debug messages
first, and then interface TX/RX debug messages.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-01-29 14:25:09 +00:00
Yangbo Lu
3f7c957db6 net: bridge_shell: add fdb subcommand support
Added fdb subcommand support for bridge FDB entry
add/delete/show operations.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-01-29 14:25:09 +00:00
Yangbo Lu
3a6b67ac3a net: bridge_shell: convert to use SHELL_HELP
Converted to use SHELL_HELP.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-01-29 14:25:09 +00:00
Yangbo Lu
62d4998b0d net: bridge: add FDB (Forward Database) table support
Added FDB (Forward Database) table support for bridge.
Implemented very basic functions for adding/deleting
static <MAC + iface> FDB entry.

The dynamic FDB entry and hardware FDB configuration is
still TODO work.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-01-29 14:25:09 +00:00
Emil Gydesen
fc6b23cf2b Bluetooth: Conn: Only recycle ACL connections
Add check for ACL connection before submitting recycled.
Since ISO and SCO connections do not trigger the disconnected
callback, nor affects e.g. advertising, they should not
trigger the recycled callback.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-01-29 13:36:53 +01:00
Stephanos Ioannidis
1363fd8133 testsuite: coverage: Increase gcov heap size to 64KiB for x86 and MPS2
On qemu_x86, the size of a coverage report entry for certain testcases can
exceed 32KiB, resulting in the "No memory available to continue dump" error
message in the gcov data output and the subsequent twister error in parsing
the data:

  ERROR   - General exception: non-hexadecimal number found in fromhex()
  arg at position 0

This commit increases the gcov heap size to 64KiB to work around the above
issue.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2026-01-29 13:34:31 +01:00
Lu Jia
f6063973c4 avrcp: Fix registration notification failures in AVRCP CT.
Failure to clear ct->ct_notify[event_id] when avrcp_prepare_vendor_pdu
fails, leading to an error return if ct->ct_notify[event_id].cb != NULL
during the next notification registration.

Signed-off-by: Lu Jia <jialu@xiaomi.com>
2026-01-29 09:04:19 +01:00
Alberto Escolar Piedras
46289d27dc Bluetooth: Controller: nRF54L: Use same hal for simulated 54LM20
Use the same HAL header for the simulated 54LM20 as for the 54L15,
just like we do for real targets.

Note this ifdef is the last one, and therefore the real targets
have already been caught before.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-01-28 21:58:11 +01:00
Jamie McCrae
e3e173aa90 Bluetooth: Controller: ll_sw: nordic: Fix renamed Kconfig
Fixes a missed Kconfig rename in this file

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-28 14:42:08 +01:00
Vinayak Kariappa Chettimada
bd77884512 Bluetooth: Controller: nrf54lx: Fix address resolution wait
Fix address resolution wait to not be infinite loop and
instead exit with a reasonable count down value.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-01-28 14:40:05 +01:00
Robert Lubos
b422dc272d net: mdns_responder: Fix clang warnings
struct dns_header is packed therefore it fields need to be accessed with
respective helper macro to avoid warnings with clang.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-28 10:16:38 +01:00
Zhijie Zhong
8c9f8bcdeb Bluetooth: Classic: L2CAP: fix NULL pointer crash in chan->ops->xx()
for example:
l2cap_br_encrypt_change() calls l2cap_br_conn_pend(chan, hci_status) first,
which may trigger l2cap_br_chan_cleanup(chan). This clears chan->conn and
makes the channel invalid. The subsequent callback to
chan->ops->encrypt_change(chan, hci_status) then dereferences a NULL conn
in rfcomm_encrypt_change, causing a crash.

Signed-off-by: Zhijie Zhong <zhongzhijie1@xiaomi.com>
2026-01-28 08:32:12 +01:00
Michael Zimmermann
7a218e5db5 net: mqtt_sn: udp: tp_udp_recvfrom: store error in errno variable
Returning negative values which are not -1, isn't what POSIX would do and
the API is specifically designed to behave like recvfrom.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2026-01-27 15:22:32 -06:00
Michael Zimmermann
d0a55b6805 net: mqtt_sn: udp: backup errno if it's used in logs
Otherwise, the log might overwrite it.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2026-01-27 15:22:32 -06:00
Michael Zimmermann
8e0a04950a net: mqtt_sn: udp: use ssize_t for return value of zsock_recvfrom
int is simply the wrong type.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2026-01-27 15:22:32 -06:00
Michael Zimmermann
20db4b2f8f net: mqtt_sn: fix types of gw_id and addr
- gw_id is an uint8_t in the protocol, so neither char, nor uint16_t are
  the correct type to use.
- addr is an array of bytes, not a string (of characters).

This also corrects related log messages and makes them more consistent, by
using hex for all gw_id's.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2026-01-27 15:22:32 -06:00
Michael Zimmermann
be80af2cd4 net: mqtt_sn: drop packets with truncated addresses
The address is only used for gateway discovery, but using a truncated
`struct sockaddr` can lead to out of bounds reads.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2026-01-27 15:22:32 -06:00