Commit Graph

19802 Commits

Author SHA1 Message Date
Fin Maaß 6cc2bb53b4 mgmt: hawkbit: add hawkbit_autohandler_wait
Add hawkbit_autohandler_wait() to be able
to wait for the autohandler to finish.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-10-09 18:10:30 +01:00
Fin Maaß cf5f6aad23 mgmt: hawkbit: add option for autohandler
add option for autohandler to only run once.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-10-09 18:10:30 +01:00
Fin Maaß 35d05b7198 mgmt: hawkbit: use K_WORK_DELAYABLE_DEFINE
staticly init hawkbit_work_handle

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-10-09 18:10:30 +01:00
Yago Fontoura do Rosario 029540abec Bluetooth: Controller: Handle overlapping buffers on ull_adv{.c,_aux.c}
* Setting the adv data, scan rsp and adv aux ad data can happen on
overlapping buffers
* There can be other memcpy's that need to be changed to memmove but
these are the only ones I could reproduce the issue and since memmove
has a performance penalty, I left the others as is.

Signed-off-by: Yago Fontoura do Rosario <yafo@demant.com>
2024-10-09 13:59:07 +02:00
Ayush Singh 5b5d6366e3 net: l2: ieee802154: shell: Fix stringop-truncation
- Fix the warning stringop-truncation
- Leave space for NULL terminator.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2024-10-09 13:50:00 +02:00
Jordan Yates 4953389b1e net: socket_service: remove `work_q` parameter
Remove the `work_q` parameter from `NET_SOCKET_SERVICE_SYNC_DEFINE` and
`NET_SOCKET_SERVICE_SYNC_DEFINE_STATIC` as this feature was dropped
during review but the removal was not 100% complete.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-10-09 13:48:54 +02:00
Jakub Rzeszutko 5bb721264b shell: add generic RX buffer flush function
Added a generic function `z_shell_backend_rx_buffer_flush` to clear
the RX buffer when resuming the shell. The function repeatedly calls
the backend's `read` API until the buffer is empty or a maximum of
1000 iterations is reached. This prevents unintended command
execution after `shell_start`.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
2024-10-09 13:48:41 +02:00
Krzysztof Chruściński ddf753cdac debug: mipi_stp_decoder: Avoid potential 64bit unaligned access
Decoder was casting uint8_t pointers to uint64_t pointers which could
result in double word instruction which does not support unaligned
access on Cortex-M. Issue was revealed when -O3 optimization was
used instead of -Os. In size optimized version, compiler was
using word load and store instructions which support unaligned
access and issue was not visible.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-10-09 13:45:04 +02:00
Pisit Sawangvonganan ea2d785a28 modem: cmux: replace `crc8` with `crc8_rohc` for FCS calculation
To improve performance in FCS calculation, this commit replaces
the usage of the generic `crc8` function with the specific `crc8_rohc`
function in `modem_cmux.c`.
The `crc8_rohc` function utilizes a small table approach, enhancing
the efficiency of CRC-8/ROHC variant calculations while optimizing
memory usage.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-10-09 09:48:00 +02:00
Emil Gydesen e7e7386352 Bluetooth: BAP: Modify unicast client callbacks to slist
Modify the BAP unicast client callback structure to be a
linked list. The purpose of this is to have multiple listeners
of the unicast client changes and notifications.
This is needed for the CAP initiatior.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-09 09:42:30 +02:00
Valerio Setti ec3dea2b45 jwt: reshape and add alternative for ECDSA using PSA
This commit:

- creates 2 new files, jwt_ecdsa.c and jwt_rsa.c, to hold the
  implementations of the corresponding ECDSA/RSA signature
  algorithms;
- RSA signature is stil done through Mbed TLS's PK module which
  can optionally make use of PSA (if enabled);
- ECDSA signature will instead use PSA, if possible, or TinyCrypt
  as fallback.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-10-08 18:10:32 -04:00
Ingar Kulbrandstad b32eb0d2b2 Bluetooth: Mesh: Fix out of bounds write
Fix of the subnet bridging table function to only
compact the table if elements has been removed, and
fixing the compact function to compact the table if
several elemnts has been removed at the same time.

Fixes zephyrproject-rtos#78794

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
2024-10-08 18:09:57 -04:00
Johann Fischer 47c8815253 modbus: fix support for floating point values
The Modbus protocol object types are either single-bit or 16-bit word.
Other types are not defined in the specification. Types such as float
are typically mapped to two 16-bit registers. Current implementaiton
does not maps correctly to the 16-bit word addresses. On the client
side, the implementation must take into account that the number of
requested registers (Quantity of Registers) is double that of a "float"
register.  The server side should not treat "Quantity of Registers" and
"Byte count" differently for addresses reserved for floating values,
only in the user callback the two 16-bit registers are mapped to a float
value but still aligned to 16-bit register addresses.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-08 17:01:19 +02:00
Robert Lubos c6498bb68d net: ipv6: Make Multicast Listener Discovery API public
IPv6 MLD API was so far defined in an internal header. This does not
seem correct though, as application code should be able to join/leave
multicast groups, hence the API should be exposed in a public header,
just as it is done for its IPv4 countepart - IGMP.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-10-08 17:00:06 +02:00
Robert Lubos c6cc87c526 log: net: Fix build warning with IPv6 disabled
Building the net logger backend with IPv4 only gives the following
warning:

log_backend_net.c:116:31: warning: array subscript 'struct sockaddr[0]'
is partly outside array bounds of 'struct sockaddr_in[1]'
[-Warray-bounds] local_addr->sa_family = server_addr.sa_family;

hence assign the address family directly to sockaddr_in/6 structs.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-10-08 16:58:20 +02:00
Robert Lubos 5c6b003554 net: dns: dispatcher: Don't use uninitialized entries
In case CONFIG_DNS_RESOLVER_MAX_SERVERS is larger than the actual number
of DNS servers configured, some server entries may be left
uninitialized. The dispatcher needs to take this into account, otherwise
it may cause memory corruptions.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-10-08 16:58:20 +02:00
Emil Gydesen b2e61ef355 Bluetooth: BAP: Fix bad check in bt_audio_valid_qos_pref
The checks did not properly take into account
that the pref_pd_min and pref_pd_max could have valid
0 values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-08 16:58:09 +02:00
Krzysztof Chruściński 8fc0aba4ae logging: Add log_source_id helper function
There are many places where source_id is retrieved and it
depends on runtime filtering being enabled. So far it was
all exposed but lets encapsulate that into a helper function.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-10-08 16:57:59 +02:00
Pisit Sawangvonganan 88374b0738 fs: nvs: streamline `rc` return logic
Streamline the `rc` return logic in `nvs_flash_wrt_entry()`, `nvs_gc()`
by directly returning `rc`, as the redundant conditional check and
explicit return of 0 were unnecessary.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-10-08 16:57:49 +02:00
Aleksander Wasaznik 8cfad44852 Bluetooth: Deprecate adv auto-resume
The host-based adv auto-resume function has both a problematic
implementation and disagreement in the community around how it should
behave. See the issue linked resolved below for details.

This patch makes the deprecation visible to the user. The user will be
better served by a auto-resume tailored their applications use case,
based on more primitive host API like `conn_cb.recycled`, which has
obvious behavior that is unlikely to change.

Resolves: https://github.com/zephyrproject-rtos/zephyr/issues/72567

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-10-08 16:57:01 +02:00
Adrian Friedli 98289e594d net: lib: coap: make ACK random factor runtime configurable
Extend the `coap_transmission_parameters` struct with the field
`ack_random_percent`. This was the last remaining CoAP transmission
parameter that was not configurable at runtime.

Signed-off-by: Adrian Friedli <adrian.friedli@husqvarnagroup.com>
2024-10-08 06:00:56 -04:00
Firas Sammoura 6f072ba774 Ztest: Including the missing C standard library header
The ztest.c calls atoi, which is provided by the C standard library.
Remove the conditional inclusion of the C standard library with the
definition of CONFIG_ZTEST_SHUFFLE.

Signed-off-by: Firas Sammoura <fsammoura@google.com>
2024-10-08 06:00:45 -04:00
Benedek Kupper a6b911f195 usb: device_next: USB reset clears remote wakeup permission
Verbatim from USB 2.0 specification:
The Remote Wakeup field indicates whether the device is currently enabled
to request remote wakeup. The default mode for devices that support
remote wakeup is disabled. If D1 is reset to zero, the ability of the
device to signal remote wakeup is disabled. If D1 is set to one,
the ability of the device to signal remote wakeup is enabled.
The Remote Wakeup field can be modified by the SetFeature() and
ClearFeature() requests using the DEVICE_REMOTE_WAKEUP feature selector.
This field is reset to zero when the device is reset.

Signed-off-by: Benedek Kupper <kupper.benedek@gmail.com>
2024-10-08 05:59:29 -04:00
Paul He c2911af78e fs: littlefs: get block_cycles value from dts
Property "block-cycles" is required for node "zephyr,fstab,littlefs",
but source code did not get the value from dts file, now add it.

Additionally correct the wrong description of property "block-cycles"
in binding file.

Signed-off-by: Paul He <pawpawhe@gmail.com>
2024-10-07 18:43:05 +02:00
Gerard Marull-Paretas b2031aa20d bluetooth: controller: ll_sw: nordic: align to nrfx 3.7.0
Some enums have been renamed:

- NRF_CCM_EVENT_ENDCRYPT -> NRF_CCM_EVENT_END
- NRF_CCM_TASK_CRYPT -> NRF_CCM_TASK_START

Also adjust some TX power level settings (26/28dBm not always available
depending on the SoC revision).

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-10-07 18:42:14 +02:00
Abram Early 583f4956dc modbus: reset wait semaphore before tx
A response returned after a request times out would increment the
semaphore and stay until the next request is made which will immediately
return when k_sem_take is called even before a response is returned. This
will once again have the same problem when the actual response arrives.
So the wait semaphore just needs to be reset before transmitting.

Signed-off-by: Abram Early <abram.early@gmail.com>
2024-10-07 17:12:44 +01:00
Chaitanya Tata 1da74ef705 net: wifi: Fix DPP disabled build
In case WPA supplicant disabled DPP, we need to compile out the
corresponding DPP code in Wi-Fi shell too.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-10-07 17:12:16 +01:00
Xudong Zheng e8c4867806 usb: cdc_acm: disable logging if used for shell with logging
This prevents recursive logging loop when USB CDC ACM is used for shell
with logging.

Change affects both USB stacks.

Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2024-10-07 17:11:44 +01:00
Vinayak Kariappa Chettimada c334ed515b Bluetooth: Controller: Fix multiple Extended Adv chain reception
Fix assertion when enabling simultaneous multiple Extended
Advertising chain reception that is enabled by increasing
supported auxiliary scan contexts.

ULL sets the association of aux context to scan and sync
context, and LLL resets the association; this is safer
compared to earlier implementation where ULL did both the
association and reset which caused aux context memory
leak.

Supported auxiliary scan contexts can be increased using
CONFIG_BT_CTLR_SCAN_AUX_SET value.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-10-07 13:39:53 +02:00
Tomi Fontanilles bf0e6d7c83 secure_storage: introduce the secure storage subsystem
Implements RFC https://github.com/zephyrproject-rtos/zephyr/issues/75275.

See also the PR (https://github.com/zephyrproject-rtos/zephyr/pull/76222)
for more information.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-10-07 13:38:43 +02:00
Maureen Helm d022d315d2 tracing: Fix sysview for soc families not subdivided into series
Fixes the systemview tracing backend for soc families, such as max32,
that don't subdivide into soc series and therefore don't define
CONFIG_SOC_SERIES. Use CONFIG_SOC_FAMILY instead in the system
description since it should always be defined.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2024-10-06 20:51:27 +01:00
Rex Chen 82ec1d7862 net: wifi: shell: add wps support
Add wps pin and wps pbc L2 layer cmd support.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
2024-10-05 14:07:48 -04:00
Pisit Sawangvonganan 7d1953918a net: wifi: shell: enhance consistency in `cmd_wifi_dpp_ap_auth_init`
The `cmd_wifi_dpp_ap_auth_init` function was added but is not yet
aligned with others.
This update enhances consistency with the following changes:
- Unified the order of declaration for `opt`, `opt_index`,
  `state`, and `long_options`.
- Wrapped lines in the `long_options` declaration to prevent them
  from extending too far to the right.
- Applied `struct option` as `static const`
- Unified the wrapping of `getopt_long` calls, regardless of
  the length of the `options` string.
- Using `getopt_state` to access `optarg` and also `optopt` offers
  a better alternative to direct global access.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-10-05 14:07:33 -04:00
Lyle Zhu 3756429b6c Bluetooth: BREDR: L2CAP: Recover ident when conn is pending
The `ident` of L2CAP BR connection req will be cleared if
function l2cap_br_conn_req_reply called to send L2CAP BR
connection rsp with result `BT_L2CAP_BR_PENDING`.

Then the invalid `ident` (it is zero) will be filled in
the L2CAP BR connection rsp after the ACL connection is
encrypted.

Recover `ident` if the result of the connection rsp is
`BT_L2CAP_BR_PENDING`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-05 14:07:24 -04:00
Lyle Zhu c7c1f73045 Bluetooth: SSP: Support security level 4
Currently, error code `-ENOTSUP` will be
returned if start security with security
level 4.

For SC supported case, level 4 for ssp
should be supported.

Remove the code limitation to support
security level 4.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-05 14:07:15 -04:00
Lyle Zhu 7e54f13e7b Bluetooth: l2cap_br: Support Multi-Command Packet
Improve L2CAP BR to handle more than one
signaling command in one receiving L2CAP packet.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-05 14:07:09 -04:00
Lyle Zhu 3561540110 Bluetooth: L2CAP_BR: Set flags in CFG RSP
The flags of L2CAP_CONFIGURATION_REQ are set.
But in L2CAP_CONFIGURATION_RSP, all bits of
flags are cleared.

When used in the L2CAP_CONFIGURATION_RSP
packet, the continuation flag shall be set
to one if the flag is set to one in the
Request.

Copy flags from Request to Response if it
is a successful result.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-05 14:07:00 -04:00
Lyle Zhu b7ab7c9d45 Bluetooth: L2CAP_BR: Process all defined OPTs
Currently, Only configuration opt MTU is handled.

For opt `Flush timeout`, `QOS`, `Retransmission
and Flow Control`, and `FCS`, response wilt
result `BT_L2CAP_CONF_UNACCEPT`.

For opt `extended flow specification` and
`extended windows size`, response wilt result
`BT_L2CAP_CONF_REJECT`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-05 14:06:55 -04:00
Lyle Zhu c5648044a8 Bluetooth: L2CAP_BR: incorrect result returned if config opt unsupported
The `BT_L2CAP_CONF_SUCCESS` is returned as result for the config
req with supported opt.

Result `BT_L2CAP_CONF_UNKNOWN_OPT` should be returned for this case.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-05 14:06:55 -04:00
Jukka Rissanen 0515bfff7a net: lib: http-client: Use memcpy() to avoid gcc warning
GCC 12.2.0 can give this warning (version 11.4.0 did not), when
CONFIG_SPEED_OPTIMIZATIONS=y

subsys/net/lib/http/http_client.c: In function 'http_send_data.constprop':
subsys/net/lib/http/http_client.c:114:33: warning: 'strncpy' specified
bound depends on the length of the source argument [-Wstringop-truncation]
  114 |                                 strncpy(send_buf + end_of_send,
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  115 |                                         data + end_of_data,
      |                                         ~~~~~~~~~~~~~~~~~~~
  116 |                                         remaining);
      |                                         ~~~~~~~~~~
subsys/net/lib/http/http_client.c:87:41: note: length computed here
   87 |                         remaining_len = strlen(data + end_of_data);
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~

The code properly checks that we do not overwrite the destination
buffer even if we use the source buffer length to determine how much
to copy. One possible fix is to use memcpy() or strcpy(), I opted
to use memcpy() because it has the length option which feels more
natural.

Fixes #79326

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-10-04 13:24:17 -05:00
Seppo Takalo 8068cb2567 net: lwm2m: Add shell command for listing resources
Add shell command for listing multiple objects, resources
or resource instances.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-04 16:35:59 +01:00
Olivier Lesage 9ae2e23d34 bluetooth: host: Update text for BT_CHANNEL_SOUNDING kconfig
Include EXPERIMENTAL tag in the kconfig text and remove the word
"support" to align with other options

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-10-04 16:34:45 +01:00
Olivier Lesage 9e3943d13e bluetooth: host: Add CONFIG_BT_CHANNEL_SOUNDING_TEST
Makes it easier to make sure the CS test code is removed if desired.
It should hopefully allow for a clean split in general.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-10-04 16:34:45 +01:00
Olivier Lesage a12b869eac bluetooth: host: Add support for processing CS subevent results
Adds support for:
- LE CS Subevent Result event
- LE CS Test End Complete event

For now, recombination of subevent results with more steps than could
fit within a single HCI event is not supported, and such events
are discarded.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-10-04 16:34:45 +01:00
Emil Gydesen dc97bbd35f Bluetooth: Audio: Rename bt_audio_codec_qos -> bt_bap_qos_cfg
The QoS structure is not related to a codec, but rather a
stream, and should thus not use the "Codec" name.

The BAP and ASCS specs refer to the QoS as
"QoS configuration" several places, so it is an obvious
choice for a name.

Since the structure is defined and used by BAP, the prefix
was changed from bt_audio to bt_bap.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-04 16:34:22 +01:00
Krzysztof Bartnicki e1cacb3a18 net: dns: Fix DNS resolver cache invalid find call
The size of the output array for the find call in resolver
is invalid: expected array size while overall memory size
provided. As the latter is bigger there is a high probability
of memory overwrite occurring on the stack.

Signed-off-by: Krzysztof Bartnicki <krzysztof.bartnicki@embevity.com>
2024-10-04 10:50:31 +01:00
Erik Brockhoff 670bd3bed2 Bluetooth: controller: fixing issue re. assert on overlapping conn upd proc
If a connection update (from central) overlaps a peripheral initiated
conneection param request, then central rejects peripheral request
and continues central procedure. This lead to an assert in peripheral
On instant there would not be an rx_node for notification, as this
would have been discarded by the reception of the REJECT.

This fix ensures that once an rx_node has been 'accepted' for retention
it will not be discarded/overwritten by future rx_nodes

The test will trigger the assert without the fix in.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2024-10-04 10:46:06 +01:00
Eric Ackermann 5275d44409 llext: Add RISC-V arch-specific relocations
This commit introduces architecture-specific ELF relocations for RISC-V,
in accordance with the RISC-V PSABI specification:
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc
Also, the necessary compiler configurations for compiling LLEXT
extensions on RISC-V are added, and the llext tests are executed on
RISC-V targets.
Calling llext extensions from user threads in RISC-V is still
unsupported as of this commit.

Signed-off-by: Eric Ackermann <eric.ackermann@cispa.de>
2024-10-03 21:59:42 +01:00
Seppo Takalo 73a3438b82 net: lwm2m: Remove hostname_verify flag from context
Use security mode (PSK or X509) to detect if we should
set the socket option to verify hostname.

PSK security mode cannot verify hostnames as this information
is coming in the certificate, so don't set the options.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-10-03 17:09:32 +01:00
Robert Lubos 0c1550dd9f net: sockets: Remove SET_ERRNO() macro
Macros with flow control are discouraged and generate compliance error,
hence remove it and replace the corresponding code with simple errno
assignments.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-10-03 17:08:29 +01:00
Robert Lubos bdbf7cc620 net: offload: Do not need to enable TC threads for NET_OFFLOAD
Net offloading doesn't need net TC threads to be enabled as they're used
by the native stack. This fixes build if CONFIG_NET_OFFLOAD is enabled
but native stack is disabled.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-10-03 17:08:29 +01:00
Robert Lubos 2e1d89619f net: Avoid compiling native network stack parts w/o NET_NATIVE
In case NET_NATIVE is disabled, certain network stack components do not
need to be compiled. Otherwise, they could throw errors if
--no-gc-sections compiler options is enabled.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-10-03 17:08:29 +01:00
Robert Lubos 404e9c7b88 net: sockets: Split native IP socket implementation from syscalls
Native IP socket implementation need only be build if native IP stack is
enabled. Therefore, split the native IP sockets from the common socket
syscalls shared across all socket implementations.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-10-03 17:08:29 +01:00
Tommi Rantanen a5aed04b7e net: lib: coap: Initialize response_truncated
Fix the following compilation warning given when using newlibc:
warning: 'response_truncated' may be used
uninitialized [-Wmaybe-uninitialized]

Issue is not seen with picolibc.

The variable was introduced as part of PR #76257

Signed-off-by: Tommi Rantanen <tommi.rantanen@nordicsemi.no>
2024-10-03 17:08:21 +01:00
Yong Cong Sin 52a202309b zephyr: bulk update to DT_NODE_HAS_STATUS_OKAY
Change instances of:

DT_NODE_HAS_STATUS(<node_id>, okay)

to

DT_NODE_HAS_STATUS_OKAY(<node_id>)

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-10-03 17:06:52 +01:00
Adrien Ricciardi cd76ab3428 fs: nvs: Simplified the initial loop in calc_free_space()
Replaced the initial loop that computes the initial free space
by a simple formula.

Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
2024-10-03 11:41:33 +01:00
Dave Rensberger c0bb9735d7 net: shell: Make stack size for event_mon_stack configurable
The stack size for the event_mon_stack task may need to be larger than the
default 1024 to avoid crashes. It should be configurable through Kconfig
so that source code doesn't need to be modified to increase it.

Signed-off-by: Dave Rensberger <davidr@beechwoods.com>
2024-10-03 11:40:16 +01:00
Pete Skeggs 715b97397b net: lib: coap: Make use of ZSOCK_MSG_TRUNC configurable
Not all offloaded network stacks support this socket option so
control it using a Kconfig CONFIG_COAP_CLIENT_TRUNCATE_MSGS,
and enable it by default.

Signed-off-by: Pete Skeggs <peter.skeggs@nordicsemi.no>
2024-10-02 15:55:00 +02:00
Lyle Zhu 0ed8866eb6 Bluetooth: host: Kconfig: Correct `help` of `BT_BONDABLE`
Correct the `help` of the configuration `BT_BONDABLE`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 15:54:30 +02:00
Lyle Zhu aaab223574 Bluetooth: SSP: Incorrect bonding status notified
The `bonded` flag of the callback `pairing_complete` is always true,
event if the SSP pairing is non-bondable.

Check the bonding status in SSP complete event instead of in link key
notify event.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 15:54:30 +02:00
Lyle Zhu a00d5089d5 Bluetooth: shell: Add command `conn-bondable`
Add command `conn-bondable` to enable/disable the pairing bondable
flag of a specific ACL connection.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 15:54:30 +02:00
Lyle Zhu d5160f663a Bluetooth: BR: Improve `bt_conn_set_bondable`
In current, the bondable flag cannot be configured for each specific
BR connection.
But for LE conn, there is a function `bt_conn_set_bondable` for this
purpose.

Improve `bt_conn_set_bondable` to support BR conn.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 15:54:30 +02:00
Lyle Zhu e772c45e6b Bluetooth: SSP: Support non-bondable mode
If the return value of function bt_get_bondable is false, clear the
bonding flag when controller requiring `Authentication_Requirements`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 15:54:30 +02:00
Lyle Zhu c0ce5b419b Bluetooth: Host: smp: Add function to get bonding setting
Add a function bt_get_bondable to get the bonding setting.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 15:54:30 +02:00
Håvard Reierstad 0fe6d34f8a Bluetooth: Mesh: Remove duplicate brg declaration
Removes duplicate declaration of the bridging direction, keeping the
one in the public header file.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-10-02 14:54:13 +01:00
Håvard Reierstad 8049c24994 Bluetooth: Mesh: Add prefix to Subnet Bridge API
Adds the `bt_mesh_brg_cfg` prefix to the public Subnet Bridge API, and
aligns the function and callback naming with the rest of the Bluetooth
Mesh API.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-10-02 14:54:13 +01:00
Johann Fischer f5a3f90a68 usb: device_next: respect bMaxPacketSize0 in control transfers
Only the device operating at high speed has bMaxPacketSize0 set to 64
bytes, the device operating at other speeds may have a different value.
For full speed, use the value from the full speed descriptor.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:54:04 +01:00
Jordan Yates bf9584d6ba fs: add `FILE_SYSTEM_LIB_LINK` option
Add an option that links in the underlying file system libraries as
usual, but doesn't compile in the Zephyr file system abstraction layer.

This can be useful to avoid linking in the entire filesystem
implementation through the `fs_file_system_t` API struct if only a
subset of the functions are used.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-10-02 14:42:10 +01:00
Johann Fischer b79ffe3582 usb: device: use irq_update in CDC ACM UART implementation
Move the TX/RX ready flag updates into irq_update() where they belong.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:42:02 +01:00
Johann Fischer c5a31aec3c usb: device: cleanup CDC ACM UART rx_ready, tx_ready and is_pending
Align the irq_tx_ready and irq_rx_ready implementations and use them
from irq_rx_pending.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:42:02 +01:00
Johann Fischer 0f0322127d usb: device: avoid starving other threads in CDC ACM UART fifo_fill
The check for the device being configured or suspended in the fifo_fill
implementation can starve other threads, because the early return does
not change the state of the TX path, and fifo_fill is called again
from the callback loop. The ringbuffer that emulates the TX FIFO can be
filled and marked ready as long as the space is available.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:42:02 +01:00
Johann Fischer fe4d8a678c usb: device_next: use delayable work for TX FIFO in CDC ACM
Use delayable work to reduce CPU load when there is no transfer flow in
the host direction. This also improves the performance of poll out, as
introduced in commit commit fed6bde788
("usb: device: cdc_acm: send more than 1 byte in poll out")
for the legacy CDC ACM implementation.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:41:50 +01:00
Johann Fischer 4875aa3924 usb: device_next: limit CDC ACM OUT transfer size to the current MPS
When the controller is connected to a full speed bus, regardless of
whether the controller supports high speed or not, the transfer size for
the bulk OUT endpoint should be equal to the MPS in the current
configuration.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:41:50 +01:00
Johann Fischer ef89321160 usb: device_next: allow fifo_fill and poll_out be used simultaneously
As it is still accepted practice, allow fifo_fill and poll_out to be
used simultaneously. The lock around fifo_fill was already in place.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:41:50 +01:00
Johann Fischer 6cf27758d3 usb: device_next: align CDC ACM UART poll_out with legacy implementation
Apply changes in commit c152e0980c
("usb: device: cdc_acm: block in uart_poll_out() routine")
to the new CDC ACM UART poll_out implementation.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:41:50 +01:00
Johann Fischer 64ee885950 usb: device_next: align CDC ACM UART with Interrupt-driven UART API
Align CDC ACM UART with Interrupt-driven UART API behavior description.
Use the same flags in uart_irq_rx_ready(), uart_irq_tx_ready(), and
uart_irq_is_pending(), which are updated after each uart_irq_update()
call. Allow TX FIFO to be filled if there is space.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-02 14:41:50 +01:00
Lyle Zhu 4c09f5cce3 Bluetooth: BR: Shell: Remove duplicated `else` statement
Remove duplicate `else` statement if the function is returned from
corresponding `if` statement.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:15:14 +02:00
Lyle Zhu 0270f91c1c Bluetooth: BR: Shell: Return error if command is failed
Return error code if the command is failed instead of `0`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:15:14 +02:00
Lyle Zhu 3b74ed3f54 Bluetooth: BR: shell: Rename `int res` to `int err`
Rename `int res` to `int err`. Make variable naming consistent.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:15:14 +02:00
Lyle Zhu 17cfe36195 Bluetooth: BR: Return `SHELL_CMD_HELP_PRINTED` if calls shell_help
If the function `shell_help` is called, return SHELL_CMD_HELP_PRINTED
instead of `0`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:15:14 +02:00
Lyle Zhu 0b6684d8e3 Bluetooth: l2cap_br: Comment on l2cap->info_fixed_chan
Comment on the l2cap->info_fixed_chan why the size of it is one octet.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:14:18 +02:00
Lyle Zhu f1d9549a0c Bluetooth: BR: SMP: Check if remote supports CID 0x0007
Add a function bt_l2cap_br_get_remote_fixed_chan to get the remote fixed
channels.

If the fixed channel CID 0x0007 is unsupported, skip the LTK derivation.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:14:18 +02:00
Alberto Escolar Piedras ca26820ac1 ipc: icmsg: Check return error of pbuf_rx_init()
When pbuf_rx_init() was added, this caller did not check for a possibly
returned error to not have more overhead than before using this
function.
Although unlikely let's check for a possible error (not configured Rx
pbuf cfg).

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-10-02 10:09:18 +02:00
Lyle Zhu ff39d41034 Bluetooth: ssp: correct pairing failed callback
Current, the callback `pairing_complete` is called
when the pairing is filed. But there is a callback
`pairing_failed` for pairing failed case.

Correct the callback calling if pairing failed.
Call `pairing_failed` instead of `pairing_complete`
if the pairing failed.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:09:00 +02:00
Lyle Zhu f9c490b7e1 Bluetooth: LE: SMP: Set CT2 bit by default
Set CT2 bit to auth_req field by default if
the BR is enabled.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:08:44 +02:00
Lyle Zhu c7db41dddb Bluetooth: BR: SMP: Set CT2 bit by default
Set CT2 bit by default.

If CT2 bit is set by both side, set the
CT2 flag `SMP_FLAG_CT2`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:08:44 +02:00
Lyle Zhu 8c8a21a04c Bluetooth: BR_SMP: Add a flag BT_CONN_BR_PAIRED
Due to the BT_CONN_BR_PAIRING is cleared when
receiving ssp pairing complete event. The LTK
key cannot be derived after the BR connection
encrypted.

Add a flag BT_CONN_BR_PAIRED that the pairing
has been done.

Use this flag to indicate whether the LTK
derivation needs to be applied if the BR ACL
connection is encrypted.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:08:34 +02:00
Lyle Zhu 91db52c431 Bluetooth: SSP: clear pairing flag if ssp pairing completed
When the ssp pairing event is notified, clear the pairing
flag.

It is used to support case that the authentication is
started by peer, the link will not be encrypted after
the pairing is completed without any err.
If the local device want to encrypt the link, it could
call `bt_conn_set_security` to start encrypt the link
after the pairing complete callback triggered.

In original implementation, the `bt_conn_set_security`
cannot be called if the authentication has been started.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:08:34 +02:00
Lyle Zhu 08ceb14299 Bluetooth: Host: SSP: Correct BR bonding type
Currently, the bonding type of Authentication
_Requirements parameter is always `Dedicated
Bonding` if the device is pairing initiator.

But if the bonding is performed during
connection setup or channel establishment as
a precursor to accessing a service, the
bonding type should be `General bonding`.

Add a flag BT_CONN_BR_GENERAL_BONDING.
Set the flag if the bonding is performed in
the L2CAP_BR/RFCOMM channel establishment.

Set bonding type depends on the flag when
receiving IO cap request.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:07:09 +02:00
Lyle Zhu 832753b80c Bluetooth: BR: Change the type of `resolving` to `bool`
The `resolving` is used to flag the status that the stack is requesting
remote device name.

It is better to use the type `bool` instead of the original type
`uint8_t`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:05:32 +02:00
Lyle Zhu b1dc7ff242 Bluetooth: BR: Optimize _priv of struct bt_br_discovery_result
Move `struct discovery_priv` to classic.h

Rename `struct discovery_priv` to `struct bt_br_discovery_priv`.

Modify the structure `struct bt_br_discovery_priv` with `@private`.

Change field `_priv` of `struct bt_br_discovery_result` from
`uint8_t _priv[4]` to `struct bt_br_discovery_priv _priv`.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:05:32 +02:00
Lyle Zhu d92bc8ab30 Bluetooth: shell: BR: update device discovery
Due to the update of function bt_br_discovery_start,
register discovery callback by calling
bt_br_discovery_cb_register.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:05:32 +02:00
Lyle Zhu f670e3a52f Bluetooth: Classic: Remove callback from bt_br_discovery_start
Remove BR discovery callback from bt_br_discovery_start.

All discovery results will be notified through callback
registered by bt_br_discovery_cb_register.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:05:32 +02:00
Lyle Zhu d0f5b6c351 Bluetooth: BR: Add listener cb for discovery
The results of inquiry and extended inquiry
are only reported from application level
after the inquiry complete event notified.

While the event of inquiry result is notified
by controller in real time.

It is not a good user experience.

Just like scanning of LE, add a listener
cb for discovery.

When the event of inquiry result, extended
inquiry result, or remote name request
complete notified, call listener `recv`
cb to notify the upper layer.

When the event of inquiry complete
notified or no pending of remote name
request , call listener `timeout`
cb to notify the upper layer.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-10-02 10:05:32 +02:00
Andrew Davis df64d076d8 ipc: ipc_service: Inline libmetal_{setup,teardown}() for correct ordering
Currently metal_init() is called as part of libmetal_setup() which is
called after libmetal has already started being used (metal_io_init
called before). Same for metal_finish() but in reverse (metal_io_finish
called after). To fix this inline the content of libmetal_{setup,teardown}
into their one call-sites and move the init/finish calls to the correct
spot before/after all uses of the lib.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-10-02 10:04:59 +02:00
Andrew Davis be4a4ee324 ipc: ipc_service: Remove intermediate metal generic device
A libmetal "generic" device is created, then opened and used for its IO
regions. Since we are adding these IO regions in the first place there
is no reason for this layer of indirection.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-10-02 10:04:59 +02:00
Andrew Davis d58542fcc4 ipc: rpmsg_service: Remove virtual shared memory device
A virtual metal_device is created, next the needed IO regions are created
and added to this device. Immediately we extract these regions back out
and make use of them. There is no reason to create the metal_device and
add the IO regions to it, instead simply use the IO regions directly.

This is similar to what was already done to the openamp_rsc_table sample.

Signed-off-by: Andrew Davis <afd@ti.com>
2024-10-02 10:04:59 +02:00
Armin Brauns fa8d80a15b bluetooth: honor log panic mode in monitor
Once panic mode is entered, the log write functions are called from an ISR,
so must not try to acquire locks.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2024-10-02 10:00:26 +02:00
Andries Kruithof 8295deb966 Bluetooth: Audio: CAP implement broadcast reception stop
Implement the CAP broadcast reception stop procedures and
add unit tests

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-10-02 09:59:23 +02:00
Jordan Yates 81352d011f serial/usb: update `struct ring_buf` users
Update the interrupt driver UART drivers that use `struct ring_buf`
internally to report the number of bytes that can be pushed in
`uart_fifo_fill` without fragmentation.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-10-02 09:56:45 +02:00
Krzysztof Sychla 5d76b563ea arch: Add Cortex-R8 support
Enable Cortex R8 support, similar to Cortex-R5.

Signed-off-by: Krzysztof Sychla <ksychla@antmicro.com>
Signed-off-by: Marek Slowinski <mslowinski@antmicro.com>
Signed-off-by: Piotr Zierhoffer <pzierhoffer@antmicro.com>
Signed-off-by: Mateusz Hołenko <mholenko@antmicro.com>
2024-10-01 09:58:22 +02:00
Emil Gydesen fa4f2ffc47 Bluetooth: CAP: Add support for doing just disable for unicast stop
The unicast_stop function is changed to primarily do a
BAP disable instead of a release, with optional
support for releasing the streams once they have been disabled.

This also adds unittests for the procedure which also
allow us to remove the invalid param testing from the BSIM tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-01 09:54:04 +02:00
Jamie McCrae 18b20058a0 dfu: Add missing depends on for progressive erase
Adds a depends on that requires the underlying driver support
explicit erase

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-10-01 09:46:18 +02:00
Jukka Rissanen 2ff26674a2 net: dns: Check that dispatcher table is not overflowing
Add CHECKIF() checks that verify that dispatcher table is
not overflowing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-30 17:12:15 +01:00
Jukka Rissanen 077dd8f142 net: dns: Increase the size of dispatcher table
The dispatcher table needs to be large enough to have support
for all file descriptor values.

Fixes #79042

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-30 17:12:15 +01:00
Gerard Marull-Paretas 740eba1341 pm: device: allow optional support of TURN_ON action
Some devices, e.g. SoC level devices like I2C peripheral, can never be
powerd off as they are always energized. Such devices can only go from an
active state or to a low power state (suspended). Allow them to simply
return -ENOTSUP when called with TURN_ON (or TURN_OFF).

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-09-30 17:11:20 +01:00
Dominik Lau 319d67f7d3 fs: ext2: add alignment for superblock
Reading superblock didn't work with DMAs that only support aligned reads
(e.g. STM32 DMA).

Co-authored-by: Maciej Sobkowski <msobkowski@antmicro.com>
Signed-off-by: Dominik Lau <dlau@internships.antmicro.com>
2024-09-30 17:10:56 +01:00
Reto Schneider 8fda052826 net: Give name to logging choice
This allows downstream modules to overwrite the default log level choice
using Kconfig.defconfig files.

For example, this becomes possible:

```
choice LWM2M_LOG_LEVEL_CHOICE
  default LWM2M_LOG_LEVEL_WRN
endchoice
```

In contrast to the configuration method, this then has an effect on all
applications stored in the downstream module.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-09-30 12:10:42 +01:00
Marek Pieta 88231b5583 usb: device_next: usbd_hid: Fix size in HID report get
Since UDC buffers are allocated with `UDC_BUF_GRANULARITY` granularity,
the `net_buf_tailroom` may no longer be equal to the HID report size.
Use `setup->wLength` instead to ensure that proper HID report size is
passed to the application's callback.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2024-09-30 10:49:20 +02:00
Pisit Sawangvonganan c9f9d5cdda net: tcp: remove redundant null check for `conn` in `net_tcp_put()`
A null check for the TCP connection `conn` was added at the start of
the function, but the previous checks were not removed, leading to
a redundant null check, which is unnecessary.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-30 09:04:48 +02:00
Guennadi Liakhovetski c6bf743df2 LLEXT: add support for detached sections
Some LLEXT objects can include sections, that should not be merged
with other sections of the same type. E.g. when such sections should
be placed into locations, other than the default. Add support for
such sections.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-29 21:21:24 +02:00
Guennadi Liakhovetski 0aa6b1c9de llext: pass the whole struct llext_load_param
To simplify LLEXT loader parameter extension pass the whole
struct llext_load_param to final consumers instead of extracting
individual fields from it in the caller function.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-29 21:21:24 +02:00
Guennadi Liakhovetski f04e646af0 llext: (cosmetic) use a more common name for a variable
It's more common in the LLEXT code base to call elf_sym_t instances
"sym" and not "sym_tbl." Convert llext_link_plt() to follow this
convention.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-29 21:21:24 +02:00
Guennadi Liakhovetski 43a69f868b llext: make llext_loaded_sect_ptr() available to all LLEXT code
Make llext_loaded_sect_ptr() a proper function to be able to call it
from platform LLEXT code.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-09-29 21:21:24 +02:00
Pete Skeggs 09fab7e680 net: lib: http: ensure SYS_FOREVER_MS behavior
The http_client_req() function's timeout parameter is allowed
to be SYS_FOREVER_MS. However, K_MSEC() does not convert this
to a proper k_timeout_t, so sys_timepoint_calc() ends up
returning 0, which is causes immediate timeouts.

Check for this case specifically and force value passed to
sys_timepoint_calc() to be correct.

Signed-off-by: Pete Skeggs <peter.skeggs@nordicsemi.no>
2024-09-29 21:20:50 +02:00
Arif Balik 8742d9f25e logging: backend: add semihosting
Added semihosting support in logging backend

Signed-off-by: Arif Balik <arif.balik@enda.com>
2024-09-28 08:18:00 -05:00
Krzysztof Chruściński c2454f2a9f logging: frontend: stmesp: Do not append strings when not needed
Currently we can assume that flpr and ppr cores are always owned by
cpuapp. In that case, cpuapp (which processes ETR buffer content) has
access to the memory where logging strings from ppr and flpr are
located. Those strings do not need to be appended to the message
which is written to the STM (in case of standalone configuration).
This approach reduced logging time, e.g. logging a message with
one argument takes 1.8us on cpuapp and 6.3us on cpurad.

This setting applies only to the case when cpuapp is the owner
of those co-oprocessors and shall be updated if that becomes
configurable but currently there are no means to detect core
owner.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-09-27 14:30:57 +01:00
Morten Priess 7e892f8c6f Bluetooth: controller: Remove SC-jitter from ISO pause/resume setup
Because timing of the pause/resume for peripheral/sync is based on
central/broadcaster active clock, the sleep-clock jitter shall not be
added.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-09-27 09:03:37 +02:00
Morten Priess fe83a9dc22 Bluetooth: controller: Fixes and improvements for PTO implementation
- Add next pointer to node_rx_iso_meta for pre-transmission linked
  list (does not increase memory usage as union is larger).
- Fix broadcaster not setting PTC with test configuration
- Refactor stopping of sync ISO tickers to separate function

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-09-27 09:03:37 +02:00
Morten Priess 541b516a3f Bluetooth: controller: Make ISO Pause/Resume common
Share pause/resume functionality by moving resume ticker handling to
ull_iso. Rename interface function to ull_conn_iso_resume_ticker_start,
and provide handles instead of instance pointer.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2024-09-27 09:03:37 +02:00
Jamie McCrae 9c821eb999 mgmt: mcumgr: grp: img_mgmt: Add slot info command
Adds a new command that will return information on slots
themselves, listing the slot sizes, without any internal
information about the slot data. Will also return the maximum size
of an image for a set of slots if built using sysbuild.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-09-26 17:48:05 -04:00
Vinayak Kariappa Chettimada b423941010 Bluetooth: Controller: Remove unused nRF21 FEM SPI CSN control
Remove unused nRF21 FEM SPI CSN control as the Zephyr
Controller does not implementation SPI control for Tx/Rx
nor for Tx gain settings.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-09-26 17:43:34 -04:00
Babak Arisian c0cfe49a54 Bluetooth: BASS: Add support for dynamic registration of BASS
Added support for dynamic registration and unregistration of the
Broadcast Audio Scan Service (BASS) within the scan delegator.
This enables both scan delegator and BASS to be registered or
unregistered dynamically at runtime.

Signed-off-by: Babak Arisian <bbaa@demant.com>
2024-09-26 17:42:39 -04:00
Jamie McCrae 770482a45a mgmt: mcumgr: grp: os_mgmt: Fix issues raised in comments
Fixes an issue with structure which was previously raised in a
comment, and adds a new bool to the structure to enable this
restructure to work

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-09-26 17:42:01 -04:00
Emil Gydesen ec2c5b0c1f Bluetooth: GATT: Replace magic number 0 with macro for auto ccc
Replace the magic number 0 with a #defined value for
the auto CCC discovery feature.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-26 17:41:24 -04:00
Francois Gervais bfed8d0966 net: lib: coap_client: wait for all acknowledgements
This commit makes sure we continue to wait for extra confirmations even
after the request is done so we can handle duplicate confirmations if any.

Detailed description:

rfc7252#section-4.5 specifies that:

"The recipient SHOULD acknowledge each duplicate copy of a
 Confirmable message".

So if, for example, the client sends to a multicast destination address,
the server will get multiple requests and will confirm all of them.

Without this commit, the client will set the request to done after
receiving the first answer.
From here the request object will be marked as free and the duplicate
acknowledgements will stay buffered in the network stack.
Once the client tries to send a new request, it will unbuffer those
duplicate acknowledgements but now the request object is unallocated
so the client won't be able to handle those acknowledgements as duplicates.
It will instead treat it as an unexpected ACK.

To work around this issue, rfc7252#section-4.8.2 states that:

"EXCHANGE_LIFETIME is the time from starting to send a Confirmable
 message to the time when an acknowledgement is no longer expected,
 i.e., message-layer information about the message exchange can be
 purged."

Keeping the request object allocated for EXCHANGE_LIFETIME ensures that
duplicate acknowledgements can be handled accordingly.

This commit adds a basic implementation of what is stated in the RFC.

EXCHANGE_LIFETIME has been arbitrarily set to 3 * ACK_TIMEOUT which
seems more reasonable than the 247 seconds stated in the RFC.

Signed-off-by: Francois Gervais <francoisgervais@gmail.com>
2024-09-26 09:20:23 -05:00
Rubin Gerritsen 417a9e81ec Bluetooth: Controller: Add device tree dependency to selection
This commit makes the device tree configuration decide
which link layer is compiled in. We do this to avoid
hard-to-understand linker errors referencing device tree nodes.

The following configuration creates a difficult to parse
linker error:
* BT_LL_CHOICE contains multiple entries, BT_LL_SW_SPLIT
  is selected.
* Each BT_LL_CHOICE has its own unique device tree node with its
  own "compatible".
* Only one of the link layer device tree nodes has status "okay",
  but not the one corresponding to BT_LL_SW_SPLIT.

The linker error indicates that code using the HCI driver fails
to link with the controller. This because the HCI driver device
tree node references the link layer selected in devicetree which
is not compiled in.

By adding a dependendency to the device tree node, this can no longer
happen. Instead, if BT_LL_SW_SPLIT is now selected in a configuration
file, a Kconfig warning will be issued:

```
warning: The choice symbol BT_LL_SW_SPLIT
(defined at subsys/bluetooth/controller/Kconfig:129) was
selected (set =y), but BT_LL_SOFTDEVICE (defined at
/home/ruge/ncs/nrf/subsys/bluetooth/controller/Kconfig:11)
ended up as the choice selection.
```

This should be easier to understand than:

```
...(hci_core.c.obj):(.data.bt_dev+0x16c):
undefined reference to `__device_dts_ord_132'
```

After this commit we should consider getting rid of link layer
selection from Kconfig completely as the link layer is in practice
selected through device tree.

Unit tests have been updated to satisfy the dts dependency.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-09-26 11:10:22 +01:00
Robert Lubos da6b607a32 net: tcp: Do not cancel connect sem from tcp_conn_unref()
Resetting the connect semaphore from tcp_conn_unref() prevents the
ref/unref mechanism from being used freely when needed. Therefore, move
the code responsible for resetting pending connection to
tcp_conn_close() (called only when the connection is being closed on
behalf of the TCP stack, for instance due to RST being received) and to
net_tcp_put() (connection closed on behalf of the application).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-09-26 10:58:37 +01:00
Jukka Rissanen a41f625fab net: tcp: Make sure that connection failure is propagated to app
It is possible that TCP connect() will fail if for example network
interface does not have IP address set. In this case we close
the connection during net_tcp_connect() but do not set the return
code properly. This looks in the application like the connection
succeeded even if it was not.

As the tcp_in() call in net_tcp_connect() might close the connection,
we just take extra ref count while calling tcp_in(). Otherwise we
might access already freed connection.

Before the fix:

net_tcp_connect: context: 0x80757c0, local: 0.0.0.0, remote: 192.0.2.2
net_tcp_connect: conn: 0x8087320 src: 0.0.0.0, dst: 192.0.2.2
tcp_in: [LISTEN Seq=1604170158 Ack=0]
tcp_conn_close_debug: conn: 0x8087320 closed by TCP stack (tcp_in():3626)
tcp_conn_close_debug: LISTEN->CLOSED
tcp_conn_unref: conn: 0x8087320, ref_count=1
net_tcp_connect: conn: 0x8087320, ret=0

After the fix:

net_tcp_connect: context: 0x80757c0, local: 0.0.0.0, remote: 192.0.2.2
net_tcp_connect: conn: 0x8087320 src: 0.0.0.0, dst: 192.0.2.2
tcp_conn_ref: conn: 0x8087320, ref_count: 2
tcp_in: [LISTEN Seq=1604170158 Ack=0]
tcp_conn_close_debug: conn: 0x8087320 closed by TCP stack (tcp_in():3626)
tcp_conn_close_debug: LISTEN->CLOSED
tcp_conn_unref: conn: 0x8087320, ref_count=2
net_tcp: tcp_conn_unref: conn: 0x8087320, ref_count=1
net_tcp: net_tcp_connect: conn: 0x8087320, ret=-128

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-26 10:58:37 +01:00
Alberto Escolar Piedras b5b91b3edb ipc: icmsg & icbmsg: Add support for POSIX arch targets
Add support in this IPC backends for POSIX arch targets in general,
and ensure the nrf5340bsim defines the buffer which will be used.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-09-26 03:34:26 -04:00
Alberto Escolar Piedras 5dc810e261 ipc: pbuf: Provide function for Rx side initialization
Provide a new function for initializing the Rx side,
so users do not need to initialize the pointers by hand
if they did not use PBUF_DEFINE().

Let's also rename pbuf_init() to pbuf_tx_init() to clearly
signify the previous function was only meant to be used
by the Tx side.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-09-26 03:34:26 -04:00
Alberto Escolar Piedras b6f1767db5 subsys/ipc icmsg_me.c: Fix ssize_t build error for some libCs
ssize_t is not part of the C library ISO standard subset, and as such
one cannot expect a C library to expose the type by default.
Some libraries like glibc do not expose this type in general, and
trying to build using them results in build errors.

There is 3 possible options:
1. Continue using ssize_t and:
1.a define _POSIX_C_SOURCE before including any header
1.b include sys/types.h directly (A bit uglier)
3. Not use ssize_t, and instead rely on ISO standard types

Let's just go with 1.a assuming we want to keep using this type,
as that is the correct way of getting this type defined.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-09-26 03:34:26 -04:00
Ben Wolsieffer 063b146eb4 net: tcp: Fix net_tcp_endpoint_copy() with IPv4 disabled
The IPv6 branch of net_tcp_endpoint_copy() was accidentally made
conditional on CONFIG_NET_IPV4 rather than CONFIG_NET_IPV6.

Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com>
2024-09-26 03:32:26 -04:00
Emil Gydesen fff3ff02c5 Bluetooth: CSIP: Add bonding requirement for set lock/release
The CSIP spec states that the procedures shall only be done
on bonded devices, so a check for that was added.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-26 03:31:47 -04:00
Torsten Rasmussen 205691edce cmake: linker: evaluate CONFIG_LINKER_ITERABLE_SUBALIGN in CMake
Evaluate CONFIG_LINKER_ITERABLE_SUBALIGN in CMake instead of in the
linker script.

It cannot be assumed that a linker generator implementation is
pre-processed and therefore Kconfig settings cannot be used in those
but must be evaluated in CMake.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-09-25 16:16:35 -05:00
Jukka Rissanen 765bfbbc3c net: stats: dns: Collect DNS statistics
If DNS statistics is enabled in Kconfig, then start to collect it.
This is useful in order to see how many DNS requests/responses
received or sent, and also see the amount of dropped DNS packets.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-25 13:52:15 -05:00
Jukka Rissanen ca0bd2cc23 net: mdns: Discard the message if query count is 0
As described in RFC 6804 ch. 2, if query count is 0, discard
the message silently.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-25 13:52:15 -05:00
Luca Burelli db451f2c46 llext: export DT devices to extensions
This change adds a new configuration option, LLEXT_EXPORT_DEVICES, which
enables exporting all devices defined in the device tree to llext
extensions. When enabled, all devices are made available to extensions
via the standard DT_ / DEVICE_* macros.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-09-25 12:59:13 +02:00
Burak Gorduk 6e3c3f67e1 bluetooth: host: Use consistent API naming for CS
This change adds bt_le_cs prefix to public CS API as well as
adding le_cs prefix to CS related bt_conn callbacks. This is
to ensure consistency within CS API while maintaining the
separation between the Bluetooth LE and Classic features.

Signed-off-by: Burak Gorduk <burak.gorduk@nordicsemi.no>
2024-09-25 12:58:51 +02:00
Burak Gorduk 7b82214d29 bluetooth: host: HCI support for CS configuration
Adds following HCI support for CS configuration:
- LE CS Create Config command
- LE CS Remove Config command
- LE CS Config Complete event

Two callbacks have been added to notify the application
when a new CS configuration is created or an existing
CS configuration is removed.

Signed-off-by: Burak Gorduk <burak.gorduk@nordicsemi.no>
2024-09-25 12:58:51 +02:00
Babak Arisian d8c1d4d7b6 Bluetooth: Host: BT scan failure when connecting by name in shell
Added a timeout for active scans (instead of using the host's scan
timeout) in the shell by submitting a k_work that stops the scan
after a specified period.

Fixes #78659

Signed-off-by: Babak Arisian <bbaa@demant.com>
2024-09-25 12:58:11 +02:00
Olivier Lesage 7538a981c9 bluetooth: host: set BT_BUF_EVT_RX_SIZE to 255 when CS is enabled
Channel sounding frequently produces very large events, so the default
of 68 bytes can lead to buffer overruns / memory corruption.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-09-25 04:05:14 -04:00
Lyle Zhu 18d1ca7c78 Bluetooth: classic: Fix LE LTK cannot be derived issue
In the handler of SMP_Pairing rsp, the encryption key
flag is cleared incorrectly.

It causes the LE LTK cannot be derived.

Do not modify the encryption key flag to fix the
issue.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-09-25 04:02:11 -04:00
Yangbo Lu 6fe7f6c55d net: lib: http_server: fix snprintk issue of size_t
The size_t type may vary from machines. Current snprintk code was
causing below build issue on arm64.

error: format '%x' expects argument of type 'unsigned int', but argument
4 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=].

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2024-09-25 04:00:02 -04:00
Fin Maaß 99e6280d7e logging: log_output: timestamp_print uses gmtime_r, a POSIX function
Define _POSIX_C_SOURCE for this file to make sure gmtime_r is visible.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-09-24 14:29:02 -05:00
Fin Maaß 1d91d0f269 logging: log_output: switch to gmtime_r
switch from gmtime() to gmtime_r().

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-09-24 14:29:02 -05:00
Fin Maaß 54b2f56984 logging: add ISO 8601 formated timestamp
add ISO 8601 formated timestamp for logging.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-09-24 14:29:02 -05:00
Fin Maaß 20a6ad7918 logging: add formated timestamp for realtime
This adds a timestamp format mode, that includes the date, which is
usefull, when using realtime for the logging timestamp.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-09-24 14:29:02 -05:00
Fin Maaß 683ae11510 logging: net: don't replace syslog timestamp
this way CONFIG_LOG_OUTPUT_FORMAT_CUSTOM_TIMESTAMP
only uses the custom timestamps for
logs that are not send via syslog.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-09-24 14:29:02 -05:00
Emil Gydesen 1406c547d6 Bluetooth: TBS: Add support for dynamic TBS
The TBS and GTBS instances can now be dynamically registered
and unregistered, which fits better for the use cases of TBS
where specific bearers can come and go depending on the
features of the device.

For example if a SIM card is inserted, then a device can
register a TBS for the provider and remove it again if the
SIM card is removed.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-24 09:21:54 -04:00
Emil Gydesen bf897cf941 Bluetooth: Shell: Restructure shell files
Moves around the shell files so that they are placed nearer
to the features they expose access to.

A few changes as possible has been made.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-24 09:21:04 -04:00
Carlo Kirchmeier cb304318df net: dns: Improve interface count mismatch warning
In order to reduce confusion regarding interface count
the respective warning was adjusted to better reflect
the actual state of the system.

Signed-off-by: Carlo Kirchmeier <carlo.kirchmeier@zuehlke.com>
2024-09-24 09:20:48 -04:00
Jukka Rissanen 00bb90a42e net: if: Check chksum offloading properly for VLAN interfaces
Make sure we check the checksum offloading capabilities correctly
for VLAN interfaces. Use the real Ethernet interface when doing the
check.

Fixes #78724

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-24 10:11:33 +02:00
Mateusz Kapala 77555898de mgmt: mcumgr: Add SMP SVC and CHR UUIDs to header
Added the SMP service and characteristic UUIDs to the smp_bt module
header and used those definitions.

Signed-off-by: Mateusz Kapala <mateusz.kapala@nordicsemi.no>
2024-09-23 18:10:49 -04:00
Emil Gydesen 4e4971b25d Bluetooth: GATT: Fix issue with 0/NULL for bt_gatt_attr_read
The bt_gatt_attr_read function did not properly handle cases
where value is NULL and/or value_len is 0, or bad mixes of the
two.

The important part is here is that we do not perform the pointer
arithmetic on NULL and/or call memcpy with a NULL src with a
non-0 length.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-23 18:09:13 -04:00
Jukka Rissanen 8aab3ca39d net: shell: Allow user to disable not used commands
User can set CONFIG_NET_SHELL_SHOW_DISABLED_COMMANDS=n to prevent
unused net-shell commands from showing. This can save flash as
the disabled commands will not be shown in net-shell listing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-23 14:10:15 +01:00
Jukka Rissanen 9d9398f42d net: shell: iface: Add DHCPv6 status prints
It is useful to know the currect status of DHCPv6 client when
printing the interface information.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-23 14:10:15 +01:00
Jukka Rissanen e459191ace net: shell: dhcpv6: Add cmd to start/stop DHCPv6 client
Allow user to use the net-shell to start or stop DHCPv6 client.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-23 14:10:15 +01:00
Jukka Rissanen bc003db998 net: shell: dhcpv4: Add cmd to start/stop DHCPv4 client
Allow user to use the net-shell to start or stop DHCPv4 client.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-23 14:10:15 +01:00
Jukka Rissanen 7e4a2c6d46 net: shell: virtual: Add attach/detach commands
Allow "net virtual" command to attach or detach virtual
interfaces. This is useful for device management.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-23 14:10:15 +01:00
Emil Gydesen 72829b3b77 Bluetooth: ISO: Added missing NULL checks for API functions
Add missing NULL check for public API function, so that the
function will return -EINVAL rather than crashing.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-23 14:08:52 +01:00
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
Robert Lubos bd56fecc61 net: iface: Add missing interface mutex locks
net_if_ipv4/6_addr_rm() were missing the iface mutex lock, this commit
adds it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-09-17 17:45:34 +01:00
Simon Walz 5af3fbadfd net: lwm2m: check each block for TLV header
For composite operations, we should always check whether the TLV header
is present. Otherwise, all blocks are assigned to one resource.

Signed-off-by: Simon Walz <simon.walz@autosen.com>
2024-09-17 17:45:17 +01:00
Simon Walz e20ef4443e net: lwm2m: check lwm2m path level while getting the block ctx
The Block1 context for composite operations is not found, as all path
levels are compared. The incoming path level should therefore always be
taken into account.

Signed-off-by: Simon Walz <simon.walz@autosen.com>
2024-09-17 17:45:17 +01:00
Jamie McCrae 87a18400dd mgmt: mcumgr: grp: os_mgmt: Add optional bootloader info hook
Adds an optional hook that allows for appending additional
responses to the bootloader info command

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-09-17 17:45:04 +01:00
Jukka Rissanen 9acf53e412 net: context: Set IPv4 address properly for sendmsg()
When using sendmsg() and if CONFIG_NET_IPV4_MAPPING_TO_IPV6 is
enabled, then the addr4 variable was set too late which was causing
null pointer access.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-17 05:22:48 -04:00
Ingar Kulbrandstad d41e834bbe tests: bluetooth: mesh: Removed native_posix and renamed sim_ids
Removed deprecated native_posix as test platform.
Added unique sim_ids for tests with the psa as a overlay.
Fixed clang-format issues.

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev e0f5f3acf4 bluetooth: mesh: brg_cfg_srv: ignore message with invalid parameters
When a message with invalid parameters is received, we must ignore it.

In this commit we check invalid parameters first.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev dd7b6757f4 bluetooth: mesh: brg_cfg: use IS_ENABLED macro optimally
If use `IS_ENABLED` macro inside if statements but not as preprocessor
directives, we can always compile the code for settings even if settings
are not used. This allows to reduce amount of firmwares we need to build
in CI to ensure that code compiles.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev 945e320e75 bluetooth: mesh: brg_cfg_srv: check buf tailroom before packing data
We must tcheck if buf has enough tailroom to fit another pair of keys or
pair addresses with direction.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev f44ee3c50c bluetooth: mesh: adv_ext: resched main adv set if relay doesn't have own
If relay feature doesn't have own adv set, it should use the main adv
set to send messages.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev 76f015b61f bluetooth: mesh: brg_cfg_cli: copy buf in synchronous api
When a synchronous API is used, the content of `buf` will not be
valid by the time the thread that called the synchronous API is woken up
again.

Therefore, the simplest way to solve this is when a user allocates the
buffer which will be filled up with the content of the buffer passed to
the model callback.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev 6c94d3bec6 bluetooth: mesh: net: bridge traffic regardless of relay state
The Subnet Bridge node must bridge traffic regardless of the Relay
state.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev 957bb4754a bluetooth: mesh: net: use subnet credentials when relaying
When relaying a Network PDU to another subnet, we need to update sub
field of rx structure so that correct credentials are used. We also need
to update NID field of the Network PDU.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev abf02719c4 bluetooth: mesh: rpl: fix rpl for subnet bridge
The initial implementation of RPL check for Subnet Bridge wasn't fully
correct. It decides whether to relay or not a PDU based on RPL of only
received messages. However, the spec section 3.9.8 says:

```
In addition, a Subnet Bridge node shall implement replay protection for
all Access and Transport Control messages that are sent to bridged
subnets.

A Subnet Bridge node shall maintain the most recent IVISeq value for
each source address authorized to send messages to bridged subnets.
Messages received by the Subnet Bridge node with the IVISeq value less
than or equal to the last stored value from that source address shall
be discarded immediately upon reception. When a message is retransmitted
to a bridged subnet, the stored IVISeq value shall be updated. In this
way, bridged subnets are protected against replay attacks from other
subnets.
```

This was noticed with MESH/NODE/SBR/NET/BV-02-C test. It passes when
PTS misses the message at step 3 and 4, and fails when PTS manages to
receive the message.

This commit fixes the wrong behavior by removing argument for
`bt_mesh_rpl_check` function making store a new message and bypassing
`local_match` check in case of Subnet Bridge node.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev f06f69a8b8 bluetooth: mesh: brg_cfg: store tbl when changed only
Though nvs backend checks whether the data passed to it is identical to
the stored one, this isn't guaranteed by other the settings api. We can
also avoid going into the settings subsystem since we know what was
actually changed.

This commit adds 2 flags that allow to control whether Subnet Bridge
or Bridging Table states were changed and skips storing if the certain
state was not changed.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev ceba348ca4 bluetooth: mesh: brg_cfg: fix restoring bridging table
We store only filled up entries, but want to restore the entire table.
`bt_mesh_setting_set` fails if the restored length didn't match the
provided length.

This commit fixes the restoring of the bridging table by allowing to
restore any size as long as the stored size is less than the allocated
one and it is a multiple of the size of a single entry.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Ingar Kulbrandstad 0e2f8b21cf Bluetooth: Mesh: Fixed bugs found in PTS testing
Fixed bugs found while running PTS test.

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Omkar Kulkarni fc4576ce3f Bluetooth: Mesh: Add bridging functionality
Adds subnet bridging functionality to the network layer.
Also fixes brg_cfg_srv for minor issues to get it working.

Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Omkar Kulkarni 8210d2da1b Bluetooth: Mesh: Populate Bridge Config Server
Adds implementation for the Bridge Configuration Server model.

Updates `brg_cfg` module to add sanity check for
bt_mesh_brg_cfg_tbl_remove() API. Also, updates the unit test
accordingly.

Adds documentation for the Bridge Configuration Server model

Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Håvard Reierstad 50a4c2d17a Bluetooth: Mesh: Add brg_cfg_cli commands to shell
Adds the Bridge Configuration Client commands to Mesh shell.

Unifies documentation for shell Kconfig options.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Håvard Reierstad d49068e608 Bluetooth: Mesh: Implement Bridge Config Client
Implements the Bridge Configuration Client model.
Adds opcodes for all Bridge messages to `foundation.h`. Adds client-side
support for these messages.
Adds a new Kconfig option for the Bridge Configuration Client model to
configure the waiting time for respones for acked messages.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Omkar Kulkarni 092f808ea4 Bluetooth: Mesh: Adds subnet bridge states
The `brg_cfg` module implements the states needed for subnet bridge
feature. It provides two states - enable state, and bridging table
state. APIs are provided to access and modify the states. The module
handles responsibility of persistence of the states.

Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Ingar Kulbrandstad 709c006b58 Bluetooth: Mesh: Bridge Configuration Client/Server API
Adding documentation and function calles for the API's
in Bridge Configuration Client model and Bridge
Configuration Server model.

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Emil Gydesen eb22e1fc98 Bluetooth: TBS: Make GTBS mandatory
Any places that checked for GTBS is now always enabled
as GTBS is mandatory to support, and the Kconfig option
was removed.

Also removed a duplicate Kconfig option for TBS,
BT_TBS_SERVICE_COUNT, as it was unused.

The other Kconfig option BT_TBS_BEARER_COUNT is used
instead exclusively to set it if needed.

Since GTBS can now exist alone, it must also
support having its own calls and other values.
This means that the GTBS and TBS instances now share
the same underlying struct.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-17 09:45:48 +02:00
Emil Gydesen 4b68043ebb Bluetooth: MPL: Replace busy bool with atomic
Replace the busy boolean flag with an atomic value.
This prevents any race conditions with the MPL implementation.
Modifies where the new atomic value is set and cleared
so that initialization gets to finish before allowing
any reads.

Due to how the MPL is structured, and how a select cannot
be rejected from OTS, this does not give a perfect solution.
Ideally we need a separate object per OTS object, rather than
a shared one, and/or the OTS implemenation would allow
us to reject a select if the object is not currently
available or ready.

This commit does not fix the above issues, as that is a
larger undertaking.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-16 20:18:39 +02:00
Olivier Lesage 788d1a908e bluetooth: host: improve log for unhandled vs events
Aligns the logging unhandled vs events with the regular ones.
Now it prints out the code and length.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-09-16 20:17:57 +02:00
Keith Packard 94043dbefe subsys/shell: cmd_date_set uses gmtime_r, a POSIX function
Define _POSIX_C_SOURCE for this file to make sure gmtime_r is visible.

Signed-off-by: Keith Packard <keithp@keithp.com>
2024-09-16 20:17:35 +02:00
Keith Packard 88359d998c subsys/llext: Allow .exported_sym to be between other data sections
There's no reason for the .exported_sym data to always land at one end of a
data region; the order of sections depends on the whim of the compiler and
assembler.

Ignore overlaps between that region and other data regions.

Signed-off-by: Keith Packard <keithp@keithp.com>
2024-09-16 20:17:35 +02:00
Keith Packard 40ac96aa57 net: dns: Ignore GCC warnings in mdns_responder.c
GCC complains about struct sockaddr accesses due to the various
address-family-specific variants being of differing sizes. Let's not
mess with code (which looks correct), just silence the compiler.

Signed-off-by: Keith Packard <keithp@keithp.com>
2024-09-16 20:17:35 +02:00
Sean Madigan aa67cb238a bluetooth: shell: Add CS to BT shell with set default settings command
Use a new file and command for this where all CS commands
can live.

Added support for bt_cs_set_default_settings command.

Added test case where shell is built with CS to ensure code
is built in CI.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2024-09-16 10:02:58 +02:00
Sean Madigan aedb330c70 bluetooth: host: Add support for CS set default settings
Added support for a new API for setting default channel
sounding settings, this is mainly a wrapper around the HCI
command.

For this add a new module for channel sounding, where new
channel sounding APIs will go.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2024-09-16 10:02:58 +02:00
Sean Madigan 7dff1c1374 bluetooth: kconfig: Add channel sounding kconfigs
Add new controller and host kconfigs for Bluetooth 6.0
Channel Sounding.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2024-09-16 10:02:58 +02:00
Vinayak Kariappa Chettimada 50b07f9480 Bluetooth: Controller: Add missing branch prediction in lll_scan_aux
Add missing branch prediction likely/unlikely hint.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-09-13 17:29:53 -05:00
Vinayak Kariappa Chettimada 176d8ff760 Bluetooth: Controller: Define a macro to validate aux offset value
Define a macro to validate aux offset value as it is checked
both in LLL and ULL execution contexts.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-09-13 17:29:53 -05:00
Vinayak Kariappa Chettimada 9fa18600ee Bluetooth: Controller: Fix hang due to loop in node_rx list
Fix Controller hang due to infinite looping caused by
duplicate node_rx enqueued in auxiliary context.

When LLL scheduling is not applied due to invalid aux offset
then ULL scheduling too would skip setting up the reception
after similarly checking the validity of aux offset required
to schedule the reception of auxiliary PDU. This check in
ULL was after the received node_rx being enqueued into the
auxiliary context causing a loop in the list of node_rx.

Dequeue of a list with a loop of node_rx caused an infinite
loop execution in the Controller.

Regression introduced in commit 3590bd648f ("Bluetooth:
Controller: Fix missing invalid aux offset check").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-09-13 17:29:53 -05:00
Vinayak Kariappa Chettimada 437bfa5b1a Bluetooth: Controller: Infinite loop assertion on node_rx release
Add assertion check to catch infinite loop due to incorrect
node_rx release.

If same node_rx is released twice then it can lead to
infinite looping when releaseing link or node_rx buffers.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-09-13 17:29:53 -05:00
Emil Gydesen 49bd80828d Bluetooth: VOCS: Replace bools with atomic
Replace the booleans used by the VOCS client to use
an atomic value instead.

The flags are modified to be used in a way that prevents
race conditions.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-13 11:38:27 -05:00
Jukka Rissanen cd4b854c89 net: bridge: Ignore promisc mode errors for native-sim
We do not need promiscuous mode setting in host side when testing
bridging with native-sim, so just ignore errors in this case.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-09-13 13:42:20 +02:00
Tomasz Moń 4c6b1e5a65 usb: device_next: uac2: Support multiple sample rates
Add callbacks for setting and getting the sample rate. The callbacks are
optional if all Clock Source entities support only one sample rate.

This commit results in working High-Speed operation with Windows UAC2
driver when the Clock Source is host-programmable. Windows UAC2 driver
won't work if setting sample rate fails even if Clock Source supports
only one sample rate.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-09-13 09:21:58 +02:00