Commit graph zephyr/subsys
Author SHA1 Message Date
Jukka Rissanen
2736baba9c shell: Add ssh backend
Add ssh backend for client and server.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 13:40:07 +02:00
Jukka Rissanen
610c94f57e net: ssh: Add SSH client and server support
Add support for SSH client and server connections.
Original code is from https://github.com/grantramsay/zephyr-ssh

Following modifications are done by this commit compared to original
one:
- Coding style issues, like converting // comments to /* */ ones
- Converting to use PSA APIs
- Add IPv6 support

Signed-off-by: Grant Ramsay <grant.ramsay@hotmail.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 13:40:07 +02:00
Aleksandr Khromykh
a9ad258c84 bluetooth: mesh: fix BLOB IO flash write alignment for non-erase devices
The wr_chunk function had a fast path for devices without explicit erase
(e.g. nRF54L RRAM) that wrote chunk data directly without aligning the
offset or size to the flash write block size. On RRAM with
write-block-size=16, this caused -EINVAL from the flash driver for every
chunk write since chunk_size (161) and most chunk offsets are not
16-byte aligned.

The failed writes caused the BLOB server to never mark chunks as
received, resulting in block_status_rsp always reporting all chunks
missing. This led to infinite retransmission of block 0 and eventual
DFU timeout.

Fix by using a read-modify-write approach for non-erase devices:
read existing data at the aligned boundaries, overlay the chunk data,
and write back the full aligned buffer. This satisfies the driver's
alignment requirements while preserving neighboring bytes.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2026-05-11 10:59:49 +02:00
Jordan Yates
4679c69889 modem: cmux: fix flow control for user pipes
Once `rx_full` has been set, the modem is instructed to no longer send
data on that DLCI channel until we notify the modem that the channel is
able to receive more data. This happens in the RX callback which drains
the pipe.

Currently the amount of free space required in the ring buffer to
release the flow control condition is hardcoded to
`CONFIG_MODEM_CMUX_MTU`. While this value is fine for the DLCI1 and
DLCI2 channels (which have buffers created as
`CONFIG_MODEM_CMUX_MTU + N` bytes large), the user pipes with size
`MODEM_CELLULAR_USER_PIPE_BUFFER_SIZES` are typically much smaller. This
lead to the flow control condition never being released on the user
pipe DLCI channels once it was set.

Fix the issue by limiting the threshold to the capacity of the ring
buffer, so that if the buffer is completely empty we will always release
the flow control condition.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-05-11 08:49:18 +02:00
Jordan Yates
3eb2355dcb modem: chat: make work buffer size configurable
Switch out the hardcoded 32 byte buffer for a Kconfig option.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-05-11 08:48:59 +02:00
Jukka Rissanen
7b952f5cb2 net: utils: Add net_port_get/set helper functions
Add helpers for setting or getting a port number from net_sockaddr
struct.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 08:48:45 +02:00
Jukka Rissanen
6ee7df7c2b net: shell: quic: Use net_sockaddr and not net_sockaddr_storage struct
When calling other functions, pass "struct net_sockaddr" instead of
"struct net_sockaddr_storage" as the former is usually passed around
between functions. This is a style issue and there is no functionality
changes by this commit.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 08:48:45 +02:00
Jukka Rissanen
7e12084f0f net: quic: Remove unnecessary pointer checks for stats functions
Some of the statistical collector functions were checking null
pointers without a reason. The pointers cannot be null at this point
and the callers already have those checked.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-11 08:48:45 +02:00
Jose Sanchez
8e633d97f7 posix: mqueue: fix mq_unlink errno for non-existent queue
mq_unlink() was setting errno to EBADF when the named message queue
did not exist. POSIX IEEE 1003.1-2017 specifies ENOENT for this case,
as EBADF is reserved for invalid file descriptors.

Fixes #106002

Signed-off-by: Jose Sanchez <jsanchezrs828@gmail.com>
2026-05-11 08:46:28 +02:00
Krzysztof Chruściński
667c3184d6 logging: log_output: Fix formatting of function prefix
When function prefix is used then formatting is expected to be
<source_name>.<func_name> but it was as if function prefix was
not used <source_name>: <func_name>.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-05-11 04:01:49 +02:00
Emil Gydesen
756b16b643 Bluetooth: ISO: Add missing buf->len checks in bt_iso_recv
bt_iso_recv pulls the SDU header (with or without) timestamp,
but did not check the length of `buf` before doing so.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-05-08 16:04:41 -05:00
Luming Ou
e1434e141e logging: fix immediate clean output locking on SMP
Only same-CPU recursive logging should bypass the clean-output
process lock. The previous owner-tracking logic also skipped the
lock when another CPU already owned clean-output processing,
allowing concurrent backend processing on SMP.

Fix that by requiring the process lock whenever the owner differs
from the current CPU, by assigning the owner only after the
spinlock is acquired, and by keeping the lock-decision helper
local to log_core.c.

Tested with:
- west build -b native_sim/native/64 tests/subsys/logging/log_immediate \
  -d build-log-immediate-green --pristine -- \
  -DCONFIG_LOG_IMMEDIATE_CLEAN_OUTPUT=y \
  -DZEPHYR_TOOLCHAIN_VARIANT=host
- ./build-log-immediate-green/zephyr/zephyr.exe
- west build -b native_sim/native/64 tests/subsys/logging/log_immediate \
  -d build-log-immediate-default --pristine -- \
  -DZEPHYR_TOOLCHAIN_VARIANT=host
- ./build-log-immediate-default/zephyr/zephyr.exe

Signed-off-by: Luming Ou <olm_cse@hust.edu.cn>
2026-05-08 15:59:31 -05:00
Robert Lubos
fba8fb4070 net: openthread: Remove deprecated APIs
Remove OpenThread APIs that were deprecated in Zephyr 4.2.0.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-05-08 16:02:17 +01:00
Robert Lubos
3867c1f8d3 net: if: Remove deprecated APIs
Remove network interface APIs that were deprecated in Zephyr 4.1.0.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-05-08 16:02:17 +01:00
Robert Lubos
b3d4e29e08 net: sockets: Remove deprecated CONFIG_NET_SOCKETS_POLL_MAX
The CONFIG_NET_SOCKETS_POLL_MAX Kconfig option was deprecated in
Zephyr 4.0.0, remove it and any leftover in-tree option use.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-05-08 16:02:17 +01:00
Robert Lubos
6cdd2d36f4 net: tc: Remove deprecated CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO
The CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO Kconfig option was deprecated in
Zephyr 4.1.0, remove it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2026-05-08 16:02:17 +01:00
Riadh Ghaddab
64997e4447 tests: kvss: zms: fix tests for native_sim/native/64 board target
Fix number of writes to trigger a GC for native_sim/native/64 board
as it has a different sector size.
Fix the returned value for zms_free_space when ate_wra < data_wra.
Skip test_zms_gc_3sectors for targets that have a sector size different
than 1KB.

Signed-off-by: Riadh Ghaddab <riadh.ghaddab@nordicsemi.no>
2026-05-08 06:48:04 -05:00
Carlo Caione
68c95f8e8f lorawan: native: reject unsupported downlink FOpts
Downlink MAC commands are not parsed yet.

Reject frames that carry FOpts before advancing FCntDown so the stack
does not silently consume network commands it cannot handle.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-05-08 11:25:50 +02:00
Carlo Caione
de3d359c0f lorawan: native: bound confirmed retry count
LoRaWAN NbTrans is encoded in the 1..15 range.

Reject zero and out-of-range values so confirmed sends cannot block for
an unexpectedly large number of attempts.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-05-08 11:25:50 +02:00
Carlo Caione
c508df15c6 lorawan: native: serialize mutable API state
Several public APIs update or consume shared MAC state while the engine
thread is processing join and send requests.

Use a single API mutex for join, send, and mutable setters so only one
public operation can touch the native LoRaWAN state at a time. Also
reject region changes after the stack has started.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-05-08 11:25:50 +02:00
Carlo Caione
755784b934 lorawan: native: validate downlink FOpts length
Do not trust FCtrl.FOptsLen until it has been checked against the actual
frame length.

Reject frames whose FOpts area would overlap the MIC or extend past the
received buffer before verifying the MIC or updating FCntDown.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-05-08 11:25:50 +02:00
Carlo Caione
ea1e48121e lorawan: native: reuse confirmed frame for retries
Confirmed uplink retries must retransmit the same LoRaWAN frame.
Rebuilding each attempt advanced FCntUp and changed the MIC, allowing a
missed ACK to turn a retry into a second application uplink.

Build the frame once, reuse it for confirmed retry attempts, and consume
FCntUp once after transmission.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-05-08 11:25:50 +02:00
Carlo Caione
e4af8f1912 lorawan: require channel mask after stack start
Channel masks apply to the region channel plan initialized by
lorawan_start(). Accepting a mask before start leaves the backend without
a concrete channel table to update.

Document the ordering requirement in the public API and have the native
backend return -EPERM until the stack has been started.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-05-08 11:25:50 +02:00
alperen sener
67049acb23 bluetooth: host: gatt: add helper bt_gatt_is_db_hash_valid test function
Adding a helper test function to check if the DB hash is valid.

Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
2026-05-08 11:24:15 +02:00
alperen sener
78a53b541b bluetooth: host: gatt: destroy imported key in case psa mac sign fail
Imported key is not destroyed in case psa mac sign fails. This is a
potential memory leak.

Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
2026-05-08 11:24:15 +02:00
Tomasz Leman
60aaf222e5 llext: fix inverted loop bounds check in dependency iteration
Swap condition order in two for-loops in llext_experimental.c so the
bounds check (j < ARRAY_SIZE) is evaluated before the array access.
The previous order caused an off-by-one OOB read when all 8 dependency
slots were populated.

Aligns with the correct pattern already used in llext_link.c.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2026-05-08 08:06:03 +02:00
Flavio Ceolin
f4a423c985 net: http_server: Normalize URL path before lookup
Add http_server_normalize_url() to resolve '.' and '..' segments in
client->url_buffer once the URL is fully assembled to avoid a remote
client to read files outside the configured web root.

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2026-05-08 08:05:36 +02:00
Fin Maaß
74bd4fc64d qemu: net: ethernet: enable NET_L2_ETHERNET
when using NET_QEMU_ETHERNET or NET_QEMU_USER
enable NET_L2_ETHERNET by default, as
in this mode we need the ethernet drivers.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-07 18:10:17 -05:00
Fin Maaß
c35daeb60b net: qemu: add NET_QEMU_* dt dependency
make sure we don't use slip or ppp, if we don't
have the right chosen set in the devicetree.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-05-07 18:10:17 -05:00
Egill Sigurdur
16ac4a5b78 kernel: mem_slab: add K_MEM_SLAB_DEFINE_TYPE for automatic alignment
Introduces K_MEM_SLAB_DEFINE_TYPE() and K_MEM_SLAB_DEFINE_STATIC_TYPE()
helpers to allow the user to declare slabs for types without having to
manually ensure the alignment is correct.

Manual slab alignment was very error-prone and this change fixes several
instances of misalignment that would be trapped by the undefined
behavior sanitizer when running on 64-bit targets.

Signed-off-by: Egill Sigurdur <egill@egill.xyz>
2026-05-07 18:09:41 -05:00
Zhaoxiang Jin
89506681f7 cpu_freq: enable thermal_cap for cpu_freq subsystem
enable thermal_cap for cpu_freq subsystem, which allows
CPU frequency to be reduced when the die temperature
exceeds certain thresholds.

This is useful for preventing overheating and maintaining
system stability under high load or in high ambient
temperatures.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-05-07 18:07:33 -05:00
Jonas R. Hansen
db2d9162b7 usb: usbip: make USBIP service port configurable
Makes it possible to host multiple native_sim's with native networking
without port collisions

Signed-off-by: Jonas R. Hansen <jonas.jmh@gmail.com>
2026-05-07 15:11:38 +01:00
Tomasz Chyrowicz
ce334a9c9f mgmt: img_mgmt: Add a transport-specific req
Add a dependency on the NETBUF size if the UART transport and the
img_mgmt group is selected.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2026-05-07 13:19:00 +01:00
T Madhusudhan Rao
3ccd07b202 net: ptp: fix time domain mismatch in foreign clock cleanup
The foreign clock cleanup logic was incorrectly comparing the PTP
hardware timestamp against the local k_uptime_get(), resulting in
erroneous packet aging.

This introduces a 'local_uptime_ms' field to track the actual local
arrival time of ANNOUNCE messages, isolating the aging logic
from the PTP hardware clock domain.

Fixes #108479

Signed-off-by: T Madhusudhan Rao <tetakalam@aerlync.com>
2026-05-07 10:46:31 +01:00
Jukka Rissanen
5d571ee0d5 net: quic: Initialize default key exchange group
This will avoid this error message

   Unknown group 0x0000, defaulting to secp256r1

when generating ECDH keypair.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-07 10:46:04 +01:00
Muhammad Waleed Badar
c637f2a0da net: shell: http: add options to HTTP client shell commands
Add getopt-based argument parsing to HTTP client shell commands
supporting options:

  -d, --data     <data>     HTTP POST data
  -H, --header   <header>   Custom HTTP header
  -p, --proto    <protocol> HTTP protocol version
  -E, --cert     <tag>      TLS credential tag
  -t, --timeout  <seconds>  Set connection timeout in seconds
  -k, --insecure            Disable SSL certificate verification
  -v, --verbose             Make the operation more talkative

Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
2026-05-07 10:45:57 +01:00
Tomi Fontanilles
7d65b380e2 modules: mbedtls: link to mbedTLS only when CONFIG_MBEDTLS_BUILTIN
393350fd65 made it so that the `mbedTLS`
library is only created when `CONFIG_MBEDTLS_BUILTIN`.

Before this commit, users of Mbed TLS did the following:
`zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS)`

If the `mbedTLS` CMake library doesn't exist but is still linked to
(as is the case when `CONFIG_MBEDTLS && !CONFIG_MBEDTLS_BUILTIN`),
the linker command is populated with `-lmbedTLS` which makes the build
fail because there is no `libmbedTLS.a` in the build.

Make it so that users of Mbed TLS only link to the `mbedTLS` CMake
library when the builtin version is used.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2026-05-07 09:11:36 +02:00
Jukka Rissanen
d822c93967 net: shell: quic: Enhance the statistics prints
Show also past Quic statistics.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-06 19:58:42 +02:00
Jukka Rissanen
d0d44c31d2 net: quic: Add more statistics collection
Collect statistics in various stages of the Quic connection.

Assisted-by: Copilot:gpt-5.4
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-05-06 19:58:42 +02:00
Håvard Reierstad
4feab28245 Bluetooth: Host: Change default BT_BUF_EVT_DISCARDABLE_SIZE
With adding discard-tracking of extended advertising reports, the
reports are allocated from the discardable event pool instead of the
"normal" event pool. This commit sets the default value of
BT_BUF_EVT_DISCARDABLE_SIZE to BT_BUF_EVT_RX_SIZE when BT_EXT_ADV
is enabled.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2026-05-06 16:29:15 +01:00
Håvard Reierstad
e3a3a8e685 Bluetooth: Host: add fragmented ext adv stress test
Extends the `host/scan/slow` bsim test to test that the reassembler
is able to recover from a discarded extended advertising report chain.

This requires tracking that extended advertising reports are in fact
received, and that the reassembler times out. Functions for this are
added to testing.h which is only compiled if BT_TESTING is enabled.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2026-05-06 16:29:15 +01:00
Håvard Reierstad
41e3b91fcb Bluetooth: HCI: Allow discarding of ext adv reports
Implements a method for discarding fragmented extended advertising. In
order to acheive this, we need to consider past and future fragments
of the advertising report we discard.

The future fragments are on its way from the controller, and will result
in either a complete- or incomplete event. These are handled by tracking
the adv SID and address until the controller sends either a complete or
incomplete event. Once an advertising report is marked as discarded,
consecutive fragments will be silently discarded.

The past fragments are either already in the reassembler (in scan.c),
or on their way through the rx_queue. To handle these, and allow the
reassembler to recover from a in-progress reassembly which is discarded,
we add a work item which is rescheduled when each consecutive fragment
is received. The timeout is configurable through the new Kconfig option
`CONFIG_BT_EXT_ADV_REASSEMBLY_TIMEOUT`. On timeout, the reassembler will
change its state to discard incoming fragments from the same advertiser.
The reassembler will start assembling new fragments if it recognises a
new advertiser, or if a final fragment (either marked as complete
or incomplete) from the advertiser it is currently tracking is received.

This functionality needs to be added at a HCI driver level by using the
new `hci_ext_adv_report_process` function. It is added the the
IPC HCI driver to fix zephyrproject-rtos/zephyr#50786

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2026-05-06 16:29:15 +01:00
Cristian Bulacu
553e505e6b openthread: border_router: Remove IPV6 packet checksum when forwarding
In case of using ethernet as backbone interface, some NICs may want to
have checksum set to 0 for a correct computation.
This commit aims to address this issue by checking if hardware has
offload capabilities and setting IPV6 packet checksums to 0, if needed.

Signed-off-by: Cristian Bulacu <cristian.bulacu@nxp.com>
2026-05-06 16:26:53 +01:00
Tim Pambor
d3c24cfadb crc: fix sometimes uninitialized warning
flag_reversed in crc8() is only initialized if reversed is true.
Set flag_reversed to 0 if reversed is false.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-05-06 09:57:45 +01:00
Emil Gydesen
7cb64ce38b Bluetooth: TBS: Fix out-of-bounds read in bt_tbs_valid_uri
The for loop could have read uri[uri_len] due to the i + 1.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-05-06 09:57:31 +01:00
Malliga Moorthi
20a5183186 net: vlan: fix incorrect virtual interface listing as vlan interface
When Kconfig option CONFIG_NET_CAPTURE=y is used and VLAN feature
is enabled and tested, this Kconfig creates two virtual interfaces,
IP_TUNNEL0 and NET_CAPTURE0. On "net iface" shell command, when
interfaces get listed, the IP_TUNNEL0 virtual interface for
packet capture/debug purpose, gets listed as vlan interface, which
is incorrect. On testing, before this fix, IP_TUNNEL0 interface gets
listed as vlan0, after fix it shows as net0 instead.
This fix needs to be backported to zephyr 4.4.

Signed-off-by: Malliga Moorthi <malliga.moorthi@nokia.com>
2026-05-06 09:57:24 +01:00
Yangbo Lu
19d5ca1c68 net: config: support config init for interface already manually up
Current code was preventing all NET_IF_NO_AUTO_START interfaces for
config init.

This patch is to change that and to prevent only NET_IF_NO_AUTO_START
interfaces with link down status.

Then interfaces already manually up, like bridge can be supported.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-05-06 09:56:48 +01:00
Yangbo Lu
0942d5d4a7 net: ethernet: bridge: handle gPTP frame via gPTP bridge stack
gPTP frame should be handled via gPTP bridge stack. So, do not
forward them or handle them by bridge interface.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-05-06 09:56:48 +01:00
Yangbo Lu
f3a24fca45 net: ethernet: gptp: use debug level message for resetting pdelay request
It's normal there is no gPTP device connected. We didn't have to use
warn level message for resetting pdelay request. Change to use debug
message which can avoid endless noise messages.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-05-06 09:56:48 +01:00
Yangbo Lu
43e2eed6e9 net: ethernet: improve Qbv Kconfig dependency
Qbv uses management interface, so just select NET_L2_ETHERNET_MGMT.
Qbv time is based on PTP clock. When enable Qbv shell, just select
PTP clock shell too because at least we need to check base time
via PTP clock shell.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-05-06 09:56:48 +01:00