Commit graph

22,555 commits

Author SHA1 Message Date
Johan Hedberg
81e7569fa1 Bluetooth: Host: Fix format specifier warnings
Use %zu for size_t and %zd for ssize_t, and don't use those specifiers for
any other type. Also make sure that field width specifiers get typecast to
the expected int type.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-03-18 16:45:29 +01:00
Dong Wang
3fac83151d logging: Assign IDs to log backends early during log_core_init
This commit moves the assignment of backend IDs from the 'z_log_init'
function to the earlier 'log_core_init' function. This ensures that
backend IDs are assigned before they are used in the 'log_backend_enable'
function, preventing incorrect settings of log dynamic filters.

Signed-off-by: Dong Wang <dong.d.wang@intel.com>
2025-03-18 16:42:07 +01:00
Emil Gydesen
fb68b4be7e Revert "Bluetooth: Audio: Use generic count_bits to count bits"
This reverts commit ee335399c1.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-18 16:39:47 +01:00
Marcin Niestroj
7290dd2a57 net: ipv6: set NET_ADDR_PREFERRED before network event if !DAD
Set NET_ADDR_PREFERRED before network event is generated, so that conn_mgr
properly generates NET_EVENT_L4_CONNECTED and NET_EVENT_L4_IPV6_CONNECTED
events.

Fixes: 1a5e13a79b ("net: if: Release the interface lock early when
  starting IPv4 ACD")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2025-03-18 08:27:06 +01:00
Marcin Niestroj
3fcd25c8f8 net: ipv4: set NET_ADDR_PREFERRED before network event if !ACD
Set NET_ADDR_PREFERRED before network event is generated, so that conn_mgr
properly generates NET_EVENT_L4_CONNECTED and NET_EVENT_L4_IPV4_CONNECTED
events.

Fixes: 1a5e13a79b ("net: if: Release the interface lock early when
  starting IPv4 ACD")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2025-03-18 08:27:06 +01:00
Emil Gydesen
ee335399c1 Bluetooth: Audio: Use generic count_bits to count bits
Instead of re-implementing or assuming that POPCOUNT is available
we now use the generic function from Zephyr.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-03-17 21:03:56 -04:00
Vinayak Kariappa Chettimada
0a4480ce61 Bluetooth: Controller: Fix connection update interval_us variables
Fix connection update microsecond interval variable data
type, to use 32-bit so that a value upto 2000 seconds, i.e.
4 seconds interval and 499 peripheral latency can be stored.

Regression in commit abfe5f17a9 ("Bluetooth: Controller:
1 ms connection").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-03-17 20:00:42 +01:00
Luca Burelli
959f1b352d llext: support alignment requirements for sections
This patch adds support for alignment requirements for sections in the
loader. The alignment requirements are taken from the ELF file and
checked when the section is mapped to a memory region and when the
region is copied to memory (or directly used from the ELF buffer).

Supporting a larger alignment requirement than the region's current
alignment is done by adjusting the region's start address. This needs
care to avoid detecting false overlaps with other regions and to ensure
that the region address and size reported by the inspection APIs are
correct. The extra offset needed to re-adjust these values is stored in
the 'sh_info' field of the region descriptor.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-03-17 19:58:15 +01:00
Luca Burelli
1b48f74346 llext: avoid redundant 'ldr_parm' checks
Since commit 0aa6b1c9de, the 'ldr_parm' pointer is guaranteed to be
valid inside all the functions of the llext_load() call tree.

This commit fixes the only exception of llext_copy_strings(), which was
not passed the 'ldr_parm' pointer, and remove the redundant checks.

No functional change is intended by this commit.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-03-17 19:58:15 +01:00
Luca Burelli
c0c8f778f7 llext: refactor llext_copy_region()
This commit adjusts the logic of the LLEXT memory allocation routine by:

 * defining 'align' and 'alloc' variables once and updating them in the
   following code;

 * swapping the condition, converting it to an 'if(IS_ENABLED(...))' and
   using a direct calculation for the size to make the code easier to
   read;

 * updating and extending a few comments.

No functional change is intended.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-03-17 19:58:15 +01:00
Luca Burelli
219cde6621 llext: avoid direct llext_string() usage
Since 3466dab804 the generic llext_symbol_name() function abstracts
the use of llext_string() for (non-section) symbols. Define a similar
llext_section_name() function and replace current occurrences of
llext_string() with the proper abstraction.

By extending llext_symbol_name(), this commit also allows to print the
correct name of sections that are referred to by a symbol.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-03-17 19:58:15 +01:00
Luca Burelli
79a9ff0264 llext: (cosmetic) cleaner region overlap checks
Rewrite the overlap checks in llext_map_sections() to use a pair of
macros to calculate the top and bottom of a region. This makes the
code more readable and less error-prone.

No functional change is introduced in this commit apart from a log
message format change.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-03-17 19:58:15 +01:00
Luca Burelli
8f9ab18ce2 llext: (cosmetic) log uniformity cleanups
Use the more compact %#x format for printing out hexadecimal values in
the LLEXT subsystem. This also uses a clearer wording for the
llext_link() log message that avoids repeating information.

No functional change is introduced by this commit.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2025-03-17 19:58:15 +01:00
Luca Burelli
111d7c3754 llext: (cosmetic) rename llext_copy_section() to llext_copy_region()
llext_copy_section() is a misnomer, as it is copying a region of memory,
not a section. Rename it to llext_copy_region() and use 'region' in the
internal variables to better reflect their purpose.

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
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