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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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 fixzephyrproject-rtos/zephyr#50786
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
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>
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>
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>
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>
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>
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>
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>