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