Commit graph

22,555 commits

Author SHA1 Message Date
Flavio Ceolin
5bc6446dcc doc: releases: 4.1: Document removed PM symbol
The deprecated PM_DEVICE_RUNTIME_EXCLUSIVE option is been removed
in this release.

Signed-off-by: Flavio Ceolin <flavio.ceolin@gmail.com>
2025-01-31 07:50:17 +01:00
Cla Mattia Galliard
ed1ebb337d net: tc: Add statistics about dropped packets
Add statistics about packets dropped in net_tc.

Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
2025-01-30 20:27:33 +01:00
Cla Mattia Galliard
84f6e7a313 net: tc: Limit the max amount of packets in the traffic-class-fifo
To avoid starvation of a traffic class by another, limit the maximum amount
of packets, that can sit in a single traffic-class-fifo to a fraction of
the maximum amount of available packets. In the tx-case also reserve
packets for direct sending, in the case, where
CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO is enabled.

Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
2025-01-30 20:27:33 +01:00
Jukka Rissanen
4195130214 net: shell: events: Print more details for L4 events
Print IP address information for L4 DNS server add and remove
events.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-30 18:29:45 +01:00
Jukka Rissanen
6edcf445ab net: shell: events: IPv4 mcast join and leave were missing
The event monitor did not handled IPv4 multicast join/leave
event information.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-30 18:29:45 +01:00
Jukka Rissanen
ef9b3d4dbf net: shell: events: IPv4 mcast addr add and del were missing
The event monitor did not handled IPv4 multicast address
addition or deletion information.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-30 18:29:45 +01:00
Jukka Rissanen
b83f86a1d2 net: shell: events: Add admin up and down events
The "admin up/down" event was not being decoded.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-30 18:29:45 +01:00
Jukka Rissanen
e109a27c99 net: shell: events: Print event id for unknown events
To simplify debugging what event code is missing from the
events shell module, print also event id for the for unknown
events. This way it is a bit easier to figure out what the
unknown event is.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-30 18:29:45 +01:00
Jukka Rissanen
b2dcaa8f9e net: shell: events: Add Ethernet L2 support
Print Ethernet carrier on/off and VLAN tag enabled/disabled
status when monitoring events.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-30 18:29:45 +01:00
Daniel DeGrasse
598f343385 shell: handle reprint correctly when output crosses line boundary
When reprinting the shell command buffer with long user inputs, the
reprinted buffer may cross a line boundary, and require a newline to be
printed. For these cases, print the command buffer character by
character, inserting newlines as appropriate.

Fixes #82155

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2025-01-30 16:21:53 +01:00
Benjamin Cabé
7c6d3a6f93 fs: ext2: Fix potential integer overflow in disk access size calculation
Cast sector_count and sector_size to uint64_t to prevent potential
integer overflow when calculating total device size in
disk_access_device_size().

Fixes Coverity issue CID-322647

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-01-30 16:20:58 +01:00
Dominik Ermel
5c40ee3958 storage/stream_flash: Switch to stream_flash_erase_to_append
Switches flash_sync to use stream_flash_erase_to_append
instead of stream_flash_erase_page in preparation of deprecating
the later and reming control on erase from API user.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2025-01-30 14:13:42 +01:00
Robert Lubos
6677db21ce net: sockets: Make sure recvmsg() doesn't modify buffer configuration
The recvmsg() function should not modify the buffer configuration
provided in struct msghdr, such behavior is not specified in the POSIX
function description, nor is it consistent with well-known behavior of
this function in Linux.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-30 14:09:35 +01:00
Emil Gydesen
8ed24ae3a0 usb: device_next: Make buf ownership consistent for usbd_uac2_send
The usbd_uac2_send function sometimes took ownership of the
provided buffer in error cases, and sometimes not.

The commit modifies the function so that ownership is never
taken in case a non-0 return value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-01-30 14:08:53 +01:00
Seppo Takalo
4d6372be93 net: lwm2m: Fix Notify response handling
As the CoAP library was refactored to handle response
messages as stated by RFC, the LwM2M message handling was
untouched.
LwM2M Notify handling is relying on response callback
to be called, but as per CoAP RFC an empty Ack is not
actually a response and the callback was not called anymore.

Fix the issue by calling the response callback when
we receive an empty ack for any confirmable response
messages.
This should not affect any handling of CoAP requests.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2025-01-30 14:08:39 +01:00
Andrzej Głąbek
dff78b4813 bluetooth: host: Add select PSA_WANT_ALG_ECB_NO_PADDING
This is a follow-up to commit 12eee61533.

Explicitly enable "PSA_WANT_ALG_ECB_NO_PADDING" to select the AES ECB
mode that it is used in CMAC operation.

This is done because CMAC uses AES-ECB, so both AES and ECB must
be explicitly enabled. Previously it worked because Mbed TLS is
not currently performing any check internally on this and it's
just enabling ECB automatically.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2025-01-30 11:15:24 +01:00
Théo Battrel
972d4c7369 Bluetooth: Host: GAP Device Name write now add null char at the end
The function used to write the value of the GAP Device Name
characteristic now ensure that the string passed to `bt_set_name` is
null terminated.

Also fix a wrong offset calculation.

The function used to write the value of the GAP Device Name
characteristic was returning an error when the offset + the length of
data to write was superior **or equal** to the maximum size of the
device name.

This caused the actual maximum device name size to be reduced by 1 byte.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2025-01-30 11:15:03 +01:00
Jukka Rissanen
d243bc1fdb net: Fix inet_pton IPv4 implementation
The conversion from IPv4 string presentation to numeric value
did not check if the individual address value was between 0 and 255
inclusive.

Add also test case for this.

Fixes #84593

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-29 17:56:09 +01:00
Emil Gydesen
21be69f172 Bluetooth: PACS: Fix issue with PACS flags
The PACS flags were incorrectly defined without
ATOMIC_DEFINE and then it treated the atomit_t as an
array with the atomic functions.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-01-29 15:13:29 +01:00
Jeremy Bettis
027e19fe1f ztest: Don't clear test stats before running suite
test_main can call ztest_run_all multiple times. For example
tests/bluetooth/host/keys/bt_keys_get_addr/src/main.c does so.  If the
first call skips some tests and then they run in the second call,
everything is fine. However if they passed or failed in the first run
and skipped in the second run, then the test output (json, xml, and
printed summary) show the test as skipped even though it ran.

The solution is to not clear the test stats.

__ztest_init_unit_test_result_for_suite was added in commit
996c8457d7 by nashif.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2025-01-29 15:12:51 +01:00
Fabio Baltieri
5a40e49cff usb: device_next: cdc_acm: move few constant data to flash
Add a config structure and move few pointers that don't need to change
into it, save few bytes of SRAM.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-01-29 12:53:04 +01:00
Tim Sørensen
ff2605d23e Bluetooth: CTS: Incorrect assert in bt_cts_init()
Fixup for incorrect assert in CTS service
initialization function bt_cts_init().

Signed-off-by: Tim Sørensen <tims@demant.com>
2025-01-29 12:51:30 +01:00
Eric Holmberg
b952f613e7 net: wifi: shell: only process scan events during requested scan
The scan events are always enabled which means if another software
component requests a scan, then the WiFi shell scan printouts will
also be sent to the shell.

Only enable the network management scan events when a user has
requested a scan.

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
2025-01-29 12:51:16 +01:00
Luca Burelli
f0328ddc80 llext: add option to import all global symbols
The new CONFIG_LLEXT_IMPORT_ALL_GLOBALS option allows all global symbols
from extensions to be used by the main application. This is useful to
load basic extensions that have been compiled without the full Zephyr
EDK.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-01-29 11:04:33 +01:00
Luca Burelli
ec52ed2c5d llext: shell: fix buffer alignment
Make sure the buffer used to load the hex file is aligned to a sensible
value; at least word size is assumed by the LLEXT APIs.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-01-29 11:04:33 +01:00
Luca Burelli
a62dc99178 llext: fix list_symbols shell command
The shell command 'llext list_symbols' currently iterates over the
'sym_tab' table. This is valid only inside 'llext_load' and is freed
before returning, so it will always be empty in shell context.

Fix it to display 'exp_tab', which is the one used at runtime by LLEXT
to provide symbols to the main application.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-01-29 11:04:33 +01:00
Oleh Kravchenko
ed15ff14d4 fb: cfb: Fix print of ASCII chars from 128 to 255
Change the "c" variable type from char to uint8_t in get_glyph_ptr() and
draw_char_vtmono() to fix issues with the range check of the "c" value.

The easiest way to print localized text with Zephyr is
to ask GCC for compile-time conversion:

  INCLUDE(${ZEPHYR_BASE}/cmake/cfb.cmake NO_POLICY_SCOPE)
    GENERATE_CFB_FONT_FOR_TARGET(app
    "${CMAKE_CURRENT_SOURCE_DIR}/fonts/koi8-u.png"
    "${ZEPHYR_BINARY_DIR}/include/generated/cfb_font_dice.h"
    8 16 --first 0 --last 255)

  TARGET_COMPILE_OPTIONS(app PRIVATE
    -finput-charset=UTF-8
    -fexec-charset=KOI8-U)

Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
2025-01-29 04:18:02 +01:00
Fabio Baltieri
e4752e5e11 net: dhcpv4_server: skip the DNS option if not configured
Check if NET_DHCPV4_SERVER_OPTION_DNS_ADDRESS is set before using it to
set the DNS option in DHCP responses. This avoids sending a client a DNS
server of 0.0.0.0.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-01-29 04:17:36 +01:00
Fabio Baltieri
68b63d023b net: dhcpv4_server: allow skipping the router option
Add a Kconfig option to skip the router DHCP server option. This can be
useful to avoid having the client trying to forward all its traffic to
the embedded device.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-01-29 04:17:36 +01:00
Chaitanya Tata
2019b7ba86 net: l2: ethernet: Fix interface state check
Modifying MAC address is allowed only when the interface is not
administratively UP, as it typically involves conveying the MAC address
to the chip firmware, and accepting the MAC address when interface is
administratively UP will not reflect in the actual usage.

So, modify the check to reject MAC address change if the interface is
administratively UP.

Fixes #81486.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-01-29 04:17:21 +01:00
Johann Fischer
81dc390115 usb: device_next: add bulk transfers to loopback function
This allows us to use the testusb Linux kernel tool again. All tests
involving control and bulk transfers should pass. Additionally, add a
shell command that allows the user to manually enqueue bulk transfers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-01-29 04:16:42 +01:00
Jukka Rissanen
535e70a298 net: socket: Release packets in accepted socket in close
If we have received data to the accepted socket, then release
those before removing the accepted socket. This is a rare event
as it requires that we get multiple simultaneous connections
and there is a failure before the socket accept is called by
the application.
For example one such scenario is when HTTP server receives multiple
connection attempts at the same time, and the server poll fails
before socket accept is called. This leads to buffer leak as the
socket close is not called for the accepted socket because the
accepted is not yet created from application point of view.
The solution is to flush the received queue of the accepted socket
before removing the actual accepted socket.

Fixes #84538

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-28 18:24:39 +01:00
Matt Rodgers
ea6ca4e8b7 net: http_server: allow specifying a fallback resource
A _res_fallback parameter to HTTP_SERVICE_DEFINE is added to optionally
specify a fallback resource detail, which will be served if no other
resource matches the URL.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2025-01-28 18:14:36 +01:00
Maciej Baczmanski
341359568f openthread: fix logging configuration
Currently, `CONFIG_OPENTHREAD_LOG_LEVEL` is used to set log level
in OT and register log modules in Zephyr. OpenThread allows 5
levels, causing issues when `OPENTHREAD_LOG_LEVEL_DEBG` is
selected ad we are trying to register modules with unknown lvl.

This commit adds `CONFIG_OPENTHREAD_MODULE_LOG_LEVEL` which is
aligned for Zephyr's log levels.

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2025-01-28 14:13:31 +01:00
Joakim Andersson
8457db52c7 net: tls_credentials: Do not free slot when cred buf is NULL
Do not free the slot when cred buf is NULL.
If the TLS credential storage backend does not have a buffer pointer
to the TLS credential, then the buffer pointer can be NULL.
This may happen with an out-of-tree TLS credential storage backend.

In this case where credential buffer is NULL find_ref_slot retrieves
a new slot, and then tries to free it, causing a crash.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
2025-01-28 09:51:43 +01:00
Emil Gydesen
9688c2d43f Bluetooth: CCP: Initial CCP Client implemenation
Added initial CCP client implementation that simply
does discovery of TBS on a remote CCP server.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-01-28 09:46:39 +01:00
Johan Hedberg
8b356fd9fb Bluetooth: Host: Fix overwriting ECC error value
Jump straight to the exit portion of the function in the case that
psa_destroy_key() failed and we set err to a non-zero value. This also
fixes Coverity CID 487701 "Code maintainability issues  (UNUSED_VALUE)".

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-01-28 00:06:06 +01:00
Frank Audun Kvamtrø
202c2c41ab secure storage: Add missing include for mbedtls_platform_zeroize
-Adding explicit include for mbedtls/platform_util.h to get acces
 to mbedtls_platform_zeroize in ITS. Somehow not visibile in Zephyr but
 it caused build issues in nRF Connect SDK.

Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
2025-01-27 21:04:20 +01:00
Johan Hedberg
3ae8a9cfe1 Bluetooth: Host: Remove leftover HCI ECC command checks
The code shouldn't be checking for HCI command support anymore, rather in
the case of debug keys we can just start immediately using them.

Fixes commit 09e86f3b69.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-01-27 13:26:40 +01:00
Valerio Setti
222f8d87b5 Bluetooth: Host: add PSA_WANT_xxx_IMPORT/EXPORT to BT_ECC
The BT Host module also uses import/export PSA functions alongside the
generate one, so these PSA_WANT should be added as well.

Previously it happened to work only because Mbed TLS is enabling
IMPORT/EXPORT internally whenever GENERATE/DERIVE is set. However the
same might not be true for all PSA Crypto providers.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-01-27 11:07:07 +01:00
Luca Burelli
7094eae111 llext: support multiple string and symbol tables
The ELF format allows for multiple string and symbol tables with
complex references between them. This is especially evident when
debugging information is included.

This patch fixes the issues that have been identified with multiple
string tables to allow LLEXT to properly parse those files:

* The symbol table used by LLEXT (LLEXT_MEM_SYMTAB) is now chosen
  depending on the loaded file type, and other tables are ignored.
  This change is also applied to the SLID injection script.

* The LLEXT string table (LLEXT_MEM_SYMTAB) is now correctly identified
  by the symbol table reference, instead of picking the first one.

* VMA range checks only make sense for allocated sections.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-01-27 08:54:44 +01:00
Luca Burelli
61c61a5528 llext: display section addresses in gdb-compatible format
This patch adds a debug log message to display the addresses of the
sections in a format that can be used with the gdb 'add-symbol-file'
command to properly inform the debugger about the final addresses for
the loaded sections.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-01-27 08:54:44 +01:00
Luca Burelli
cf11ab4b0f llext: ignore relocations on non-allocated sections
When building an ELF file with debugging information, the compiler
places this data in sections that do not need to be loaded in memory for
the program to run. These sections are marked as "not allocated" in the
ELF section header, and can be safely ignored when loading the file.

This patch adds a check to the relocation processing code to skip
relocations acting on those non-allocated sections, allowing to load ELF
files with debugging information.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-01-27 08:54:44 +01:00
Krzysztof Chruściński
9b2532ab43 logging: frontends: stmesp: Fix logging single argument log twice
Macro was missing a break when single argument with non 32 bit
word argument was detect. Because of that, there were two
logging messages created for a single log entry.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-01-24 15:43:19 +01:00
Kamil Kasperczyk
2534dc14b9 net: Added configuring child timeouts on openthread start
Some time ago three Kconfigs dedicated for the child timeouts
configuration were added, but changing them does not apply when
using OpenThread libraries. Added setting these values using
openthread API on openthread start.

Signed-off-by: Kamil Kasperczyk <kamil.kasperczyk@nordicsemi.no>
2025-01-24 08:39:05 +01:00
Jeremy Bettis
7ff7420668 boards: Allow llvm toolchain for unit tests
llvm is just as good as host for unit tests.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2025-01-24 08:38:55 +01:00
Fabio Baltieri
b0791400f6 usb: device_next: cdc_acm: allow setting the interface description
Add a interface-name string for the CDC-ACM node, this allow setting a
string that is then set as iInterface, which can then be used downstream
in an udev rule such as:

SUBSYSTEM=="tty", ACTION=="add",
ATTRS{interface}=="my interface descriptor",
SYMLINK+="tty-my-device"

To create known aliases for these ports.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-01-24 01:14:28 +01:00
Dominik Ermel
49f5598835 Bluetooth: Mesh: Improve logic for serving devices erase capabilities
The commit fixes issue where flash_area_flatten has been used where
code was only supposed to erase devices by hardware requirement prior
to write, by replacing the call with flash_area_erase and supporting
logic to select proper path.
There have been following Kconfig options added:
 - CONFIG_BT_MESH_BLOB_IO_FLASH_WITHOUT_ERASE
 - CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE
that are available for user depending on devices in the system and allow
to turn off paths that are not used by BLOB IO; for example if user
never writes to device with erase CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE
will disable the path.
Both Kconfig options are y by default and enable all paths.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2025-01-23 19:25:27 +01:00
Yong Cong Sin
085df8bd1e arch: remove z_arch_esf_t
The exception stack frame type `z_arch_esf_t` had been deprecated
since #73593 for 2 releases, it is not used in the kernel since, and
applications/drivers should have been updated to use the
`struct arch_esf` now, remove it.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2025-01-23 16:32:36 +01:00
Robert Lubos
21b71224ac net: ethernet: Remove L2 header stripping after TX
It seems that this change was solely added to address issues with old
TCP stack, which blindly queued packets intended for TX for potential
further retransmission, expecting that the packet would remain intact
during transmission.

I think this assumption was wrong, as it's natural that lower layers
append respective headers to the packet, and this "header stripping"
behavior was specific for Ethernet L2 only. If an upper layer expects
that the packet would need to be retransmitted at some point, it should
clone it instead.

Therefore, remove the L2 header stripping from the Ethernet L2 to avoid
any potential issues in zero-copy case.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-23 16:31:41 +01:00