Commit graph zephyr/subsys
Author SHA1 Message Date
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
Michael Zimmermann
50e17d5c3d net: mqtt_sn: remove broadcast handling from recvfrom
I don't know, why this was added originally, but there are many issues with
it:
- You can't really return NULL, because src_addr is a `void*`, not a
  `void**`. The `src_addr = NULL` didn't do anything.
- The code was checking if the src_addr equals to the broadcast address,
  but under normal conditions, that's always a unicast address.
- Even if we would check if the destination address was the bcaddr, I don't
  see how that's useful. Currently, the address is only used for messages
  of types advertise and gwinfo, which use it to create a new entry in the
  gateway list. In that list, you always need the unicast address, never
  the broadcast address.

Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
2026-01-27 15:22:32 -06:00
Robert Lubos
2b5c66b10d net: dns_sd: Include A/AAAA records for all valid addresses
According to RFC 6763, chapter 12.1, PTR responses SHOULD include
"All address records (type "A" and "AAAA") named in the SRV rdata.".

This was not the case, as only one IPv6 and one IPv4 address was added
in the response by Zephyr. This commit changes this behavior, Zephyr
DNS SD responder will now try to include all IPv4/6 addresses configured
on a given network interface. The current approach of choosing one IPv6
and one IPv4 address first to include in the message is retained - this
is to prevent situation where for example IPv6 addresses will consume
all buffer space, leaving no place for IPv4 ones. The DNS responder will
encode those selected IPv6 and IPv4 addresses first, and then attempt to
include remaining IPv6/4 addresses with "best effort" approach, if there
still is a space in the buffer to add those.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-27 10:26:37 -06:00
Robert Lubos
bdfce4a045 net: dns_sd: Avoid responses with unspecified IPv4/6 addresses
IPv4/IPv6 source address lookups may return unspecified address in case
there's no valid match (like for example LL address for global
destination). As it makes no sense to include unspecified addresses in
DNS SD replies, verify if that's not the case before adding A/AAAA
record in the response.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-27 10:26:37 -06:00
Robert Lubos
94a9b971ec net: mdns_responder: Use struct dns_header to encode response header
Use struct dns_header pointer when encoding the response header to
reduce code complexity.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-27 10:26:37 -06:00
Robert Lubos
c5572b1882 net: mdns_responder: Use net_buf APIs when creating response
Instead of manipulating net_buf's data buffer directly, use net_buf APIs
to reduce complexity when creating mDNS response.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-27 10:26:37 -06:00
Robert Lubos
51a2c9cf0d net: mdns_responder: Include all IPv4/6 addresses in responses
RFC 6762 Section 6.2 "Responding to Address Queries" specifies that mDNS
responses must include all valid addresses on the interface that is
sending the response. That was not the case for Zephyr's implementation,
which sent only on address in the response (and in some corner cases no
address at all).

This commit fixes this problem. Instead of encoding a single
pre-selected address in the response, mDNS responder will now loop over
all addresses on a given interface, and try to encode them as separate
answer records in the reply.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-01-27 10:26:37 -06:00
Jamie McCrae
bcc5529eae mgmt: mcumgr: transport: Add raw dummy transport
Adds a raw dummy UART transport which can be used for testing
MCUmgr without a real transport

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-27 10:23:45 -06:00
Jamie McCrae
d5df08a1cc mgmt: mcumgr: transport: uart: Add support for non-console raw mode
Adds support for using MCUmgr over UART (not via shell) in a raw
mode which does not include base64 and other SMP over console
encoding

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-27 10:23:45 -06:00
Fin Maaß
171954f5a7 net: net_pkt: refactor net_pkt_cursor_operate
refactor net_pkt_cursor_operate and
make checks more explicit.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-01-27 08:40:01 -05:00
Emil Gydesen
ab9ba7be03 Bluetooth: BAP: Broadcast: Add missing NULL check for meta
`meta` may be NULL if `meta_len == 0`, in which case we should not
call `memcpy`.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-01-27 08:39:40 -05:00
Jukka Rissanen
831f6d729f net: mdns_responder: Re-send announce message for bound DHCPv4 address
If we get DHCPv4 bound event, then resend mDNS announce message
for that interface. This way a new address from DHCP server will
get announced properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-01-27 08:39:21 -05:00
Jukka Rissanen
564323989c net: mdns_responder: Mark address in use when adding it
If we try to add an already existing IP address to the
address monitor list, then mark the address to be in use.
The address might have been marked as not-in-use before.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-01-27 08:39:21 -05:00
Jukka Rissanen
aa14f612ee net: if: Send IPv4 address DEL event if overriding address
If we override a static address by a DHCPv4 address, then send
address DEL event so that listeners notice it. This happens
for example with mDNS responder that needs to keep track of
what IPv4 addresses it needs to advertise.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-01-27 08:39:21 -05:00
Jukka Rissanen
a296367a27 net: if: Refactor IPv4 ACD cancel function
Allow calling net_ipv4_acd_cancel() without #ifdef protection.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-01-27 08:39:21 -05:00
Jukka Rissanen
073c75e4e1 net: dns: Context initialization flag was incorrectly used
The "init_called" flag needs to be per context and cannot be global
as it is meant to tell whether the context is initialized first time
or not.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-01-27 08:39:21 -05:00
Yangbo Lu
889ac93bb6 include: zephyr: ethernet: fix multicast address checking
Fixed multicast address checking.

- net_eth_is_addr_multicast() should be for multicast address checking
  but not for only IP multicast address. Then net_eth_is_addr_group()
  is no longer needed.

- LLDP and gPTP multicast address checking should not depend on Kconfig
  option.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-01-27 10:56:51 +00:00
Lyle Zhu
4cfd1ce402 bluetooth: Classic: l2cap: accept peer MPS larger than TX MTU
Fix L2CAP configuration negotiation failure when peer device sends
MPS value larger than its own TX MTU in the configuration request.

This issue occurs when connecting to certain devices (e.g., iPhone)
using enhanced retransmission mode with MAP or PBAP profiles. The
peer may send an MPS that exceeds the TX MTU specified in the same
L2CAP_CONFIGURATION_REQ packet.

Instead of rejecting the configuration, adjust the MPS to match the
peer's TX MTU and include the corrected value in the
L2CAP_CONFIGURATION_RSP packet. This allows the connection to proceed
while ensuring MPS stays within valid bounds.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-01-27 10:52:25 +00:00
Zhijie Zhong
1c432582bb Bluetooth: Core: add Mode Change event in event mask
Since we have already supported sniff mode,
the corresponding link mode change event should be received.

Signed-off-by: Zhijie Zhong <zhongzhijie1@xiaomi.com>
2026-01-27 08:08:56 +01:00
Valerio Setti
4a7c5f521e net: lib: sockets: remove selection of crypto features from socket TLS
There is no reason for which CONFIG_NET_SOCKETS_SOCKOPT_TLS should select
some crypto features by default. The correct list really depends on the
server/client the device would like to connect to.
For this reason the selection of any crypto feature is removed from
CONFIG_NET_SOCKETS_SOCKOPT_TLS with the idea that the proper ciphersuite
is to be enabled in the final sample/test configuration file.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-01-27 08:05:59 +01:00
Tim Pambor
5e6db5b7e2 sd: sd_ops: Provide correct erase block size
Erase block size should be provided in sectors, not in bytes.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-01-26 13:58:54 -06:00
John Whittington
977dec95fe sd: disk ioctl get card cid command
CID (card id register) can be useful to application for traceability of SD
cards (#66460).

Adds disk ioctl command to get the CID data that is read at initialisation.

Changes the card_read_cid function to take pointer to cid register so that
the ioctl command can utilize with the passed user buf. Updated
calling functions to pass this pointer.

Signed-off-by: John Whittington <git@jbrengineering.co.uk>
2026-01-26 13:55:20 -06:00
John Whittington
ef655380a1 sd: disk ioctl get card cid command #66460
CID (card id register) can be useful to application for traceability of SD
cards.

Adds disk ioctl command to get the CID data that is read at initialisation.
The struct sd_cid is moved to sd_card so that it can be read and retrieved
by card_ioctrl.

Signed-off-by: John Whittington <git@jbrengineering.co.uk>
2026-01-26 13:55:20 -06:00
Amneesh Singh
03ba08615a drivers: sdhc: split caps into standard and extra
Make sure the capability bitfields fit the standard SD Association
specification and move the extra capabilities to props.

Affected Drivers:
- sdhc_infineon
- imx_usdhc
- intel_emmc_host
- rcar_mmc
- sam_sdmmc
- sdhc_ambiq
- sdhc_esp32
- sdhc_max32
- sdhc_renesas_ra
- sdhc_stm32
- xlnx_sdhc

Affected Subsys
- sd

Reference: 2.2.26, SD Specifications, Part A2, SD Host Controller
           Simplified Specification, Version 4.20
           URL: https://www.sdcard.org/downloads/pls/pdf/?p=PartA2_SD%20Host_Controller_Simplified_Specification_Ver4.20.jpg

Signed-off-by: Amneesh Singh <amneesh@ti.com>
2026-01-26 13:53:51 -06:00
Alessandro Manganaro
429350b1be pm: add optional custom ticks hook for system suspend
Add an optional power policy hook to provide custom "next event"
ticks during pm_system_suspend(), in addition to the existing
kernel ticks and policy event list.

This hook enables applications and SoC-specific code to derive
the next wake-up time directly from proprietary or
hardware-specific data structures (e.g. hardware registers,
binary-only modules, complex schedulers) that are not
practical to convert into the standard PM policy event list.

The feature is gated by CONFIG_PM_CUSTOM_TICKS_HOOK and is fully
backwards compatible when disabled.

Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
2026-01-26 10:13:53 -06:00