Commit Graph

19802 Commits

Author SHA1 Message Date
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
Riadh Ghaddab 46e1635773 fs: zms: multiple fixes from previous PR review
This resolves some addressed comments in this PR
https://github.com/zephyrproject-rtos/zephyr/pull/77930

It adds as well a section in the documentation about some
recommendations to increase ZMS performance.

Signed-off-by: Riadh Ghaddab <rghaddab@baylibre.com>
2024-10-29 07:07:13 -05:00
Flavio Ceolin ea0a211d6f net: http_server: Fix possible buffer underrun
Avoid possible underruns when an url is shorter than a handled
extension.

Signed-off-by: Flavio Ceolin <flavio.ceolin@gmail.com>
2024-10-29 07:06:50 -05:00
Vinayak Kariappa Chettimada 9a8b1b1d72 Bluetooth: Controller: Fix compile error when BT_CTLR_PRIVACY disabled
Fix compile error when BT_CTLR_PRIVACY is disabled. Compile
error seen building hci_uart sample for nrf54l15dk.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-10-27 20:26:35 +00:00
Vinayak Kariappa Chettimada 742ffd5b16 Bluetooth: Controller: Fix compile error missing lll_df_types include
Fix compile error due to missing lll_df_types include.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-10-27 20:26:35 +00:00
Vinayak Kariappa Chettimada 906ae3591c Bluetooth: Controller: Fix ISO Sync Receiver BIS payload dereferencing
Fix incorrect use of BIS indices to dereference the payload
array, instead correctly use synchronised stream indices.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-10-27 20:26:35 +00:00
Aleksander Wasaznik 5f89a6b8f1 Bluetooth: Host: Add BT_TESTING trace event for ACL pool destroy
This is needed for a test to catch a double-free.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-10-26 17:13:45 +02:00
Aleksander Wasaznik 70ad45d4d9 Bluetooth: Host: Upgrade log severity for L2CAP user error
For ease of development, we should log the event as an error.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-10-26 17:13:45 +02:00
Aleksander Wasaznik 200de7c00a Bluetooth: Host: Fix `bt_l2cap_chan_ops.recv` `-EINPROGRESS`
Fix discrepancy in reference management between calls to
`bt_l2cap_chan_ops.recv` when the application returns `-EINPROGRESS`.

There are two call sites, `l2cap_chan_le_recv_sdu` and
`l2cap_chan_le_recv`, that were inconsistent.

`l2cap_chan_le_recv_sdu` moves the reference, and this patch updates
`l2cap_chan_le_recv` to do the same.

This behavior is also now documented.

This bug has existed since the introduction of this feature in
3151d26572.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-10-26 17:13:45 +02:00
Andries Kruithof f268bfa419 Bluetooth: Audio: shell command for broadcast reception stop
Implement the shell command for the CAP procedure
'broadcast reception stop'

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-10-26 03:59:04 +01:00
Reto Schneider f64747b792 bluetooth: shell: Fix includes
This allows to build the shell with BT_CTLR_DTM and/or BT_CTLR_ADV_EXT
enabled.

The issues has been introduced by commit
bf897cf941 (Bluetooth: Shell: Restructure
shell files).

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-10-26 03:55:41 +01:00
Benjamin Lindqvist f8a7035c0a net: coap_client: signal socket error to user
Before this patch, any unexpected socket error during poll (caused by
LTE disconnects for instance) would lead to a infinite loop because the
error state was never cleared, handled or even signaled to the user.

Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
2024-10-26 03:55:20 +01:00
Phil Hindman 09574e68eb fs: littlefs: Gracefully fail when static buffers are too small
The cache_size and lookahead_size are set at compile time using the
CONFIG_FS_LITTLEFS_CACHE_SIZE and CONFIG_FS_LITTLEFS_LOOKAHEAD_SIZE values
from Kconfig, or from the cache-size and lookahead-size properties in a
'zephyr,fstab,littlefs' compatible in the devicetree.  Those values are
also used to statically allocate buffers that are pointed at by the
read_buffer, prog_buffer, and lookahead_buffer members of the lfs_config
structure.

At runtime, when using a block device, the cache_size and lookahead_size
are updated to be multiples of the underlying block device's block_size,
which may make them bigger than the original size used to allocate the
static buffers. Log an error and fail the operation when this occurs.

Signed-off-by: Phil Hindman <phindman@xes-inc.com>
2024-10-25 22:45:55 +01:00
Dominik Ermel 87ce37f7c4 storage/stream_flash: Make context const where not modified
The commit sets const qualifier struct stream_flash_ctx *ctx parameter
of Stream Flash API calls:
  stream_flash_bytes_written
  stream_flash_progress_save
  stream_flash_progress_clear

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-10-25 22:45:33 +01:00
Dominik Ermel 8714c172ed storage/stream_flash: Fix range check in stream_flash_erase_page
Added check where stream_flash_erase_page checks if requested
offset is actually within stream flash designated area.

Fixes #79800

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-10-25 22:45:14 +01:00
Emil Gydesen 1dd59ea203 Bluetooth: Audio: Remove BT_AUDIO_BROADCAST_CODE_SIZE
Removed the LE Audio specific definition and instead
refer to the value defined by iso.h as it is ISO/Core
that defines this size, and not BAP/Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-25 22:43:40 +01:00
Lars Knudsen c966eac722 Bluetooth: Shell: Fix missing RX QoS param and MSE check
The bis_iso_qos.rx was missing in param sent in bt_iso_big_sync

Also, MSE = 0 is valid (fixed error check)

Signed-off-by: Lars Knudsen <LAKD@demant.com>
2024-10-25 12:55:32 -05:00
Jukka Rissanen 074b5f2ca0 shell: backend: websocket: Fix socket service creation
The NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC() macro was changed
earlier but the compilation error was missed. Fixing the macro
call.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-25 12:50:54 -05:00
Jukka Rissanen 34bb8cb35c logging: backend: websocket: Avoid uninit variable warning
The ret variable might be used uninitialized.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-25 12:50:54 -05:00
Lars Knudsen 09546ff3e3 Bluetooth: Shell: Set err to 0 before shell_strtoul
The value of err was not initialized to 0 prior
to calling shell_strtoul, which only sets err
on actual error.

Signed-off-by: Lars Knudsen <LAKD@demant.com>
2024-10-25 12:50:23 -05:00
Fin Maaß cd3dcf788a net: socket: service: mark as unstable
As the socket service API is currently used by mutiple applications
(dhcpv4 server, dns, telnet), it should be marked as unstable,
according to the docs:
https://docs.zephyrproject.org/latest/develop/api/api_lifecycle.html

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-10-25 18:50:07 +01:00
Lars Knudsen c15f8edd60 Bluetooth: Shell: Fix iso sync timeout range check
Using BT_ISO_SYNC_TIMEOUT_MIN and BT_ISO_SYNC_TIMEOUT_MAX now.

Signed-off-by: Lars Knudsen <LAKD@demant.com>
2024-10-25 12:49:38 -05:00
Fredrik Danebjer f970b066d2 Bluetooth: audio: Add possibility to use static broadcast id
Removed the generation of broadcast id inside the stack. It is now up
to the application to generate this by itself. The CAP sample has
been modified to allow either a static broadcast, or a random one.
All of this is handled in the application.

Signed-off-by: Fredrik Danebjer <frdn@demant.com>
2024-10-25 14:07:25 +02:00
Olivier Lesage 7e72d46e2e bluetooth: host: Add helper function for parsing PCTs
The 12-bit signed values for the results of PBR are a bit
cumbersome, so this adds a helper function to make it easier to work
with the HCI formatted steps.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-10-25 14:06:25 +02:00
Olivier Lesage 635d03b7e0 bluetooth: host: Unit tests for bt_le_cs_step_data_parse
Add unit tests for bt_le_cs_step_data_parse.
Also exit early (without calling the function pointer) if the next
step would seem to read out of bounds.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-10-25 14:06:25 +02:00
Emil Gydesen 16605585c0 Bluetooth: Audio: Add bt_audio_data_get_val
Add a generic function to retrieve any data based on an
assigned numbers type. This function can in theory be
used for any data type, and not just LE Audio types, but
since it relies on bt_audio_data_parse it was made
specificially for LE Audio.

The function can be used in cases where
bt_audio_codec_cfg_get_val, bt_audio_codec_cfg_meta_get_val,
bt_audio_codec_cap_get_val or
bt_audio_codec_cap_meta_get_val (or their derivation)
are not easily applicable due to the type constrainst.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-25 14:01:42 +02:00
Jamie McCrae 973ba91487 mgmt: mcumgr: transport: Add LoRaWAN MCUmgr SMP transport
Adds a transport that uses LoRaWAN for receiving and responding
to messages

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2024-10-25 14:00:48 +02:00
Hui Bai aaebe38db9 net: Increase net_mgmt task priority
Originally, the net_mgmt task priority is very low. Based on roaming
implementation, roaming is triggered in net_mgmt task. When running UDP
test while doing roaming, the net_mgmt task won't have much chance to
run and roaming can't be triggered.
Increase it to 3, which is same value of supplicant task.

Signed-off-by: Hui Bai <hui.bai@nxp.com>
2024-10-25 13:53:49 +02:00