Commit graph

21541 commits

Author SHA1 Message Date
Robert Lubos
c377017146 net: shell: Enable IPv4/6 and iface commands if NET_NATIVE is disabled
Some commands can be executed and some statuses can be printed even if
native IP is disabled.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-09-23 14:08:34 +01:00
Robert Lubos
8d296ba8fe net: iface: Don't require native networking to register IP address
It shouldn't be needed to enable native networking to be able to
add/delete IP addresses on network interfaces.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-09-23 14:08:34 +01:00
Robert Lubos
5d085b49a9 net: ipv4: Make native IPv4 options dependent on NET_NATIVE_IPV4
IPv4 Kconfig options which only affect native IPv4 stack should be
dependent on NET_NATIVE_IPV4, similarly as it's done for IPv6.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-09-23 14:08:34 +01:00
Jamie McCrae
ddad1e6fb0 mgmt: mcumgr: grp: os_mgmt: Fix invalid return
Fixes wrongly returning an SMP version 2 error code as an SMP
version 1 error code instead of adding it as an error

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-09-23 14:08:03 +01:00
Jamie McCrae
c6c00e13b8 mgmt: mcumgr: grp: os_mgmt: Allow bootloader info without MCUboot
Allows enabling the bootloader info functionality without MCUboot
being enabled, so that other bootloaders can add hooks with their
own responses

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-09-23 14:08:03 +01:00
Matt Rodgers
f2d8766b5d net: lib: http_server: remove dynamic resource data buffer
After introduction of struct http_response_ctx, the dynamic resource
data buffer is no longer needed for transferring data between the
application callback and the server. It is therefore removed to avoid
unnecessary copying of data.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-09-23 12:00:54 +02:00
Matt Rodgers
96061428e0 tests: http_server: add tests for dynamic response context
Add tests covering new method of providing a response for dynamic
resources.

Tests cover the application sending response codes and headers,
overriding "default" headers, and sending various combinations of
headers and body data. Each case is tested for HTTP1 & HTTP2, both POST
and GET methods.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-09-23 12:00:54 +02:00
Matt Rodgers
4cc905c513 net: lib: http_server: allow application to send headers/response code
Allow the application to send headers and response codes from a dynamic
resource callback by filling out a response context structure.

This also allows simple requests to be completed in a single execution
of the callback, by setting the final_chunk flag.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-09-23 12:00:54 +02:00
Stefan Petersen
f88784a7ff net: ipv6: Setting Router Solication Packet timeout
Running IPv6 on STM32H743 using eth_stm32_hal I had to extend
the timeout between the attempts to send Router Solicitation packets
from 1 second to 2 seconds. Else it looked liked the packet never
got sent (checked using tcpdump).

Signed-off-by: Stefan Petersen <spe@ciellt.se>
2024-09-23 12:00:35 +02:00
Emil Gydesen
7ef2f81413 Bluetooth: Audio: Add helpers for assisted listening stream
Added helper functions to set and get assisted listening
stream values for codec capabilities and codec configs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-23 10:03:47 +02:00
Emil Gydesen
0fe97560a3 Bluetooth: BAP: Add validation of qos_pref
The QoS preference defined by ASCS has some specified
limits and values that we should enforce.

Given the current API we cannot return an error to the
unicast server if it supplies invalid values, so we have
to resort to a LOG_ERR.

For the unicast client we treat invalid QoS preferences
similar to other invalid data in the notifications.

This also adds additional documentation in the
bt_audio_codec_qos_pref struct.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-23 10:03:12 +02:00
Fredrik Danebjer
2af4ae17a6 Bluetooth: audio: Fix shell available context
This fixes a bug where the shell will reject setting available
context to 0x0. This has now been moved to only affect supported
context instead.

Signed-off-by: Fredrik Danebjer <frdn@demant.com>
2024-09-23 10:02:40 +02:00
Emil Gydesen
b800be3430 Bluetooth: BAP: Broadcast sync fail receive state bis sync value fixed
In the case that a broadcast sync fails for any reason, we need to
set the BIS_Sync value for all subgroups to 0xFFFFFFFF
(BT_BAP_BIS_SYNC_FAILED) as per the BAP spec.

This commit adds a new define for this and modifies
both the scan delegator and broadcast sink to support this.

The change is validated by a modification to the broadcast
assistant test that verifies that the value is set in the
case of an invalid broadcast code (which indicates a
failed BIG sync).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-23 10:02:33 +02:00
Yong Cong Sin
d250664dc7 bluetooth: host: fix formatter warnings
Update the string formatter according to the type of the
variables that it is printing to eliminate compilation
warnings.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-09-23 10:01:34 +02:00
Daniel Leung
4f52860fe0 debug: coredump: dump privileged stack
This adds the bits to call into architecture code to dump
the privileged stack for user threads.

The weak implementation is simply there as a stub until
all architectures have implemented the associated function.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-09-21 11:29:39 +02:00
Krzysztof Chruściński
af391b8b3f logging: frontend: stmesp_demux: Improve robustness
Demultiplexer was not ready to handle case when log message was
incomplete which was followed by other log messages. Such scenario
could occur if there was a fault that happen during logging of
a message. In that case incomplete message was followed by valid
messages (fault report) and this fault report was not handled
because processing was blocked waiting for completion of a
message which preceeded fault report.

Since it is expected that some messages may be incomplete a
garbage collection mechanism is added. When start of a message is
received timestamp is logged and list of incomplete messages
is checked for 'old' messages which persist in incomplete state
for long. When message timeouts it is closed and marked as
invalid. It unblocks processing of following messages.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-20 15:16:46 -05:00
Krzysztof Chruściński
da8ba3efa4 logging: frontend_stmesp: Avoid unaligned word access
write_data function which was writing to STMESP data registers was
starting by writing words and tail was written using byte access.
However, RISCV core does not support unaligned access and on Cortex-M33
even if supported it is faster to do aligned access. Reworked
write_data to start first by writing data using byte or half word
access until data pointer is word aligned, then word access is used
and finally tail is written using byte or half word access.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-20 15:16:16 -05:00
Krzysztof Chruściński
d7a62bdeb6 logging: frontends: stmesp: Run clang-format
Apply clang-format formatting.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-20 15:16:16 -05:00
Emil Gydesen
83a621dcac Bluetooth: AICS: Fix race condition in AICS free inst get
bt_aics_client_free_instance_get can be called from multiple threads
and as such the atomic_test_and_set_bit should be used instead
of a atomic_test_bit followed by a atomic_set_bit.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-20 11:07:57 +02:00
Pisit Sawangvonganan
af4527e131 style: subsys: adjust return usage in void functions
For code clarity, this commit adjusts the use of `return` statements
in functions with a void return type as follows:
- Transform `return foo();` into separate statements:
  `foo();`
  `return;`
- Remove unnecessary `return` statements when
  they don't affect control flow.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-20 11:06:55 +02:00
Pisit Sawangvonganan
44ba8a5485 net: dhcpv6: adjust switch-case in dhcpv6_enter_state
For code clarity, unified switch-case usage in `dhcpv6_enter_state` to
use `break` instead of `return`.
Typically, a `break` is used in switch-case statements unless an early
return is necessary, in which case `return` is appropriate.

In this scenario, the `break` statement is the more suitable choice.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-20 11:06:03 +02:00
Emil Gydesen
27709609f3 Bluetooth: BAP: Unicast Client: Replace busy bool with atomic
Replace the busy boolean flag with an atomic value.
This also modifies the order of how this value is
controlled to avoid any race conditions.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-20 09:04:23 +02:00
Emilio Aguila Escalante
dda9ba6031 Bluetooth: Mesh: Use dfd_phase_set() in dfu_suspended()
Currently, dfu_suspended() sets the phase SUSPENDED
directly in the structure, bypassing the dfd_phase_set() function.
This prevents the phase change callback in the bt_mesh_dfd_srv_cb
structure from receiving the SUSPENDED event.

Signed-off-by: Emilio Aguila Escalante <emilio.aguila@hotmail.com>
2024-09-20 09:02:21 +02:00
Daniel DeGrasse
bc8cb0be4c net: l2: wifi: ensure certificates directory is created
Ensure that the output certificates directory is created, where
generated certificates will be placed. This fixes a build error seen
when using `make` to build samples/net/wifi for the rd_rw612_bga board,
where the output directory for generated certificates did not exist at
build time.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-09-19 18:01:53 -04:00
Florian Grandel
da0371accf net: l2: ieee802154: decouple frame decryption from upper layer fields
The L2 function `ieee802154_decipher_data_frame()` relied on upper layer
LL address fields which breaks encapsulation.

Also fixes a bug introduced in another fix that went overboard (#53734).

Fixes: #78490

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2024-09-19 18:28:26 +01:00
Florian Grandel
766fda06c2 net: l2: ieee802154: move vars to top of block
Found a few variable declarations that were not yet moved to the top of
the function/block. Doing this before actually fixing #78490 so that the
fix becomes more readable.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2024-09-19 18:28:26 +01:00
Florian Grandel
a7f235596c net: l2: ieee802154: fix typo
renamed ieeee802154 to ieee802154

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2024-09-19 18:28:26 +01:00
Emil Gydesen
9af5d14ef0 Bluetooth: MICP: Add bondable requirement
MICP requires support for the bondable mode for both
the MICP microphone device and MICP microphone controller.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-19 18:28:01 +01:00
Emil Gydesen
f57a040808 Bluetooth: BAP: Add bondable requirement for BAP
BAP mandates support for bondable mode for all central and
peripheral roles.

Due to Kconfig circular dependencies, some additional
Kconfig changes had to be made.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-19 18:27:53 +01:00
Kamil Piszczek
f17431ee97 bluetooth: smp: remove experimental from BT_GATT_AUTHORIZATION_CUSTOM
Removed the experimental status from the BT_GATT_AUTHORIZATION_CUSTOM
Kconfig option used in the Bluetooth Host GATT layer. This feature
has been present in Zephyr for almost a year without any issue reports
or API modifications.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2024-09-19 18:27:43 +01:00
Olivier Lesage
fb9a8eb316 bluetooth: host: CS support for CS Test
Adds HCI support for the LE CS Test command.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-09-19 18:27:20 +01:00
Olivier Lesage
947a294d36 bluetooth: host: CS support for remote capabilities and FAE table
Adds HCI support for:
- LE CS Read Remote Supported Capabilities
- LE CS Read Remote FAE Table

Callbacks have been added to the conn object to allow upper layers to
make use of the cache commands, with which it will be possible to store
this information and provide it again in the case of a disconnect
and reconnect to the same device.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-09-19 18:27:20 +01:00
Florian Grandel
041d8c707c net: l2: ieee802154: fix deadlock
When an incoming PAN ID does not match or when an error occurs while
sending association requests, then locks were not properly released.

Fixes: #78495

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2024-09-19 15:13:41 +02:00
Kamil Piszczek
8c0bc54ab0 mgmt: mcumgr: transport: bluetooth: add all gatt permission levels
Added new Kconfigs for defining permission level of GATT
characteristics that are part of the Bluetooth SMP service in the
MCUmgr subsys.

Removed the CONFIG_MCUMGR_TRANSPORT_BT_AUTHEN as the new Kconfig
options are mutually exclusive and need to be groupa as the Kconfig
choice option.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2024-09-19 15:13:19 +02:00
Kamil Piszczek
a743dd6f29 bluetooth: smp: remove experimental from BT_BONDABLE_PER_CONNECTION
Removed the experimental status from the BT_BONDABLE_PER_CONNECTION
Kconfig option used in the Bluetooth Host SMP layer. This feature
has been present in Zephyr for over a year without any issue reports
or API modifications.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2024-09-19 15:13:02 +02:00
Yong Cong Sin
ae20c08822 shell: kernel_service: heap: add required header
Add the "kernel_shell.h" header which is required but missing,
causing build error.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-09-19 03:52:59 -04:00
Robert Lubos
fc007eeef5 net: sockets: tls: Prevent infinite block during handshake
In case peer goes down or we disconnect from the network during the
TLS handshake, the TLS socket may block indefinitely during
connect()/accept(), waiting for data from the peer. This should be
avoided, hence use the preconfigured timeout for the TLS handshake,
same as we use for TCP-level handshake.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-09-19 03:27:05 -04:00
Arkadiusz Cholewinski
a421f339d5 Ztest: Ztest_param fix
Add the missing #ifndef CONFIG_ZTEST_SHUFFLE in ztest.c file.
This fixes multiple definitions of NUM_ITER_PER_SUITE
and NUM_ITER_PER_TEST.

Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
2024-09-19 03:25:17 -04:00
Arkadiusz Cholewinski
9d9089edd0 ztest: Add Support for Multiple Test Runs.
Introduces new kconfig options to enable multiple test runs in the ztest.

Signed-off-by: Arkadiusz Cholewinski <arkadiuszx.cholewinski@intel.com>
2024-09-18 15:32:28 +02:00
Fengming Ye
c642b44c95 net: wifi_mgmt: add DPP reconfig support
Hostap does not support wpa_cli DPP reconfig command.
So add wifi_mgmt DPP reconfig command and api.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-09-18 09:57:27 +02:00
Fengming Ye
23d2281d6a wifi: shell: add AP DPP shell commands
Add AP DPP shell commands by expanding wifi_cmd_dpp.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-09-18 09:57:27 +02:00
Fengming Ye
4f93c84a94 hostap: add AP network security type DPP
Add DPP security type for AP DPP support.

Signed-off-by: Fengming Ye <frank.ye@nxp.com>
2024-09-18 09:57:27 +02:00
Yong Cong Sin
aa9446ca6b shell: modules: kernel: cleanup thread list subcmd
Parts related to the thread runtime stats are somewhat
standalone, refactor it out instead of having two #ifdef
and two places.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-09-17 20:12:33 -04:00
Yong Cong Sin
83212147b2 shell: kernel_service: reorg the commands
Split the `kernel_service.c` into multiple subcommand files,
each file would register with the main `kernel` cmd based on
the dependencies in Kconfig/CMakeLists.txt.

This greatly reduces the number of precompiler directives.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-09-17 20:12:33 -04:00
Shrek Wang
0b24b960fe net: Add onlink and forwarding check to IPv6-prepare
Deadloop happens when CONFIG_NET_ROUTING and VLAN are enabled.
In function net_ipv6_prepare_for_send(), pkt->iface will be
updated with net_pkt_set_iface(pkt, iface) in 2 scenarios:
1. ip_hdr->dst is onlink
2. check_route or nbr_lookup
VLAN is virtual-iface which attaches to a physical-iface. Each
time a packet being sent to a VLAN port will invoke twice of
the net_send_data(). The 1st time, pkt->iface is set to virtual
iface and the 2nd time to physical iface.
However in above 2 scenarios, at the 2nd time of calling the
net_send_data(), the pkt-iface will be changed back to virtual
iface. The system runs into a deadloop. This can be proved by
enabling CONFIG_NET_ROUTING with the VLAN sample.
The main purpose for net_ipv6_prepare_for_send() is to set the
right ll_dst address. If the ll_dst address is already set, then
no need to go through it again. If the packet has done with the
forwarding and set the ll_dst, then no need to check_route again.
And, the pkt->iface will not be changed back to virtual iface.

Fixes: #77402

Signed-off-by: Shrek Wang <shrek.wang@nxp.com>
2024-09-17 20:11:32 -04:00
Emil Lindqvist
f5981e5d8c net: shell: increase number of arguments to net suspend command
Increased variable to the mandatory amount of commands, since the
comment of SHELL_SUBCMD_ADD states

"Number of mandatory arguments including command name"

but net suspend takes the interface number to suspend

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2024-09-17 20:10:55 -04:00
Emil Gydesen
dfa5bd8a54 Bluetooth: VCP: Replace bools with atomic
Replace several bools in volume controller with an atomic value.
Update how these values are modified so that we can better
prevent race conditions.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-17 14:52:37 -04:00
Emil Gydesen
ae58f474a1 Bluetooth: VCP: Vol ctlr rename flags to vol_flags
Rename the volume flag field from the generic "flags"
to "vol_flags" as the generic "flags" will be used for
other values in a future commit.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-17 14:52:37 -04:00
Jonathan Rico
2ca59e799c Bluetooth: Host: Defer conn.recycled() to the syswq
We don't own the thread that calls the final `bt_conn_unref()`. The
users might not be aware that they are re-using that poor thread's
stack.

Putting it on the system workqueue gives a predictable stack size and
thread priority for the invocation of the recycled handlers.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-09-17 17:47:56 +01:00
Jonathan Rico
6d5cce662a Bluetooth: buf: Put command complete/status in sync buf pool
Why is it ok to use the sync pool?

Because command complete/status is processed in prio: that means on the
same stack as the `bt_recv()` call from the driver.

Why does it fix the issue?

Because the complete/status event goes into a pool that is guaranteed to
have one free buffer any time `bt_recv()` is not executing.

Since the driver is the one calling bt_recv(), it (hopefully) will
finish one `bt_recv()` before starting another one.

Fixes #78223

Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-09-17 17:45:50 +01:00