Commit graph

21541 commits

Author SHA1 Message Date
Seppo Takalo
6c169668e9 net: lib: coap_client: Fix timeout for separate response
When waiting for response after receiving the empty Ack, client
actually used way too timeout.
CoAP timeout only holds the timeout value in ms. t0 is the starting time.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-11-21 14:47:38 +01:00
Omkar Kulkarni
95fff388ba Bluetooth: Mesh: Shell: Align commands
Aligns subnet bridge related commands according to conventions used for
rest of the shell commands. Also updates documentations to reflect the
change.

Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
2024-11-21 14:46:31 +01:00
Alberto Escolar Piedras
4294814a23 Bluetooth: Controller: nRF: Support MDK 8.68
TASK_SHUTDOWN was deprecated in newer SOCs and now removed
in MDK 8.68 (nrfx 3.9.0)

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-11-21 09:26:38 +01:00
Emil Gydesen
7a72280d01 Bluetooth: HAS: Change select UTF8 to depends on
Change the select to a depends on for the Kconfig options
for HAS and HAS_CLIENT.

This is an effort to reduce the number of selects used by
LE Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Emil Gydesen
c4fbe38219 Bluetooth: BAP: Depend on BT_PER_ADV_SYNC instead of select
Change the select of BT_PER_ADV_SYNC and BT_EXT_ADV to
depends on. This is an effort to reduce the use of
select for Kconfig options.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Emil Gydesen
4c86a5cc8d Bluetooth: BAP: Depend on BT_PAC_{SNK,SRC} instead of select
Modify ASCS and BAP Broadcast sink to depend on the PAC options
instead of selecting them.

Since Kconfig does not support "depends on X if Y",
a select for PAC_{SRC,SNK} is used depending on
ASCS_ASE_{SRC,SNK}.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Emil Gydesen
c0f86011cb Bluetooth: BAP: Depend on BT_ISO_SYNC_RECEIVER instead of select
The BAP Kconfigs option now depends on
BT_ISO_BROADCASTER instead of selecting it.

This is an effort to reduce the use of select in LE Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Emil Gydesen
d22c7b0cf2 Bluetooth: BAP: Depend on BT_ISO_BROADCASTER instead of select
The BAP_BROADCAST_SOURCE Kconfig option now depends on
BT_ISO_BROADCASTER instead of selecting it.

This is an effort to reduce the use of select in LE Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Emil Gydesen
9b653540b8 Bluetooth: BAP: Use def_bool instead of select for BT_AUDIO_RX/TX
Remove the selects and use  def_bool for BT_AUDIO_RX and
BT_AUDIO_TX.

This is part of an effort to reduce select in Kconfig.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Emil Gydesen
df6b5981bf Bluetooth: Audio: depends on GATT instead of select
Modify the Kconfig options to depend on the GATT
features rather than selecting them.

This is part of an effort to reduce the amount of
selects we use in LE Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Emil Gydesen
6f86adbc0d Bluetooth: BAP: Use def_bool instead of select for BT_BAP_UNICAST
Remove the selects from BT_BAP_UNICAST_SERVER and BT_BAP_UNICAST_CLIENT
and use a def_bool for BT_BAP_UNICAST.

This is part of an effort to reduce select in Kconfig.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Jakub Rzeszutko
1aaf08f7f1 lib: shell: replace strtol with strtoul in cmd_load for address parsing
Addresses in cmd_load() should always be unsigned. Previously, strtol()
was used, which is limited to signed long values, causing issues with
addresses >= 0x80000000. This commit replaces strtol() with strtoul(),
ensuring proper handling of the full 32-bit address space.

Fixes #81343

Signed-off-by: Aaron Fontaine <aaron.fontaine@dojofive.com>
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
2024-11-21 09:17:08 +01:00
Valerio Setti
516886be1b mbedtls: MBEDTLS_ENTROPY_POLL_ZEPHYR default on if MBEDTLS_ENTROPY_C
As long as MBEDTLS_ENTROPY_C is enabled, Mbed TLS needs to
poll some entropy source to gather data that will then be
processed by CTR/HMAC-DRBG modules. This means that in most
of the cases, once MBEDTLS_ENTROPY_C is enabled then also
MBEDTLS_ENTROPY_POLL_ZEPHYR needs to be enabled. This was
done manually until now, as the long list of samples/tests
demonstrate.

This commit solves this dependency by defaulting
MBEDTLS_ENTROPY_POLL_ZEPHYR to on as soon as
MBEDTLS_ENTROPY_C is set. As a consequence, all manual
enablement of MBEDTLS_ENTROPY_POLL_ZEPHYR in samples/tests
are removed.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-20 15:59:40 -05:00
Chaitanya Tata
0f1f01f9f4 net: l2: wifi: Fix the minimum value
802.11 doesn't have specific constraints, it just says that listen
interval should be >=0 and it a 2 byte field.

3 as a typical DTIM value from nRF chipsets, so, remove the hardware
specific line and just set a failure.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-11-20 15:57:06 -05:00
Andi Gerl
9c2421444b net: lwm2m: add set_socketoptions cb to pull context LwM2M context
The pull context LwM2M client's set_socketoptions callback is currently
unused and can't be set by a user. Add a public API to set the
pull context's client's set_socketoptions callback.

Signed-off-by: Andi Gerl <andi.gerl@exacttechnology.com>
2024-11-20 08:23:44 -05:00
Guennadi Liakhovetski
cbb6199e67 LLEXT: no repeated linking with inline relocations
When linking and relocations are performed on the ELF object itself
with no copying, also global binding linking can break references.
Disable linking globally for such cases.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-11-20 10:17:06 +00:00
Tomasz Moń
54dc01153c usb: device_next: check wIndex on Set Address
Set Address behavior is not specified when wValue is greater than 127,
or if wIndex or wLength are non-zero. USB stack did check wValue and
wLength but didn't care about wIndex value. Extend the check so non-zero
wIndex also results in STALL response.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-11-19 18:12:04 -05:00
Håvard Reierstad
b38773f14b Bluetooth: Mesh: Use net xmit params for bridge
Makes sure that the Network Transmit state is used when using a Subnet
Bridge.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-11-19 10:12:19 -05:00
Håvard Reierstad
665a555e75 Bluetooth: Mesh: Use relay bufs/pool for brg_cfg
Adds support for using relay buffers and advertising set for the subnet
bridge feature, even if the relay feature is disabled.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-11-19 10:12:19 -05:00
Krzysztof Chruściński
9917ea4fe6 logging: formatting: Allow coloring in custom cases
In order to support error and warning message coloring
LOG_BACKEND_SHOW_COLOR must be set. Allow setting it for
customized cases.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-11-19 10:12:05 -05:00
Fabian Kainka
c6b663e50b drivers: modem: initialize variables to avoid warn
The variables 'first' and 'next' in function 'stats_buffer_list_first()'
and 'stats_buffer_list_next()' were potentially used uninitialized.

Depending on the compiler and target architecture, this can lead to
different behavior, including warnings or errors when using strict
warning flags.

By initializing these pointers to 'NULL', we ensure consistent and
expected behavior across all toolchains and configurations.

Signed-off-by: Fabian Kainka <kainka@cognid.de>
2024-11-19 10:04:58 -05:00
Johann Fischer
6ee1358519 usb: device_next: support BOS descriptor with vendor request code
Platform capability descriptors such as MSOSv2 or WebUSB BOS have a
vendor request code that is used by the host to perform vendor-specific
requests. Add a convenient way to define and register a platform
capability descriptor with a vendor request node.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-11-19 09:53:29 -05:00
Johann Fischer
34f42d6c71 usb: device_next: support vendor request with recipient device
Allow the user to register a vendor request node identified by the
vendor code (bRequest) and containing two callbacks to handle the vendor
request. The device stack uses the vendor request node to call the
vendor request callbacks when it receives a request of type Vendor,
recipient Device, and bRequest value equal to the vendor code.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-11-19 09:53:29 -05:00
Lingao Meng
b54f49cb8c Bluetooth: Mesh: Fix proxy advertising set sending Mesh messages
When start to sending proxy advertising, will also process in
send_pending_adv, but the bt_mesh_adv_get_by_tag will directly return
buffer from bt_mesh_adv_queue or bt_mesh_relay_queue, which case
mesh messages sent on different sets, can cause peer replay attack.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2024-11-19 09:51:51 -05:00
Krzysztof Chruściński
581c55496d pm: device_runtime: Fix bitfields misuse
PM_DEVICE_FLAG_ISR_SAFE is an enum and it must be converted to
a bit mask before masking with flags.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-11-19 09:51:14 -05:00
Jens Rehhoff Thomsen
b478ffe2ef Bluetooth: host: Fix bug in disconnected handling
When disconnected only the first empty slot in the disconnected_handles
array should be updated.

Signed-off-by: Jens Rehhoff Thomsen <jthm@demant.com>
2024-11-19 09:50:41 -05:00
Daniel Leung
d3695c3284 tests: CONFIG_TEST_USERSPACE selects CONFIG_USERSPACE
CONFIG_TEST_USERSPACE should select CONFIG_USERSPACE as they
should be enabled together. It is no use to enable userspace
tests without enabling userspace.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-11-18 19:30:50 -05:00
Jukka Rissanen
bffa312ea6 net: context: Fix the connect check for IPv4
Make sure that we cannot connect to IPv4 multicast or broadcast
destination address for a TCP socket.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-18 19:29:58 -05:00
Jukka Rissanen
d3bac7047d net: socket: Add support for IP_MULTICAST_IF option
Allow user to set the network interface for multicast sockets
of type SOCK_DGRAM.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-18 19:29:58 -05:00
Jukka Rissanen
056a3d3242 net: if: Add helper to return the first IPv4 address for iface
This is helper is only needed in socket multicast interface selection
where we need to get one address from the interface so that it will
tell (when getsockopt() is used), the interface IPv4 address where
multicast packets will be sent. This is private function which is not
needed in public headers so place the prototype to net_private.h file.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-18 19:29:58 -05:00
Jukka Rissanen
0bd6f3b3f0 net: if: Fix source interface select for IPv4 address
Do the selection same way as in IPv6 so that if user supplies
unspecified destination address, the default interface is selected
the same way.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-18 19:29:58 -05:00
Jukka Rissanen
7bf9f599b1 drivers: net: loopback: Allow tests to control address swapping
Some of the network tests require that source and destination
addresses are not swapped so allow test to control the address
swapping from the test.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-18 19:29:58 -05:00
Jukka Rissanen
96d4f84a52 net: socket: Add support for IPV6_MULTICAST_IF option
Allow user to set the network interface for multicast sockets
of type SOCK_DGRAM.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-18 19:29:58 -05:00
Alberto Escolar Piedras
a785548df6 bluetooth: CTS: Fix includes to avoid build error with some libCs
Remove unnecessary include in header and source file.

gmtime_r() is an extension to the C library, and therefore one
needs to explicitly ask for its prototype to have it exposed.
This is done by defining _POSIX_C_SOURCE so let's do so.

These two changes fix build errors with some libCs.
Tested with pico, newlib, minimal and the host glibc.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-11-18 19:29:32 -05:00
Zihao Gao
1b8ad2cf40 Bluetooth: AVRCP: allow to parse unit info resposne.
Add AVRCP handler for UNIT INFO responses.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-11-18 13:19:07 -05:00
Zihao Gao
498f81e45f Bluetooth: AVCTP: add error handling for fragmented message.
Fragmented AVCTP message is not supported now. Therefore
A error message is printed.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-11-18 13:19:07 -05:00
Zihao Gao
5d322350b4 Bluetooth: AVCTP: check buffer length before use.
The buffer length shall be validated before extracting
Transaction ID and C/R field.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-11-18 13:19:07 -05:00
Zihao Gao
3e2244d634 Bluetooth: AVRCP: fix bitfield issue.
The bit order can be incorrect when use bit field definition.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-11-18 13:19:07 -05:00
Zihao Gao
9af026dcbf Bluetooth : AVRCP: allow to receive an AVRCP message.
This patch received an AVRCP message and remove timeout timers.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-11-18 13:19:07 -05:00
Zihao Gao
4c932b4b80 Bluetooth: AVCTP: allow to receive an AVCTP message.
This patch received an AVCTP message and forward to the
upper layer, e.g., AVRCP.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-11-18 13:19:07 -05:00
Zihao Gao
e0f1fb0bb6 Bluetooth: Shell: add command to obtain unit info
This patch allow to acquire the unit info of the remote device.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-11-18 13:19:07 -05:00
Zihao Gao
3d9cf59fdd Bluetooth: AVRCP: allow to create and send AVRCP unit message
This patch defines the message format for AVCTP unit message.
This is the first out of the four types of commands and can be
used by the CT to obtain the unit info from the TG device.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-11-18 13:19:07 -05:00
Zihao Gao
3a045fbeea Bluetooth: AVCTP: allow to create and send AVCTP message
This patch defines the message format for general AVCTP.
They would be further called by AVRCP layer.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-11-18 13:19:07 -05:00
Zihao Gao
36acb89803 Bluetooth: AVRCP: add shell tools for AVRCP functions.
Only the basic functions for establishing an AVCTP connection
are provided at this stage.
An BR/EDR ACL connection is necessary before AVRCP function.
Register callbacks before utilizing AVRCP.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-11-18 13:19:07 -05:00
Zihao Gao
4e0dc39e71 Bluetooth: AVRCP: Add SDP attributes.
This patch add SDP records for both CT and TG role.

The SDP attribute would be registered according to the configuration.

OBEX and Browsing commands are optional and yet not supported.

SDP registration is implemented at AVRCP level to simplify the
workload of the upper layer. We assume the App can have limited
knowledge on SDP structures.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-11-18 13:19:07 -05:00
Zihao Gao
70b415dab6 Bluetooth: AVRCP: Implemation of AVRCP.
This patch implementing avrcp.c
New Kconfig BT_AVRCP is provided to enable this layer.
BT_AVRCP_TARGET and BT_AVRCP_CONTROLLER are then
provided to enable one of the two roles independently.
avrcp.h shows the APIs for the upper layer.

Only connection and disconnection interfaces are provided in this patch.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-11-18 13:19:07 -05:00
Zihao Gao
27f71b044a Bluetooth: AVCTP: Implementation of AVCTP.
This patch implementing avctp.c
New Kconfig BT_AVCTP is provided to enable this layer.
avctp_internal.h shows the APIs for the upper layer, i.e., AVRCP.

Only connection and disconnection interfaces are provided in this patch.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2024-11-18 13:19:07 -05:00
Daniel Leung
01f8e0fa2d demand_paging: eviction: add kconfig CONFIG_EVICTION_TRACKING
This adds a new kconfig for eviction algorithm which needs page
tracking. When enabled, k_mem_paging_eviction_add()/_remove()
and k_mem_paging_eviction_accessed() must be implemented.
If an algorithm does not do page tracking, there is no need to
implement these functions, and no need for the kernel MMU code
to call into empty functions. This should save a few function
calls and some CPU cycles.

Note that arm64 unconditionally calls those functions so
forces CONFIG_EVICTION_TRACKING to be enabled there.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-11-18 13:16:44 -05:00
Ludvig Jordet
1f9baa3ac3 Bluetooth: Host: Refactor legacy adv creation
This fixes #78721 which was introduced in PR #44686, which changed (and
renamed) `adv_new_legacy`/`adv_get_legacy` to return an existing
`bt_dev.adv` if it existed. This caused a problem, where the existing
adv then would be used to start advertising, and if this fails (because
the adv is already advertising, for instance), `bt_le_adv_start` would
erroneously delete the adv, making the host lose the context for the adv
which still is advertising.

Before PR #44686, this would not happen, because `bt_le_adv_start` would
return early when `adv_new_legacy` returned `NULL` and never reach the
delete call.

I have refactored this to make responsibilities a bit more clear:
`adv_create_legacy` now does 1 thing: create an ext adv and assign as
the legacy advertiser. This mirrors `bt_le_adv_delete_legacy` which does
the opposite. I have implemented error codes to match the behavior that
PR #44686 was made to implement.

Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
2024-11-18 13:16:27 -05:00
Jukka Rissanen
247941f79d net: ipv6_fragment: Data in one frag must be multiple of 8
After we take the true MTU into account, we need to send proper
number of bytes (multiple of 8) in one IPv6 fragment.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-18 07:26:07 -05:00