Commit graph

21541 commits

Author SHA1 Message Date
Shrek Wang
20489a1f18 net: tcp: Fix TCP reset issue
According to RFC793 chapter3.5 with the 'Reset Processing' part,
"In the SYN-SENT state (a RST received in response to an initial
SYN), the RST is acceptable if the ACK field acknowledges the SYN."
So, in the net_tcp_reply_rst() we should use 'ack++' if no ACK
flag but have SYN flag.
And, all the RST packet should use net_tcp_reply_rst() instead of
tcp_out().

Signed-off-by: Shrek Wang <inet_eman@outlook.com>
2025-05-21 08:01:55 +02:00
Aleksandr Khromykh
9e0c6d5d96 bluetooth: mesh: fix buffer leakage if mesh was suspended
Commit fixes bug when advertisements were disabled and stopped
during suspending without unreferencing allocated advertisements.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2025-05-20 15:25:06 +02:00
Xudong Zheng
151ca3a31f fs: littlefs: define default disk version in Kconfig
This makes it possible to set the disk version when Devicetree is not
used for configuration.

Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2025-05-20 15:24:00 +02:00
Babak Arisian
021c96dcad Bluetooth: controller: Correct validation for CONNECT_IND interval
Previously, the interval was only checked for non-zero. Now it is
validated to be within the allowed range (BT_HCI_LE_INTERVAL_MIN
to BT_HCI_LE_INTERVAL_MAX) to avoid invalid values.

Signed-off-by: Babak Arisian <bbaa@demant.com>
2025-05-20 09:17:07 +02:00
Vinayak Kariappa Chettimada
920117922b Bluetooth: Controller: nRF53x: Fix NRF_CCM MAXPACKETSIZE value
Fix NRF_CCM MAXPACKETSIZE value to mitigate Bus Faults.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-05-19 21:55:04 +02:00
Vinayak Kariappa Chettimada
20576597df Bluetooth: Controller: nRF54Lx: Fix MDATA length to avoid MIC failures
Fix MDATA length with extra bytes to mitigate MIC failures.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-05-19 21:55:04 +02:00
Vinayak Kariappa Chettimada
d720032a43 Bluetooth: Controller: Fix assertion establishing Peripheral ISO
Fix assertion observed establishing subsequent Peripheral
ISO connection due to a race between the new CIS context
being acquired into a CIG and LLL getting a CIS sorted by
CIS offset in that CIG. Get only active CISes from the CIG
in the LLL prepare.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-05-19 21:55:04 +02:00
Vinayak Kariappa Chettimada
0ef1d98ec8 Bluetooth: Controller: Fix max tx octets value used
Fix max tx octets value used as given to the Host by the
LE Read Buffer Size command response.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-05-19 21:55:04 +02:00
Vinayak Kariappa Chettimada
33a8a33d79 Bluetooth: Controller: Fix redundant ISO Rx size in ACL Rx
Fix missing removal of redundant ISO Rx size in ACL Rx PDU
allocation size.

Related to commit 7c89f1fe9f ("Bluetooth: controller:
Support for separate ISO RX data path").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-05-19 21:55:04 +02:00
Robert Lubos
011f2bc458 net: conn_mgr: Fix disconnect with CONN_MGR_IF_NO_AUTO_DOWN unset
Connection manager enforces non-blocking disconnect() behavior, yet in
case CONN_MGR_IF_NO_AUTO_DOWN flag is not set, it'd put the interface
down right after, disrupting the disconnect process.

As putting the interface down can be handled in the corresponding event
handler as well, when the interface is actually disconnected, remove the
conn_mgr_conn_if_auto_admin_down() call from conn_mgr_if_disconnect().
To make this work with persistence flag, introduce a new internal flag
indicating that the interface is in active disconnect.

Finally, since it isn't really necessary that disconnect() API call is
non-blocking, remove that requirement.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-19 16:37:07 +02:00
Damian Krolik
82b802f9ab net: lib: zperf: fix compilation with UDP/TCP only
Fix regression introduced by #88747 that breaks linking
with zperf server enabled but TCP or UDP disabled.

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2025-05-19 11:24:58 +02:00
Anas Nashif
2aacbcaab5 style: add missing curly braces in if/while/for statements.
Add missing curly braces in if/while/for statements.

This is a style guideline we have that was not enforced in CI. All
issues fixed here were detected by sonarqube SCA.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-17 14:10:33 +02:00
Ping Wang
355a5525bc Bluetooth: Audio: fix BIS_Sync_State for BASS server
BASS server need to notify that both BIS and PA are no longer synced by
setting all required fields to 0 after client stops BIS by sending a
BIG control PDU with a BIG TERMINATED indication.

meanwhile BIG_Encryption in the notification should also be reset to be
BT_BAP_BIG_ENC_STATE_NO_ENC when BIS is not synced anymore.

Signed-off-by: Ping Wang <pinw@demant.com>
2025-05-16 17:32:28 +02:00
Lars Segerlund
ffe52da2f0 bluetooth: Controller: Set sdu_max fixing ISO test mode sdu_max
For ISO test mode sdu_max to work it actually has to be set somewhere
and this does that.

Signed-off-by: Lars Segerlund <lrsu@demant.com>
2025-05-16 16:11:41 +02:00
Vinayak Kariappa Chettimada
2fc54ae3bb Bluetooth: Controller: Fix nRF CCM disable on connection event abort
Fix missing nRF CCM disable on connection event abort.

There can be a problem on nRF SoC for example when a S8
"encrypted" reception is aborted, and a 2M "cleartext"
reception starts; slow CCM (that is not stopped as part of
radio disable) will corrupt a fast received "cleartext" when
the same current free rx buffer is reused in the Controller.
This is not a problem when the connection being abort-ee is
on a faster PHY than the abort-er.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-05-16 12:36:43 +02:00
Alex Apostolu
6e34acc4e2 Bluetooth: Host: Use macro for nanoseconds per second
Use the macro NSEC_PER_SEC defined in sys_clock.h for nanoseconds per
second when updating write stats.

Signed-off-by: Alex Apostolu <apostolu240@gmail.com>
2025-05-16 09:38:47 +02:00
Rodrigo Peixoto
6ae9a981d0 zbus: Improve consistency with runtime observers
A previous PR merged (to remove runtime observers' dependency with heap)
added inconsistencies and compatibility breaks to the zbus. This commit
improves that by removing the inconsistencies and still attending to the
features requested by the community.

Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
2025-05-16 09:37:20 +02:00
Anas Nashif
e48c90700d doc: remove more occurances of Nios II
Remove all occurances of Nios II from docs and code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-15 20:01:05 -04:00
Anas Nashif
5fe84d5b69 arch: nios2: remove arch
Remove architecture and dependencies.
Remove altera HAL supporting nios2

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-15 20:01:05 -04:00
Benjamin Cabé
f14ea32ebc settings: replace [[maybe_unused]] by __maybe_unused
[[maybe_unused]] is a C23 construct so fallback to Zephyr's
__maybe_unused

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-05-15 22:13:49 +02:00
Riadh Ghaddab
457ade48b4 settings: zms: code style clean up
Clean some parts of the code and refactor it to avoid multiple nested
conditions.

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2025-05-15 17:53:26 +02:00
Riadh Ghaddab
7ae14ebf58 settings: zms: use the safe function strnlen instead of strlen
if the provided name in argument is not null this could lead to un
undefined behavior.
Use strnlen to make this safe

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2025-05-15 17:53:26 +02:00
Riadh Ghaddab
cad2f1c103 settings: add new API function settings_get_val_len()
Add a function to get the value's length of a Key. If it doesn't exist
returns 0.
Add ZMS implementation for csi_get_val_len() and a default implementation
for the other storage systems.
Add some functional tests to verify it.

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2025-05-15 17:53:26 +02:00
Riadh Ghaddab
6279943831 settings: zms: recover linked list if broken
When the linked list is broken, recover it instead of reinitializing it.

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2025-05-15 17:53:26 +02:00
Riadh Ghaddab
5a978f4ab4 settings: zms: add more robustness to the save function
When a power off happens after writing the settings name and before
writing the linked list node we cannot write the settings name again in
the future.
Fix this by writing the linked list node before writing the name.
When loading all settings, we already delete linked list node that do
not have any name or value written.
Adds as well a recover path if a power down happens in the middle of
unlinking an LL node after a delete.

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2025-05-15 17:53:26 +02:00
Riadh Ghaddab
831da04247 settings: add an API function to load only one settings entry
Add a a function settings_load_one that allows to load only one settings
entry instead of a complete subtree.
Add as well its implementation for ZMS backend.
This will allow a faster return if the Settings entry doesn't exist in
the persistent storage.

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2025-05-15 17:53:26 +02:00
Riadh Ghaddab
bf20b78543 settings: zms: add cache for linked list hash
Increase the load performance by adding an optional cache for the linked
list hashes.
This is used only when the settings_load is called with NULL parameter
and we need to load all Settings that exist in the persistent storage.
Cache is enabled using SETTINGS_ZMS_LL_CACHE and the size of the cache
is set using SETTINGS_ZMS_LL_CACHE_SIZE.
Each cache entry will add 8 bytes of RAM usage.

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2025-05-15 17:53:26 +02:00
Riadh Ghaddab
ae461510a7 settings: zms: load only subtree in the argument
If the subtree argument is not NULL in the settings_load function, load
only the setting entry that corresponds to that subtree.
If the subtree argument is NULL or it is not found in the storage, load
all the existing entries in the storage.

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2025-05-15 17:53:26 +02:00
Riadh Ghaddab
5c38c58f0c zms: optimize cache for settings subsystem
Settings subsystem is storing the name ID and the linked list node ID
with only one bit difference at BIT(0).
Settings subsystem is also storing the name ID and the data ID in two
different ZMS entries at an exact offset of ZMS_DATA_ID_OFFSET.
Using the regular lookup function could result in many cache misses.

Therefore, to assure the least number of collisions in the lookup cache,
the BIT(0) of the hash indicates whether the given ZMS ID represents a
linked list entry or not, the BIT(1) indicates whether the ZMS ID is a
name or data and the remaining bits of the hash are set to a truncated
part of the original hash generated by Settings.

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2025-05-15 17:53:26 +02:00
Riadh Ghaddab
42b9b5a9d7 zms: remove non needed lookup cache before writing
When the CONFIG_ZMS_NO_DOUBLE_WRITE is not enabled there is no need to
search in the cache for matching ID

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2025-05-15 17:53:26 +02:00
Riadh Ghaddab
c0a75da084 settings: zms: add option to disable updating linked list
When deleting a settings entry the linked list is updated by removing
the deleted node. This operation is time consuming and add some delays.
For applications that use almost the same set of Setting entries, add an
option to make this operation faster at a cost of having some empty
nodes in the linked list.
These empty nodes can be used later when the deleted entry is written
again.
Each empty node occupies 16B of storage.

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2025-05-15 17:53:26 +02:00
Shrek Wang
6ee55e4211 net: tcp: Remove NULL-pkt support for tcp_in()
The NULL-pkt parameter for tcp_in() was designed for generating
a SYN packet to start the 1st TCP handshake. It is only used
in net_tcp_connect() and tp_input().
To simplify the tcp_in() code logic and make it better under-
standable, a tcp_start_handshake() is added for net_tcp_connect()
and tp_input() to use. Thus, the tcp_in() only handles the in-
coming TCP packets.

Signed-off-by: Shrek Wang <inet_eman@outlook.com>
2025-05-15 16:17:18 +02:00
Vinayak Kariappa Chettimada
bebf59f9a0 Bluetooth: Controller: Fix MIC failure when 2 CISes in Peripheral
Fix MIC failure when 2 or more CISes in Peripheral is active
and any CIS before the last CIS does not have reception that
lead to the event count and payload count being incorrect.
Add the missing flush implementation when switching between
CISes in the CIG event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-05-15 16:16:59 +02:00
Jamie McCrae
7619592bdd mgmt: mcumgr: grp: img_mgmt: Fix wrong alignment
Fixes a line that was wrongly aligned

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-05-15 14:09:55 +02:00
Jamie McCrae
e249596faf mgmt: mcumgr: grp: img_mgmt: Add support for firmware loader mode
Adds support for using img mgmt in firmware loader mode, to allow
for loading an update image to a device

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-05-15 14:09:55 +02:00
Tomasz Leman
750821547a pm: Return false if pm_state_force fails to set state
Ensure `pm_state_force` returns `false` when it fails to retrieve or set
the desired power state. This change improves error handling and ensures
the function's behavior aligns with its intended purpose.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2025-05-15 14:09:46 +02:00
Chris Friedt
393446108e samples: net: lwm2m: depend on xsi single process for gettimeofday()
https://github.com/zephyrproject-rtos/zephyr/actions/runs/\
15014534061/job/42189411225

We were seeing a linker error of the form

```
picolibc/x86_64-zephyr-elf/lib/32/libc.a(libc_time_time.c.o): \
  in function `time':
time.c:(.text.time+0x11): undefined reference to `gettimeofday'
```

Update the dependency from CONFIG_POSIX_TIMERS to
CONFIG_XSI_SINGLE_PROCESS for gettimeofday().

Note: this is really only a workaround. The proper solution would
be to have libc functions not depend on POSIX functions.

Specifically, here

https://github.com/zephyrproject-rtos/picolibc/blob/\
51a8b32857e75345c37652a80b5cda98b28d69e5/newlib/libc/time/\
time.c#L54

and here

https://github.com/zephyrproject-rtos/zephyr/blob/\
3a4e12899c2ae5962a64055f4739f774fb7262e5/lib/libc/common/\
source/time/time.c#L17

Also mentioned in #89068

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-05-15 09:04:08 +02:00
Lyle Zhu
0b0cfd5ec7 Bluetooth: Classic: SSP: Correct pairing method
In current implementation, if the MITM flag of both sides is disabled,
the pairing method is incorrect.

Such as, the IOCAP of both sides is `display_yesorno`, the pairing
method is `PASSKEY_CONFIRM`. But actually, it should be `JUST_WORKS`
in this case.

Fix the issue by setting the pairing method to `JUST_WORKS` if the
MITM flag of both sides is false.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2025-05-14 19:36:17 +02:00
Emil Gydesen
6887b58d4e Bluetooth: ISO: Remove BT_ISO_TX_FRAG_COUNT
The Kconfig option has not been in use for anything for
a long time, and can safely be removed.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-05-14 16:28:42 +02:00
Anas Nashif
1938403854 debug: define thread_info offset for RX
Handling for RX architecture.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-14 14:16:03 +02:00
Aleksander Wasaznik
0e138cb777 Bluetooth: Host: K_NO_WAIT in bt_att_req_alloc() in SYS WQ
This commit prevents ATT request APIs from blocking waiting on the
req_slab pool on the system work queue. The API will instead return
-ENOMEM.

This aligns with commit 05b16b971b, which
establishes that the GATT request APIs are non-blocking on the system
work queue. That commit makes GATT request APIs fail with -ENOMEM when
they fail to allocate a buffer for the ATT PDU on the system work queue.

There is no reason to make this distinction between the two resources,
and this makes the API more consistent.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2025-05-14 14:15:58 +02:00
Nithin Ramesh Myliattil
70a97a8222 Bluetooth: BAP: Add control point cbs to BASS
For the control point operations, add/modify/
remove source, callbacks are added so that Application
can decide whether to accept/reject the control point
operations.

Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
2025-05-14 14:15:51 +02:00
Jordan Yates
0f1d7d3b59 net: dns: dispatcher: fix OOB array access
Validate that the file descriptor is not a negative number before
writing to the `dispatch_table` `ctx` field. Setting file descriptors
to `-1` is the standard "not in use" value, and in fact the entire array
of `fds` is set to this value in `dns_resolve_init_locked`. This
resolves memory corruption of whichever variable is unfortunate to exist
just before `dispatch_table` in memory.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-05-14 14:11:11 +02:00
Robert Lubos
e1d77710b7 net: mqtt-sn: Correct the allowed Keep Alive value range
Keep Alive timeout is represented by 2-byte unsigned integer, however
the corresponding Kconfig option was limited to UINT8_MAX only.
Also, similarly to regular MQTT, allow to disable the Keep Alive
functionality by specifying the Keep Alive value to 0.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-14 14:10:34 +02:00
Markus Lassila
93c3975fe6 net: l2: ppp: Terminate connection with dormant
When PPP net_if is changed to dormant, the PPP connection
is terminated asynchronously. This is used so that the driver
can terminate the PPP connection gracefully.

Note: net_if_down() is not used as it would require synchronous
operation which would block the system workqueue thus causing
deadlock.

Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
2025-05-14 14:10:21 +02:00
Pavel Vasilyev
971c2c9426 Revert "Bluetooth: host: extract sending of host num complete"
This reverts commit 32212bfb63.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-05-14 11:03:02 +01:00
Pavel Vasilyev
da9acbcf11 Revert "Bluetooth: host: Send host num completes as early as possible"
This reverts commit 147ee3daaf.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2025-05-14 11:03:02 +01:00
Tomi Fontanilles
35f7eda545 modules: mbedtls: make key exchange Kconfigs depend on, not select
Turn the MBEDTLS_RSA_FULL selects into depends on.
This is how the other MBEDTLS_KEY_EXCHANGE_* Kconfig options are defined.

This is done to avoid circular dependencies.

At the same time update uses of the affected MBEDTLS_KEY_EXCHANGE_*
Kconfig options to enable/disable the dependencies which used to be
automatically handled.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2025-05-13 22:22:43 -04:00
Robert Lubos
be46c94e3e net: l2: openthread: Fix error logs on adding already present address
Error checking of otIp6AddUnicastAddress() and
otIp6SubscribeMulticastAddress() was added recently, however it wasn't
taken into account that those APIs return an error on attempt to
register an IPv6 address that is already present on the OT interface.
Therefore, add more specific error checks, to return silently in case
address was already present.

As those two APIs are not very consistent, and otIp6AddUnicastAddress()
returns OT_ERROR_INVALID_ARGS in such cases, add an extra check if the
address is already present before attempting to register the address.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-13 16:23:37 +02:00
Timothy Keys
cc9279e3ce Bluetooth: Controller: Only select BT_TICKER_LAZY_GET for ZLL
BT_TICKER_LAZY_GET is a ZLL only kconfig and should not be selected for
other controllers.

Signed-off-by: Timothy Keys <timothy.keys@nordicsemi.no>
2025-05-13 16:22:43 +02:00