Commit Graph

19829 Commits

Author SHA1 Message Date
Mahesh Mahadevan d9bfdaf996 bluetooth: kconfig: Remove deprecated config
Remove deprecated Kconfig BT_MESH_PROV_DEVICE

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-11-13 19:08:29 -08:00
Jukka Rissanen 04d8b7c595 net: sockets: Cleanup socket properly if POSIX API is enabled
The sock_obj_core_dealloc() was not called if close() is called
instead of zsock_close(). This happens if POSIX API is enabled.

Fix this by calling zvfs_close() from zsock_close() and then
pass the socket number to zsock_close_ctx() so that the cleanup
can be done properly.

Reported-by: Andreas Ålgård <aal@ixys.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-08 15:56:39 -06:00
Zak Portnoy 32b1140066 mgmt: smp: shell: Respond on uart shell device when changed at runtime
Responses are currently set to the shell device that was configured
in the device tree.

The shell_uart driver allows for changing it's device during runtime
which leads to a situation where we recieve packets on one device
and respond on another.

This patch causes smp_shell_tx_raw to use the shell_uart device

Signed-off-by: Zak Portnoy <zakportnoy@gmail.com>
2024-11-08 13:57:09 -06:00
Jukka Rissanen fe56ce5a1c net: ipv6: fragmentation: Drop the packet if fragmentation fails
If we could not fragment the IPv6 packet, then drop it and do
not try to send it. Let the upper layer re-send the packet if
needed. It is causing more trouble if we try to send the packet
and not honor the MTU setting.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-08 11:37:49 -06:00
Jukka Rissanen 414316379a net: ipv4: fragmentation: Drop the packet if fragmentation fails
If we could not fragment the IPv4 packet, then drop it and do
not try to send it. Let the upper layer re-send the packet if
needed. It is causing more trouble if we try to send the packet
and not honor the MTU setting.

Fixes #81021

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-08 11:37:49 -06:00
Marcus Penate 72534b83e4 net: lib: sntp_simple: Handle responses from previous iterations
SNTP simple runs request iterations with exponential backoff.
If the net interface is a slower connection (ie. CAT M1 modems)
then the request will be sent but the response may take time to
be received, thus causing a timeout and another request to be sent.
Because of the nature of UDP and the fact that the same socket
(source IP/port combo) is being used for both requests, a delayed
response to the first request can be received as the response to the
second request, causing -EINVAL to be returned when the timestamps
mismatch (see subsys/net/lib/sntp/sntp.c). The solution provided
retries receiving the response when the timestamp is mismatched
(without sending an additional request).

Signed-off-by: Marcus Penate <marcus.penate@ellenbytech.com>
2024-11-08 11:37:02 -06:00
Håvard Reierstad 42ae483795 Bluetooth: Host: Ensure only connected peers affect `_bt_gatt_ccc.value`
The doc on `_bt_gatt_ccc.value` specifies that only connected peers
contribute to that value. But before this change, it was computed from
all entries in `_bt_gatt_ccc.cfg`, which include bonded but not
connected peers when `CONFIG_BT_SETTINGS_CCC_LAZY_LOADING` is set.

Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-11-08 11:35:42 -06:00
Emil Gydesen 7c40b071e4 Bluetooth: CSIP: Fix off-by-one in in lock restore
If the lock request was rejected by a set member we should
restore any previously written logs in reverse order.

However there was a off-by-one error in
csip_set_coordinator_write_lock_cb which caused us to attempt to
release member[1] instead of member[0] if member[1] was the
one that rejected the lock request.

Additionally, the lock_set_complete would be called
prematurely before we get the response from the restore
request.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-08 09:24:43 -06:00
Hui Bai 67980643d7 net: wifi: Fix 11k command errors
Add condition check so that the 11k flag will be updated for set
operation only.
Fix print log error when getting 11k status.

Signed-off-by: Hui Bai <hui.bai@nxp.com>
2024-11-07 18:42:15 -08:00
Chaitanya Tata fd7fc17810 net: wifi: Fix strings for missing enumerations
Enumerations were extended but respective strings were not added.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-11-07 18:41:53 -08:00
Chris Desjardins 862af5e903 fs: Fix null pointer exception caused by async fs_unmount
The mp pointer is in fs_file_t and fs_dir_t so if the fs pointer is made
NULL then subsequent file I/O operations will cause a NULL pointer
exception. Removing the mount point from the list is threadsafe and
should be sufficient.

Signed-off-by: Chris Desjardins <chris@arch-embedded.com>
2024-11-07 18:06:58 -06:00
Emil Gydesen 6c79fdf2ca Bluetooth: BAP: Fix bad state check for broadcast sink
The state check used != instead of == to very that it entered
the streaming state for all streams.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-07 18:04:34 -06:00
Jun Lin 69e85b25fe board: npcx: remove CONFIG_PINCTRL from defconfig of npcx boards
The CONFIG_PINCTRL is removed from the board's defconfig files.
Drivers which use pin control function should add "select PINCTRL"
in their Kconfig files.

Fixes #78619

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2024-11-07 08:59:14 -08:00
Henrik Skreslet e254a7f3c8 modem: cmux: added validation of cmux frame length
Validates cmux frame length and drops it if its larger
than the receive buffer

Signed-off-by: Henrik Skreslet <henrik.skreslet@gmail.com>
2024-11-07 08:31:48 -06:00
Emil Gydesen 1f1e4afa4f Bluetooth: CSIP: Handle disconnects while in procedure
If a device disconnects while we are in a procedure then
get_next_active_instance would return a service instance pointer
with the `conn` set to NULL.

The issue was caused by the set_info being potentially memset
when the device that disconnected was the one that held the
set_info pointer.
The solution is to not use a pointer, but rather a copy of the
set_info, so that the active.set_info value is still valid
after a disconnect.

Since the set_info is not longer a pointer to a specific
set_info from one of the members, the logs have been updated
as well, as the pointer of the active.set_info is useless
for debugging.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-06 14:42:51 -06:00
Robin Kastberg 5d52e39a52 random: random_timer.c Remove __GNUC__ ifdef
Remove an old __GNUC__ ifdef

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
2024-11-06 10:11:58 -08:00
Ryan McClelland 952daca695 debug: symtab: fix ignored type qualifiers on func return type
const is ignored on the function return type. A warning is reported with
-Wignored-qualifers. Remove the ignored const.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-11-06 09:52:36 -08:00
Daniel DeGrasse 07a8e3253a drivers: disk: mmc_subsys: remove CONFIG_MMC_VOLUME_NAME
Remove CONFIG_MMC_VOLUME_NAME, and set the disk name based on the
``disk-name`` property. This aligns with other disk drivers, and allows
for multiple instances of the mmc_subsys disk driver to be registered.

Add disk-name properties for all in tree definitions for the
mmc-subsys disk driver, and change all in tree usage of the disk name

Fixes #75004

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-11-05 15:25:10 -06:00
Daniel DeGrasse a1dc0b8b3e drivers: disk: sdmmc_subsys: remove CONFIG_SDMMC_VOLUME_NAME
Remove CONFIG_SDMMC_VOLUME_NAME, and set the disk name based on the
``disk-name`` property. This aligns with other disk drivers, and allows
for multiple instances of the sdmmc_subsys disk driver to be registered.

Add disk-name properties for all in tree definitions for the
sdmmc-subsys disk driver, and change all in tree usage of the disk name

Fixes #75004

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-11-05 15:25:10 -06:00
Lingao Meng b9fbfc9a23 Bluetooth: Mesh: Introduce separate workq for ADV EXT
this PR is to make the host always send packets.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2024-11-05 15:24:31 -06:00
Pavel Vasilyev 4c5c434ea2 bluetooth: mesh: adv: legacy: Check suspended flag in the adv thread
Instead of checking the `enabled` flag, check if BT_MESH_SUSPENDED is
set in the legacy advertiser thread. BT_MESH_SUSPENDED is set earlier
than advertiser is stopped and will prevent the advertiser send anything
earlier.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-11-05 13:44:51 -06:00
Vinayak Kariappa Chettimada db967209ca Bluetooth: Controller: Fix spurious ISO Sync receiver stall
Fix spurious ISO Sync Receiver stall due to uninitialised
value accessed due to regression introduced by
commit 64faceea72 ("Bluetooth: controller: Stop Sync ISO
ticker when establishment fails").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-11-05 13:44:37 -06:00
Valerio Setti 7f5574817f jwt: remove TinyCrypt usage
As part of TinyCrypt deprecation process (#79566) this commit
removes usage of this library from the JWT subsystem and its
related tests.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-05 13:44:20 -06:00
Valerio Setti 3d45ee7cb7 random: remove TinyCrypt usage
Following the deprecation of TinyCrypt (#79566) we remove
TinyCrypt usage in random generators. This basically only affects
the CTR-DRBG random generator which from now only will only make
use of Mbed TLS.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-05 13:44:20 -06:00
Bjarki Arge Andreasen 145d04101d pm: policy: fix pm_policy_event_register arg
The pm_policy_event_register() API takes absolute cycles as the
second arg, like pm_policy_event_update(), but the arg is renamed
time_us and treated as a relative time in us rather than abs
cycles.

Fix implementation of pm_policy_event_register() to treat cycles
like pm_policy_event_update() and API docs suggest.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2024-11-05 10:54:41 -06:00
Jukka Rissanen 3e1e2ea8ec net: wifi: mgmt: Use memcpy instead of strncpy
Using strncpy gives this warning

warning: 'strncpy' output may be truncated copying 32 bytes from
  a string of length 32 [-Wstringop-truncation]

 strncpy(roaming_params.neighbor_rep.neighbor_ap[idx].bssid_info,
         bssid_info,
         sizeof(roaming_params.neighbor_rep.neighbor_ap->bssid_info));

There is '\0' at the end of the allocated buffer so we can safely
use memcpy() here to avoid any warnings.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-05 10:52:29 -06:00
Jukka Rissanen 0a75809a8e net: wifi: mgmt: Check string length in sscanf
Make sure we are not able to overwrite string variables in sscanf
call. Allocate also one extra byte for null terminator character.

Fixes #80644

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-05 10:52:29 -06:00
Jukka Rissanen ec18ab1eda net: dns: Convert the query and answer to small case letters
Because we might get answers in capital letters, convert the answer
to small case letters and also make sure we send query in small case
latters. This makes sure that our query_hash is properly calculated
regardless of how the resolver gets the data.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-04 13:41:17 -06:00
Jukka Rissanen adeb28d147 net: dhcpv4: Fix DNS server list allocation
Allocate one extra pointer for the DNS server list so that
DNS resolving code can detect the end of the list.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-04 13:40:56 -06:00
Yong Cong Sin a5555ab077 testsuite: coverage: fix typo in the CMakeLists.txt
`zephyr_BASE` should have been `ZEPHYR_BASE`, fix it.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-11-01 13:54:14 -05:00
Johan Hedberg d1a3f4f4fe Bluetooth: Host: Fix monitor UART selection
Most boards set zephyr,bt-mon-uart to point at the same device as
zephyr,console. It's still useful to have the possibility of having these
as two different devices, however it's useful to fall back to the UART
console in case a dedicated monitor UART hasn't been specified.

This also ensures that the fallback only happens if the console UART isn't
enabled, but a DT chosen property exists for it. Additionally, we now get a
user friendly error in case the Bluetooth UART monitor feature has been
enabled in Kconfig but there isn't a suitable UART available for it in
devicetree.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-11-01 09:56:52 -05:00
Håvard Reierstad 0b88078b28 Bluetooth: host: Fix unsafe cast in is_subscribed
The current implementation casts the user data to the attribute value,
which makes an assumption about the user data. This commit changes the
implementation to use the attribute value read function when extracting
the characteristic properties.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-11-01 09:55:25 -05:00
Seppo Takalo 1e5a537ade net: lib: coap_client: Remove unnecessary atomic variable
In receiving thread, continuing the loops is based on
has_ongoing_exchanges() so it does not need atomic
coap_client_recv_active variable.

When idling, it wakes from semaphore. But there was potential
deadlock when coap_client_schedule_poll() would not signal the
semaphore, if atomic variable was already showing that it runs.
Removing the atomic variable removes this deadlock.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-31 14:17:58 -05:00
Seppo Takalo 350d20e027 net: lib: coap_client: Send RST for unknown queries
When receiving unknown response, respond with CoAP Reset.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-31 14:17:58 -05:00
Seppo Takalo 1dc24872ce net: lib: coap_client: Remove duplicate token comparison
Response tokens are already compared in get_request_with_token().

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-31 14:17:58 -05:00
Seppo Takalo e96e95b6f6 net: coap: Add API to send reset message
Add helper API to construct CoAP Reset message.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-31 14:17:58 -05:00
Seppo Takalo 1890dbd637 net: lib: coap_client: Fix reset handling
Fix handling of received CoAP reset.


Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-31 14:17:58 -05:00
Seppo Takalo a14f083030 net: lib: coap_client: Use reset_internal_request() instead of flagging
It is error prone to flag separate booleans, so try to use
reset_internal_request() every time we release the internal request
structure.

Also refactor the reset_internal_request() so that we reset the
timeout value so it does not trigger again.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-31 14:17:58 -05:00
Seppo Takalo 623a1ffd52 net: lib: coap_client: Don't decrease retry counter on send() failure
If send() fails, we have not technically send the CoAP retry yet, so
restore the same pending structure, so our timeouts and retry counters
stay the same.

This will trigger a retry next time the poll() return POLLOUT, so we
know that we can send.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-31 14:17:58 -05:00
Seppo Takalo 6481b0ec6c net: lib: coap_client: Forward recv() errors to handling loop
Forward recv() errors to handle_poll(), so there is only one place to
handle error codes.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-31 14:17:58 -05:00
Seppo Takalo 4c6dd4c7b7 net: lib: coap_client: check poll() condition before retrying CoAP msg
Refactor the CoAP retry handling into the handle_poll() function,
so that we only try to send retries if the socket reports POLLOUT.

Also move the receiving into same loop, so when poll() reports POLLIN
we recv() the message and handle it before proceeding to other sockets.

Also fix tests to handle POLLOUT flag and add support for testing
multiple clients.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-31 14:17:58 -05:00
Seppo Takalo 46b7c84512 net: lib: coap_client: Release internal request when failed to send
When transmission of first request fails, reset the internal request
buffer as there is no ongoing CoAP transaction.

Application can deal with the failure.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-31 14:17:58 -05:00
Seppo Takalo 1ea569d776 net: lib: coap_client: Protect initialization with mutex
Protect global list of clients with mutex.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-31 14:17:58 -05:00
Fengming Ye 91d9cc259d net: wifi: shell: add 80211R usage in connect command
Add 80211R fast BSS transition argument usage in connect command.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-10-31 09:23:48 -05:00
Andreas Huber 075d5d3009 net: mqtt: Fix missing close function
If POSIX_API is not configured the close function is not available.
Use zsock_close instead.

Signed-off-by: Andreas Huber <andreas.huber@ch.sauter-bc.com>
2024-10-31 09:22:44 -05:00
Jacob McClellan 39042dc9cc logging: Initialize 'chosen' pointer in z_log_msg_claim_oldest to NULL
Fixes a compiler warning 'chosen' may be uninitialized when later
dereferenced

Signed-off-by: Jacob McClellan <mcclellanjacob@meta.com>
2024-10-30 14:28:52 -05:00
Jeroen Broersen f889c1abab net: lwm2m: Add TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 to cipher list
Add TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 to the list for use with x509
certificates. The LWM2M v1.1 specification says that a LWM2M client
which used X509 certificates must support this ciphersuite and
additional ciphersuites may be supported.

Signed-off-by: Jeroen Broersen <jbroersen@interact.nl>
2024-10-30 14:27:40 -05:00
Gerson Fernando Budke b46e176704 mgmt: mcumgr: stat: Fix stat_mgmt_list behavior
The MCUmgr statistics only work correctly when selecting
MCUMGR_SMP_LEGACY_RC_BEHAVIOUR option. Checks the option
flag on the stat_mgmt_list and fix the behavior.

Fixes: 80476

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2024-10-30 08:55:23 -05:00
Alberto Escolar Piedras 2af45d1d78 subsys/bluetooth/host/keys.h: Add include guard and required include
This header requires bluetooth.h but was not including it itself.
Due to this we had 2 tests failing to build.
Let's just include the dependencies to this header instead of
relaying on users including the dependencies dependencies in
the right order.

Also, let's add an include guard as in a test this header was
included twice leading to weird build errors.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-10-29 09:24:13 -07:00
Andreas Huber 27d93f8b6c net: ipv4: Fix ARP probe check in address conflict detection
The second condition needs to check ARP probes only

The ACD is not properly implemented as described in RFC5227 ch. 2.1.1
The implementation incorrectly detects an IP conflict, if an ARP request
is received for the target IP.
The reason is that the current implementation checks for ARP requests
instead of ARP probes.

Signed-off-by: Andreas Huber <andreas.huber@ch.sauter-bc.com>
2024-10-29 07:07:59 -05:00