Commit graph

22,555 commits

Author SHA1 Message Date
Tomi Fontanilles
0c368e85b1 secure_storage: add a global registry header file for PSA key IDs
We need to make sure that within Zephyr different users of the PSA APIs
don't interfere with each other because of using the same numerical IDs
for persistent assets.

This takes care of the PSA key IDs when using persistent keys through
the PSA Crypto API.
See the comments in `<zephyr/psa/key_ids.h>` for more information.

This removes the recently-introduced Kconfig options that allowed changing
the base IDs subsystems were using for their persistent keys.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2025-02-13 20:22:09 +01:00
Kamil Piszczek
7c828bd232 bluetooth: dis: add Kconfig for disabling optional characteristics
Added new Kconfig option set that allows the user to control the
presence of the following optional characteristics:

- Manufacturer Name String
- Model Number String

Depreacted the old configuration that can be deleted in the future
Zephyr releases.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2025-02-13 16:46:12 +01:00
Jamie McCrae
13ac8fe1f5 mgmt: mcumgr: smp: Fix custom payload size
Fixes an issue when using custom payloads where the size was still
using the zcbor buffer instead of the size of the network buffer

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-02-13 16:44:06 +01:00
Luca Burelli
44c7a1401e llext: add ELF inspection APIs
Add APIs to inspect the contents of an ELF file loaded as an extension.
This is useful for applications that need to access the contents of the
extension in a more fine-grained way than the existing LLEXT APIs.

Use of these APIs requires the 'keep_elf_data' option to be provided via
struct llext_load_param to the 'llext_load()' call.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-02-13 16:43:29 +01:00
Luca Burelli
325d6b7d7f llext: add option to keep section data after llext_load
This is required for the functions that inspect the ELF file to work
properly. The user must then call llext_free_inspection_data() before
calling llext_unload() to free the memory left allocated in the loader
and extension memory.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-02-13 16:43:29 +01:00
Carlo Kirchmeier
ae96ccc3d7 fs: enable custom mount points for fatfs
Introduce two new kconfig options in order
to be able to define custom named fatfs
mount points. If activated replace the static
FF_VOLUME_STRS approach with the runtime
generated VolumeStr array containing those
mount points.

Signed-off-by: Carlo Kirchmeier <carlo.kirchmeier@zuehlke.com>
2025-02-13 16:41:34 +01:00
Riadh Ghaddab
ef4e8dd5c3 settings: ZMS: add a backend for ZMS (Zephyr Memory Storage)
This adds the initial backend support for the ZMS storage system.

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2025-02-13 16:40:41 +01:00
Make Shi
f8ebbb3fef Bluetooth: AVCTP: Implement the functionality of avctp_l2cap_accept
- Implement the functionality of avctp_l2cap_accept to accept an L2CAP
  connection for the AVCTP protocol.

Signed-off-by: Make Shi <make.shi@nxp.com>
2025-02-13 12:16:30 +01:00
TOKITA Hiroshi
04eba1d392 fb: cfb: Remove unused config
CHARACTER_FRAMEBUFFER_SHELL_DRIVER_NAME is not used.
Remove it.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2025-02-13 12:14:52 +01:00
Tom Hughes
bddaff1d1b ztest: ztest_mock: Fix typo
"data provided don't match" should be
"data provided doesn't match"

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-13 01:13:56 +01:00
Marek Pieta
c7f3ad6307 bluetooth: host: Allow for ECDH operations through system workq
Change allows performing ECDH operations through system workq. This is
done to allow reducing memory consumption by disabling the long workq on
small SoCs.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2025-02-12 20:26:28 +01:00
Robert Lubos
05ac5497d5 net: dhcpv6: Add support for DNS Recursive Name Server option
Implement support for DNS Recursive Name option and use obtained
information to configure DNS resolver.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-02-12 20:19:26 +01:00
Ingar Kulbrandstad
45f233ba61 Bluetooth: Mesh: Remove experimental TF-M PSA
Remove the experimental flag from BT_MESH_USES_TFM_PSA.

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
2025-02-12 20:18:16 +01:00
Robert Lubos
d0e5696a0e net: dhcp: Avoid source port validation in replies
There's nothing in RFC 2131 or RFC 8415 that would mandate the DHCP
server to reply with a source port set to the IANA assigned one, and
some servers seem to send responses with some arbitrary source port set.

Therefore, make Zephyr's DHCP client implementation more permissive,
accepting packets with a source port set to a different port than the
IANA assigned server port.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-02-12 16:03:57 +01:00
Florian Weber
b55b9ae72b rtio: workq: bugfix of memory allocation
This commit fixes the bug that the memory of the work request is
freed up in the work handler, before it is not needed anymore by the p4wq.
This is fixed now, by using the new done_handler in the p4wq
for freeing up that memory.

Signed-off-by: Florian Weber <Florian.Weber@live.de>
2025-02-12 16:03:17 +01:00
Vinayak Kariappa Chettimada
a8065926ac Bluetooth: Controller: Fix to release aux context stored in node rx
Fix to release aux context stored in node rx, and not in the
superior scan or sync context as the one in the superior scan
or sync context could be reset or have a different new aux
context when multiple advertising chain reception is used.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-02-12 12:24:52 +01:00
Vinayak Kariappa Chettimada
3263729020 Bluetooth: Controller: Fix assertion terminating Periodic Sync
Fix assertion due to changes introduced to support multiple
advertising chain reception.

Auxiliary context association with the Periodic Sync context
was not cleared due to which when terminating a Periodic
Synchronization triggered an assertion check, under race
conditions, detecting that the auxiliary context was already
released.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-02-12 12:24:52 +01:00
Vinayak Kariappa Chettimada
2461552e19 Bluetooth: Controller: Fix Periodic Sync for multiple chain reception
Fix regression introduced in Periodic Advertising
Synchronization due to change related to multiple
Advertising chain reception.

Related commit c334ed515b ("Bluetooth: Controller: Fix
multiple Extended Adv chain reception"), and
commit da792a9e17 ("Bluetooth: Controller: Fix interleaved
extended scanning assert").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-02-12 12:24:52 +01:00
Emil Gydesen
571f26cf1a Bluetooth: Rename BLE to Bluetooth (LE) where applicable
The BLE acronym is not an official description of Bluetooth
LE, and the Bluetooth SIG only ever refers to it as Bluetooth
Low Energy or Bluetooth LE, so Zephyr should as well.

This commit does not change any board or vendor specific
documentation, and the term BLE may still be used in those.
It will be up to the vendors to update it if they want,
since many of them are using the term BLE in their
products.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-12 12:24:18 +01:00
Vinayak Kariappa Chettimada
8ebc4f3384 Bluetooth: Controller: Fix sync_delay and latency in LE BIG Complete
Fix missing sync_delay and transport_latency information in HCI
LE BIG Complete event.

Relates to commit 1a640e4711 ("Bluetooth: controller:
Included transport latency in LE_Big_Established").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-02-12 12:23:51 +01:00
Fengming Ye
826f445c69 wifi: shell: add ACS case in ap enable cmd
In ap enable cmd, channel set to 0 means ACS mode.
Remove hostapd AP macro for this case to make ACS mode
available for public usage.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2025-02-12 12:23:35 +01:00
Vinayak Kariappa Chettimada
83e2ec3c9b Bluetooth: Controller: Fix device address in Periodic Adv Sync
Fix incorrect device address reported in the LE Periodic
Advertising Sync Established event when using Periodic
Advertiser List.

During Extended Scanning there can be an ADV_EXT_IND PDU
received between currently being received ADV_EXT_IND PDU
and AUX_ADV_IND PDU; if the one received between has an
address match then incorrectly the Periodic Synchronization
was established to the device whos AUX_ADV_IND PDU is being
received. Fix by storing the auxiliary context that has the
address match and compare with it when matching the SID in
SyncInfo of AUX_ADV_IND PDU being received prior to creating
the synchronization.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-02-12 12:22:52 +01:00
Vinayak Kariappa Chettimada
5119896c7d Bluetooth: Controller: Fix BT_CTLR_LOW_LAT_ULL conditional code
Fix BT_CTLR_LOW_LAT_ULL conditional compilation code by
decoupling it from BT_CTLR_LOW_LAT code.

BT_CTLR_LOW_LAT_ULL makes ULL execution context to tailchain
in comparison to continuously process in a while loop.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-02-12 12:22:18 +01:00
Emil Gydesen
49d9b4cb69 Bluetooth: PACS: Remove BAP infix for pacs_register_param
Since the PACS service is not part of the bt_bap API it should
not use the bt_bap prefix, and instead just be bt_pacs like the
rest of the PACS API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-12 09:41:49 +01:00
Robert Lubos
558e2a5556 net: lwm2m: Fix time resource validation
When writing to a time resource, the logic was incorrect when validation
was enabled for the resource - when determining the actual underlying data
type we should compare against the data buffer length and not the
validation buffer length.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-02-12 09:41:35 +01:00
Jukka Rissanen
ae05221762 net: Update IP address refcount properly when address already exists
If an IP address already exists when it is tried to be added to the
network interface, then just return it but update ref count if it was
not updated. This could happen if the address was added and then removed,
but for example an active connection was still using it and keeping the
ref count > 0. In this case we must update the ref count so that the IP
address is not removed if the connection is closed.

Fixes #85380

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-02-12 09:41:24 +01:00
Jukka Rissanen
908cfacd85 net: mdns_responder: Add announce support
After probing, send two unsolicited mDNS response messages
for our name.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-02-12 09:40:15 +01:00
Jukka Rissanen
9e79184f7e net: mdns_responder: Implement probing support
The mDNS probing is described in RFC 6762 chapter 8.1.
The code will send an unsolicited mDNS query to network and
will check if there are existing hosts with the same name.
If there are, then the mDNS responder will not respond to
queries it is configured to use.

Fixes #84333

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-02-12 09:40:15 +01:00
Jukka Rissanen
8d601a0cc2 net: dns: Allow creating context with specific interface
Allow user to specify the network interface where the query should
be sent, but only if the user has supplied the DNS servers in sockaddr
list. If user has specified a DNS servers in a string list, then the
possible network interface is taken from the string.

The reason for this is that it is not possible to add network interface
to the sockaddr list so an extra parameter is needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-02-12 09:40:15 +01:00
Jukka Rissanen
82ef524777 net: dns: Allow creating context with specific svc and port
Allow user to specify socket service struct and port number so
that DNS servers specified in Kconfig etc are not used. This way
we can send a DNS query to arbitrary address without it affecting
the system configuration.

This is used in mDNS probing so that that mDNS responder can send
probe message and not change / configure system global DNS config.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-02-12 09:40:15 +01:00
Jukka Rissanen
af758e51a2 net: dns: Introduce resolver function that avoids using the cache
Introduce dns_resolve_name_internal() that allows resolving a name
and not use DNS cache if caching is enabled.

This is needed in mDNS probing (RFC 6762 chapter 8.1) which needs
to send a mDNS query and not get any results from cache.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-02-12 09:40:15 +01:00
Johan Hedberg
90367c8dd1 Bluetooth: Host: Classic: Fix allocated PSM comparison
The code for checking for allocated BR/EDR PSMs was potentially resulting
in an integer overflow, due to doing a <= UINT16_MAX (0xffff) comparison
on a uint16_t variable. To avoid this, use a uint32_t variable internally.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-02-12 02:26:57 +01:00
Tom Hughes
d811760779 net: lib: coap: Remove unused function
Building with clang warns:

subsys/net/lib/coap/coap_link_format.c:39:20: error: unused function
'append_be16' [-Werror,-Wunused-function]
static inline bool append_be16(struct coap_packet *cpkt, uint16_t data)

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-12 02:25:53 +01:00
Tom Hughes
1f653ae295 net: lib: http_server: Remove unused function
Building with clang warns:

subsys/net/lib/http/http_hpack.c:21:20: error: unused function
'http_hpack_key_is_dynamic' [-Werror,-Wunused-function]
static inline bool http_hpack_key_is_dynamic(uint32_t key)
                   ^

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-12 02:25:41 +01:00
Tom Hughes
d2bf3ae905 net: ipv6: Remove unused function
Building with clang warns:

subsys/net/ip/ipv6_nbr.c:137:31: error: unused function
'get_nbr_from_data' [-Werror,-Wunused-function]
static inline struct net_nbr *get_nbr_from_data(struct net_ipv6_nbr_data
                              ^                 *data)

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-12 02:23:07 +01:00
Johann Fischer
7ffa6203e1 usb: device_next: allow CDC ACM UART to be initialized and enabled at boot
There are some boards and samples in the tree that use the CDC ACM UART
as the default serial backend, just like a real UART controller would.
The new device stack requires more detailed configuration than the old
one. In order to use the CDC ACM UART as the serial backend with the new
device stack in the same way as with the legacy stack, we need to
provide a solution to initialise and enable the CDC ACM UART at boot
time. We cannot use snippets as they do not support Kconfig files or
source code. Shields would be an option, but they cannot be used for
virtual devices such as the CDC ACM UART. The remaining solution is to
put the code and Kconfig file for it in the subsys directory.

Allow CDC ACM UART instance and USB device stack to be initialized and
enabled at boot time and to use it as serial backend for logging or
shell.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-02-12 02:22:18 +01:00
Johann Fischer
7b344567be usb: device_next: fix cdc_acm_send_notification()
Fix "warning: 'cdc_acm_send_notification' defined but not used"
when Kconfig option UART_USE_RUNTIME_CONFIGURE is not used and
properly handle enqueue error.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-02-12 02:22:18 +01:00
Emil Gydesen
b67d291207 Bluetooth: Host: Add type check for bt_conn API
Added a new function, bt_conn_is_type, that returns whether
the provided conn object is of the provided type.

This check is then used to ensure that the conn objects
supplied to other bt_conn function are of the right type.
The right type has also been documented for these functions.

This is an initial commit for a larger change in the BT Host,
as similar checks should be added to the L2CAP, GATT, ISO,
Audio and possibly Mesh APIs.

The type check could have been implemented by using the
bt_conn_get_info function, but that requires additional
function calls as well as memory allocation and copy.
Since bt_conn_is_type is designed to be widely used, it
was suited for its own function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-11 22:04:51 +01:00
Aleksandr Khromykh
4bb595718d Bluetooth: Mesh: remove double cdb node storing
Commit removes the double cdb node entry storing
into the settings if device was reprovisioned over
nppi interface.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-02-11 18:56:37 +01:00
Emil Gydesen
788486b972 Bluetooth: ISO: Add range to BT_ISO_MAX_BIG
If BT_ISO_BROADCAST is enabled, then we shall support
at least 1 BIG and at most BT_EXT_ADV_MAX_ADV_SET since
each BIG requires its own advertising set.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-02-11 15:42:03 +01:00
Robert Lubos
d6792494b7 net: coap_client: Fix build with cpp projects
The coap_client.h header won't build if included from c++ file:

error: expected primary-expression before ‘.’ token
  .value[0] = coap_bytes_to_block_size(CONFIG_COAP_CLIENT_BLOCK_SIZE),

Therefore move the actual function implementation to the library C file
to prevent this.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-02-11 15:41:37 +01:00
Luca Burelli
802156c0cb logging: improve log_flush() robustness
The 'log_flush()' function is used to wait for all pending log messages
to be processed by the background thread. This is performed by polling
the 'log_data_pending()' function, which scans all available buffers.

The log core already provides a 'buffered_cnt' variable that keeps track
of the number of pending messages. This variable is updated atomically
and could be a more efficient implementation for that check.

This commit moves the 'buffered_cnt' decrement _after_ the message
processing and buffer release, to ensure that the variable reflects
the number of pending messages at any moment in time.

The 'log_data_pending()' function is then replaced with a direct check
of the 'buffered_cnt' variable.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-02-11 15:39:29 +01:00
Qingling Wu
159332d591 net: wifi: hostap: add CA certificate used or skipped support
Added new parameter "A" in wifi connect command to support
CA certificate used or CA certificate skipped for
EAP-TTLS-MSCHAPV2 and EAP-PEAP-MSCHAPV2.

Signed-off-by: Qingling Wu <qingling.wu@nxp.com>
2025-02-11 15:38:58 +01:00
Lingao Meng
f5bd2170d1 tests: bsim: Add testcase for bluetooth mesh extended advertiser
Add some configuration for test adv_ext.c

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2025-02-11 15:38:35 +01:00
Lingao Meng
2ebdcfa963 Bluetooth: Mesh: Remove START_PENDING flags
Remove START_PENDING flag, and replace with
bt_mesh_adv_is_empty_by_tag

not only make adv_ext.c more readable, but also enhancement

In previous implementation, after proxy started, will check
this flag, and when the flag is true, will direct stop proxy
and re-enter schedule, but has one problem, this flag set true,
but buf will be empty, such as when sending mesh relay messages
will for-each every sets, until find not-active, but also set
previous set START_PENDING flags, so will cause proxy advertising
started->stop->started.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2025-02-11 15:38:35 +01:00
Lingao Meng
bcac572ab4 Bluetooth: Mesh: Remove ADV_FLAG_PROXY_START, due to meanless
The first why introduce ADV_FLAG_PROXY_START
see here(https://github.com/zephyrproject-rtos/zephyr/pull/58826)

The main core change is to mark ADV_FLAG_PROXY as moving to the last
enabled proxy instead of before.

But introducing the ADV_FLAG_PROXY_START flag seems meaningless.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2025-02-11 15:38:35 +01:00
Jakub Witowski
05ab017774 net: coap: fix uninitialized usage of option struct
option struct was uninitialized in insert_option() function
during encode_options() call when the while loop wasn't
executed before.

Signed-off-by: Jakub Witowski <jakub.witowski9302@gmail.com>
2025-02-11 11:45:05 +00:00
Jakub Witowski
828f5e8b23 net: coap: fix uninitialized usage of hdr_len
The hdr_len was uninitialized when none of if-else
conditions were met in decode_delta() function.

Signed-off-by: Jakub Witowski <jakub.witowski9302@gmail.com>
2025-02-11 11:45:05 +00:00
Rene Beckmann
cc33491265 net: mqtt-sn: Wait for register & subscribe to complete
From the MQTT-SN spec:

6.5 Topic Name Registration Procedure

...
At any point in time a client may have only one
REGISTER message outstanding, i.e. it has to wait
for a REGACK message before it can register another
topic name.
...

6.9 Client’s Topic Subscribe/Un-subscribe Procedure

...
As for the REGISTER procedure, a client may have only
one SUBSCRIBE or one UNSUBCRIBE transaction open at a time.
...

Until now, the library did not comply with these requirements.
An additional "waiting" state for topics was introduced:
REGISTER, SUBSCRIBE and UNSUBSCRIBE as an extra step before
switching to REGISTERING, SUBSCRIBING and UNSUBSCRIBING. The
library now makes sure that only one topic can be REGISTERING
and only one topic can be in either SUBSCRIBING or UNSUBSCRIBING.
Additionally, requesting to UNSUBSCRIBE is now denied if the topic
is not yet SUBSCRIBED, to avoid weird race conditions.

Also, added two tests that verify this behavior.

This fixes #84644

Signed-off-by: Rene Beckmann <rene.bckmnn@gmail.com>
2025-02-11 11:44:52 +00:00
Rene Beckmann
b7c404738f net: mqtt-sn: Add comments
Add some comments to static functions and variables.

Signed-off-by: Rene Beckmann <rene.bckmnn@gmail.com>
2025-02-11 11:44:52 +00:00