Commit graph

21541 commits

Author SHA1 Message Date
Luca Burelli
4b34163faa llext: (cosmetic) llext_map_sections() cleanups
Add a 'continue' statement when the first section of a region is
detected, to avoid unnecessary indentation.

No functional change is introduced in this commit.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-03-17 19:58:15 +01:00
Alberto Escolar Piedras
1dab77b49f Bluetooth: Host: ATT: Fix build warning with clang
Fix the following warning
att.c:734:3: warning: label followed by a declaration is a C23 extension
[-Wc23-extensions]
  734 |                 k_tid_t current_thread = k_current_get();
      |                 ^
By wrapping that code as a compound statement

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-17 16:25:33 +01:00
Jukka Rissanen
ac3cb9dac0 net: Change the net_linkaddr struct to not use pointers
Previously the net_linkaddr struct had pointers to the link address.
This is error prone and difficult to handle if cloning the packet as
those pointers can point to wrong place. Mitigate this issue by
allocating the space for link address in net_linkaddr struct. This will
increase the size of the net_pkt by 4 octets for IEEE 802.15.4 where the
link address length is 8, but there no increase in size if link address
is 6 bytes like in Ethernet/Wi-Fi.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-03-17 16:25:22 +01:00
Vinayak Kariappa Chettimada
374d41a9c1 Bluetooth: Controller: ISO Receive interleaved packing support
Add ISO Receive interleaved packing support in Lower Link
Layer implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-03-17 16:24:33 +01:00
Vinayak Kariappa Chettimada
5b74950857 Bluetooth: Controller: ISO Broadcast interleaved packing support
Add ISO Broadcast interleaved packing support in Lower Link
Layer implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-03-17 16:24:33 +01:00
Vinayak Kariappa Chettimada
4243cb5df6 Bluetooth: Controller: Fix BIS interleaved packing sub_interval calc
Fix BIS sub_interval calculation for interleaved packing.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-03-17 16:24:33 +01:00
Lyle Zhu
1708574d0a Bluetooth: BR: Add a function bt_br_bond_exists()
Add a function `bt_br_bond_exists()` to check if the address of the
classic device has been bonded.

Update release-notes-4.2.rst

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-03-17 14:08:04 +01:00
Sebastian Schoch
a21ec50f5c net: lwm2m: Call the lwm2m_send_cb callback on context close
Fix that a lwm2m message is reset without executing a registered
callback on lwm2m_engine_context_close.

Signed-off-by: Sebastian Schoch <sebastian.schoch@husqvarnagroup.com>
2025-03-17 13:57:31 +01:00
Timothy Keys
7ef8116969 bluetooth: host: Remove experimental flag from LE Connection Subrating
The API has not changed since it was introduced so should no longer be
considered experimental.

Signed-off-by: Timothy Keys <timothy.keys@nordicsemi.no>
2025-03-17 13:57:03 +01:00
Lyle Zhu
d42294d809 Bluetooth: SMP_BR: Use macros instead of hard code
Define macros for encryption value,
#define BT_HCI_ENCRYPTION_OFF           0x00
#define BT_HCI_ENCRYPTION_ON_LE_AES_CCM 0x01
#define BT_HCI_ENCRYPTION_ON_BR_E0      0x01
#define BT_HCI_ENCRYPTION_ON_BR_AES_CCM 0x02

Use the macros to replace the hard code.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-03-17 07:04:58 +01:00
Lyle Zhu
af86a35b61 Bluetooth: SMP_BR: Avoid to derive LTK from invalid BR LK
The LTK should not be generated from BR link key if there is a LTK
exists and BR LK is weaker.

Do not drive LTK from BR LK in the case.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-03-17 07:04:58 +01:00
Utsav Munendra
9379c35dbf portability: cmsis: Clarify Kconfig set max limit on dynamic objects
Clarify that all max limit on RTOS objects set by Kconfig only apply
to objects whose control blocks were dynamically allocated. The
CMSIS-RTOSv2 impl layer itself does not restrict the number of
statically created RTOS objects.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-03-17 02:21:15 +01:00
Utsav Munendra
c006922b22 portability: cmsis: Remove max limit on new statically created threads
Clarify thread Kconfigs to denote the maximum number of dynamically
allocated control blocks and stacks for threads. Allow application to
create any number of threads with statically allocated control block
and stack.

Signed-off-by: Utsav Munendra <utsavm@meta.com>
2025-03-17 02:21:15 +01:00
Martin Stumpf
d7d6038cfb fs: shell: Refactoring
- Run reformat
- Fix ifs not containing bool expressions (coding guideline 85)
- Fix error codes
- Fix missing error handling in `cmd_read`
- Fix incorrect handling of `fs_read` in `cmd_read_test`

Signed-off-by: Martin Stumpf <finomnis@gmail.com>
2025-03-17 02:20:40 +01:00
Carlo Kirchmeier
1ea0267a31 fs: enable fstab devicetree integration for fatfs
In order to use fstab with fatfs in addition to
littlefs a new driver fstab,fatfs was introduced
containing the required logic to detect and if
needed automount fatfs devices specified in fstab.
Additionally as the partition phandle is not needed
by fatfs and currently is specific to littlefs it
was moved from the common dts binding into the
littlefs binding.

Signed-off-by: Carlo Kirchmeier <carlo.kirchmeier@zuehlke.com>
Co-authored-by: Carlo Kirchmeier <carlo.kirchmeier@zuehlke.com>
Co-authored-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2025-03-15 13:07:40 +01:00
Herman Berget
8b909b4403 Bluetooth: Host: Remove experimental label from PAwR
The api has not changed since its introduction some time ago,
mark it as stable.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2025-03-14 17:56:18 +01:00
Tomi Fontanilles
8627250d3c modules: mbedtls: add promptless CONFIG_MBEDTLS_PSA_CRYPTO_STORAGE_C
Add a Kconfig option to match the Mbed TLS define
instead of defining it based on CONFIG_SECURE_STORAGE.

This gives more flexibility regarding the potential re-definition of the
CONFIG_MBEDTLS_PSA_CRYPTO_STORAGE_C Kconfig option.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2025-03-14 14:51:58 +01:00
Marc Lasch
8aed2a1bab net: lwm2m: Prevent client restart on bootstrap finish retransmission
Ignore bootstrap 'transition done' state transition
(ENGINE_BOOTSTRAP_TRANS_DONE) from an invalid state. The client must be
in state ENGINE_BOOTSTRAP_REG_DONE to process a bootstrap finish command
received from the server.

The LwM2M client does not implement CoAP deduplication (rfc 7252,
section 4.5) and retransmissions of the bootstrap finish command `/bs`
would restart the registration client with undesired side effects.

Signed-off-by: Marc Lasch <marc.lasch@husqvarnagroup.com>
2025-03-14 14:41:15 +01:00
Triveni Danda
e7a65ac9b4 shell: Set default max argc count when WiFi shell is enabled
Set the default maximum argument count for the shell to 30
when the Wi-Fi shell is enabled, to ensure all Wi-Fi
commands work without failure.

Signed-off-by: Triveni Danda <triveni.danda@nordicsemi.no>
2025-03-14 14:40:57 +01:00
Pavel Vasilyev
886fabaf87 bluetooth: host: ecc: Change log level debug
This commit changes log level for already registered callback from
warning to debug as this is cause unnecessary noise and doesn't indicate
actual issue. Caller gets a certain error code for this case which can
be handled properly.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-03-14 14:40:34 +01:00
Lyle Zhu
218de8dc67 Bluetooth: L2CAP_BR: Code format
Change ```#if defined(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL)
#if defined(CONFIG_BT_L2CAP_LOG_LEVEL_DBG)```
to `#if defined(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL) &&
defined(CONFIG_BT_L2CAP_LOG_LEVEL_DBG)`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-03-14 05:47:48 +01:00
Lyle Zhu
d82844695e Bluetooth: L2CAP_BR: CID of data sending is invalid
There is a corner case that the channel is in disconnecting status,
due to there is a disconnect request sent from peer.
At this time, the channel is status is `BT_L2CAP_CONNECTED`. But it
has been removed from `conn->channels` by calling the function
`l2cap_br_remove_tx_cid`.
And the disconnect event is notified upper layer via the callback
`ops->disconnected`. The thread of the callback context is blocked
due to the the calling of `printk` in the callback function.

Then the pending lower priority thread, sending the data in this
l2cap channel, is activated. Then in the function
`bt_l2cap_br_send_cb`, a NULL pointer will be got according to the
given CID. And unexpected behavior happens when accessing a NULL
pointer, since the invalid channel pointer is not checked in
function `bt_l2cap_br_send_cb`.

Check the channel pointer after function `bt_l2cap_br_lookup_tx_cid`
called. If the channel pointer is invalid, return error code
`-ESHUTDOWN` directly.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-03-14 05:47:36 +01:00
Tom Burdick
079d9c34e4 rtio: Transactions assume valid next list nodes
Add an assert ensuring programming errors where the executor code
assumes there is a next node in the list for transaction/chained
submissions.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2025-03-14 01:02:10 +01:00
Guennadi Liakhovetski
dc27b4219c llext: skip MMU flag adjustment for pre-located extensions
Extensions with the pre_located flag set, manage memory themselves,
including MMU permissions. Skip any such adjustments in LLEXT core.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2025-03-13 16:57:37 +00:00
Hui Bai
553b7d9bc5 wifi: shell: Show WPA2 Enterprise in scan results
For WPA2 Enterprise AP, show security type as WPA2 Enterprise
instead of EAP-TLS.

Signed-off-by: Hui Bai <hui.bai@nxp.com>
2025-03-13 16:57:15 +00:00
Helmut Lord
84163d35e6 logging: rtt: add dictionary hex logging
Adds hex dictionary logging for RTT backend

Signed-off-by: Helmut Lord <kellyhlord@gmail.com>
2025-03-13 16:57:05 +00:00
Emil Gydesen
501b95ff9b Bluetooth: CSIP: Rename BT_CSIP_SET_MEMBER_NOTIFIABLE
Renamed BT_CSIP_SET_MEMBER_NOTIFIABLE to
BT_CSIP_SET_MEMBER_SIRK_NOTIFIABLE to be more specific.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-13 16:56:14 +00:00
Vincent van der Locht
a26a222410 net: mdns: adding MDNS unicast response confirm rfc6732
Conform rfc6762  a mDNS responder should answer clients
which are not using the mDNS port in the source address
with unicast  UDP to the same port as described in chapter 6.7

Fixes: #81657

Signed-off-by: Vincent van der Locht <vincent@synchronicit.nl>
2025-03-13 16:54:24 +00:00
Jamie McCrae
9f12f8afb2 infrastructure: Remove hwmv1 support
Removes support for the deprecated hardware model version 1

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-03-13 16:53:07 +00:00
Lyle Zhu
2ac116ea71 Bluetooth: SMP_BR: Derive LTK after LK refreshed
When the link key of BR is upgraded, the encrypt key refresh event
will be notified. The link key is upgraded from weak to strong.
The LTK of LE should be derived from strong link key.

Start SMP pairing procedure to try to derive LTK from LK.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-03-13 10:49:58 +01:00
Pavel Vasilyev
d3997c6eb0 bluetooth: mesh: set subscription address on response
This fixes an issue where a subsequent Config Model Subscription Add
message with the same virtual address UUID would result in a Config
Model Subscription Status message with the Address field incorrectly set
to 0.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-03-13 10:49:48 +01:00
Emil Gydesen
5918427278 Bluetooth: Host: Make bt_le_addr_is_bonded public
Some GATT services and profiles define specific behavior
based on whether the remote device is bonded or not.
The internal function, bt_addr_le_is_bonded, is the
only function to do this, but it was kept internal,
and could thus not be used for those services
without including hci_core.h.

The function has been moved to the public API
so that application can determine if a remote
address is bonded or not, and has been renamed
to not use the bt_addr namespace, but rather the
bt_le.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-13 10:48:19 +01:00
Emil Gydesen
1f26899229 Bluetooth: TBS: Ensure sending notifications
The existing implemented only attempted to send all notifications,
but if host was out of ATT TX buffers the notifications would fail
and the client may miss out on important information, and would be
a spec violation.

This commit refactors notificatios in TBS so that they are always
sent.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-13 10:27:59 +01:00
Nicolas Pitre
b5bc307019 net: lwm2m: encapsulate ring buffer internals
Use struct ring_buf_index as a whole, don't access its constituants.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-03-12 19:04:54 +01:00
Lyle Zhu
9a04dfd85e Bluetooth: l2CAP_BR: Fix the response cannot be sent out issue
There is an issue that the L2CAP connect response function
`l2cap_br_conn_req_reply()` is called first. And then the ACL
disconnect function `bt_conn_disconnect()` is called following. But
the packet of `bt_conn_disconnect()` appears on the HCI bus first.

Add a flag `L2CAP_FLAG_DISCONNECT_ACL` to flag whether it is needed to
disconnect ACL connection.

Set the flag `L2CAP_FLAG_DISCONNECT_ACL` when result of the L2CAP
channel conn rsp is `BT_L2CAP_BR_ERR_SEC_BLOCK`.

Add a l2cap packet sent out callback `l2cap_br_conn_rsp_sent_cb()`.
When the callback triggered, disconnect the ACL connect with
`BT_HCI_ERR_AUTH_FAIL` if the flag `L2CAP_FLAG_DISCONNECT_ACL` has
been set.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-03-12 19:03:05 +01:00
Nirav Agrawal
438701fdd5 bluetooth: host: perform hci-reset in bt_disable()
- added HCI command to send hci-reset in bt_disable() func, and
  remove its call from the driver close() call.
- remove rsp buf pass to 'hci_reset_complete()' func as status is
  already checked under 'bt_hci_cmd_send_sync()'.

Signed-off-by: Nirav Agrawal <nirav.agrawal@nxp.com>
2025-03-12 19:02:35 +01:00
Krzysztof Chruściński
4cbafc6bd4 tracing: Add sys_trace_idle_exit call
Add new tracing API which is called when core is exiting from idle.
Current implementation is using it to track CPU load. Implementation
in tracing_none is now weak so it can be used if given backend does
not support new API call.

When CONFIG_CPU_LOAD is enabled then sys_trace_idle also calls a
hook which stores the timing information when CPU entered idle.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-03-12 14:03:48 +00:00
Krzysztof Chruściński
c7d7aac2bd debug: Add cpu_load module
Add module which can measure CPU idle time. Idle time is measured in
the pre/post CPU idle hooks but they are not provided by this module.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-03-12 14:03:48 +00:00
Maochen Wang
1dbe1dfa1f net: lib: sockets: fix socket_service thread stuck by mistake
Use Wi-Fi connecting to Qualcomm IPQ8074 AP, and run the UDP RX traffic
with Zperf, but zperf does not return the throughput number after
traffic completion nor any session started prints. After traffic
completion, ping from STA to AP and vice versa does not work. The
socket_service thread is found blocked forever at zsock_wait_data()
after dns_dispatcher_svc_handler() is called via trigger_work().
The root cause of this issue is:
STA received one DHCPv4 packet containing DHCPV4_OPTIONS_DNS_SERVER,
it will create DNS socket and registered to socket_service. Then STA
received another IPv6 router advertisement packet containing
NET_ICMPV6_ND_OPT_RDNSS, it will close socket and change the state of
poll_events to K_POLL_STATE_CANCELLED(8), then registered to
socket_service with same fd. In socket_service thread, zsock_poll()
called zsock_poll_update_ctx() when handled ZFD_IOCTL_POLL_UPDATE, and
it checked the state of poll_events was not K_POLL_STATE_NOT_READY(0),
then it will set pfd->revents to '|= ZSOCK_POLLIN'. Finally
trigger_work() can be called as 'ctx.events[i].revents > 0' is matched.

The fix of this issue is that, in zsock_poll_update_ctx(), it should
check the state of poll_events is neither K_POLL_STATE_NOT_READY nor
K_POLL_STATE_CANCELLED before setting revents as ZSOCK_POLLIN, to avoid
trigger_work be unexpectedly called.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-03-12 07:14:46 +01:00
Lyle Zhu
f349976937 Bluetooth: SSP: Fix MITM flag incorrect issue in pairing
There is a case that if the local is a peripheral and a L2CAP server
with the security level 3,the mitm should be set to make sure the
security level can reach level 3.

But in current implementation, the MITM is not set because the MITM
of `Authentication_Requirements` parameter of remote is not set. And
the security level will be level 2 after the security pairing
procedure complete.

Add a function `bt_l2cap_br_get_max_sec_level` to
get the max level of the registered servers.
`
Force set the MITM bit if the max level is bigger than level 2 and
pairing method is not `just works`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-03-12 07:14:25 +01:00
Andrej Butok
8473928db4 zms: fix the zms_mount() sector_size check
Adds the return -EINVAL, if the fix zms_mount() sector_size
check is failed.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2025-03-12 02:29:31 +01:00
Christoph Seitz
5992208605 net: ethernet: Refactor length check to accommodate VLAN header size
The ethernet header size with VLAN tag is 18 bytes,
so the length check should accommodate this.

Signed-off-by: Christoph Seitz <christoph.seitz@infineon.com>
2025-03-12 02:29:02 +01:00
Christoph Seitz
e43246b756 net: ethernet: Fix length update for unsupported packet families
Do not update packet length for unsupported packet families.
AF_PACKET family used the IPv6 length update, which breaks the
packet length if there is a payload with bytes resembling a
IPv6 length field less then 6 or a IPv4 length field less
then 46.

Signed-off-by: Christoph Seitz <christoph.seitz@infineon.com>
2025-03-12 02:29:02 +01:00
Etienne de Maricourt
16c6504ee0 net: lwm2m: Fix ifdef nesting for data cache config
Avoid a "defined but not used" warning on
`init_next_pending_timeseries_data` when
LWM2M_RESOURCE_DATA_CACHE_SUPPORT is enabled but not LWM2M_VERSION_1_1.

Signed-off-by: Etienne de Maricourt <edmecomemail@gmail.com>
2025-03-12 02:27:59 +01:00
Alberto Escolar Piedras
c1a40abc6d subsys/bluetooth: Misc native_posix cleanup
Remove a kconfig dependency on BOARD_NATIVE_POSIX which
does not really exist anymore.
Replace a comment mention of native_posix with native_posix.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-12 02:27:36 +01:00
Lars-Ove Karlsson
8d3dcd79f4 logging: Added config to disable vla in statements
The config LOG_USE_VLA depends on that MISRA_SANE is not set.
Unfortunately the IAR toolchain can't handle vla:s inside a
statement, which the LOG_USE_VLA macro does.

I've added a new, hidden config to check if vla is ok inside
statements, SUPPORT_VLA_IN_STATEMENTS. Default is always y, but
a toolchain can override it so that VLA is not used by
Z_LOG_MSG_ON_STACK_ALLOC.

Signed-off-by: Lars-Ove Karlsson <lars-ove.karlsson@iar.com>
2025-03-11 18:55:08 +01:00
Johann Fischer
53c33ab9b5 dap: add DAP backend USB
The backend uses a new USB device stack and bulk endpoints. Only a
single instance of the backend function is currently supported. Both DAP
packet processing and the new backend are prepared to support multiple
instances, but require a user interface and minor modifications.

New backen has similar functionality to what is provided by the function
in the sample samples/subsys/dap.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-03-11 18:54:24 +01:00
Johann Fischer
6fbd63b733 cmsis_dap: remove Kconfig option CMSIS_DAP_PACKET_SIZE
We need a way to update the value configured by option
CMSIS_DAP_PACKET_SIZE at runtime. For example, the USB backend may have
different values depending on the speed at which the device is being
enumerated.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2025-03-11 18:54:24 +01:00
Lyle Zhu
d811f6921c Bluetooth: L2CAP_BR: Reject the conn req if sec levels do not match
If the ACL link has been encrypted and it has a authenticated link key,
it means the pairing procedure has been done. And the security level of
the link key can not be upgraded. In this case, if `conn->sec_level` is
less than the required security level of the L2CAP channel, reject the
L2CAP conn request.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-03-11 18:53:50 +01:00
Olivier Lesage
6f33793b41 bluetooth: Host: Rename CS tone antenna configurations
Improves readability by removing the need to check the table
to figure out how many antennas devices A and B are using.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2025-03-11 08:59:19 +01:00