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