Commit graph

21541 commits

Author SHA1 Message Date
Aleksandr Khromykh
6896075b62 Bluetooth: Mesh: add check for rx buffer overflow in pb adv
There is potential buffer overflow in pb adv.
If Transaction Continuation PDU comes before
Transaction Start PDU the last segment number is set to 0xff.
The current implementation has a strictly limited buffer size.
It is possible to receive malformed frame with wrong segment
number. All segments with number 2 and above will be stored
in the memory behind Rx buffer.

Signed-off-by: Aleksandr Khromykh <Aleksandr.Khromykh@nordicsemi.no>
2022-04-26 11:35:33 +02:00
Aleksander Wasaznik
77ad017672 Bluetooth: Shell: Fix off-by-one in address length validation
Fixes Coverity defect id 248346.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-04-26 11:35:19 +02:00
Emil Gydesen
a796927961 Bluetooth: Audio: Make PACS location optional
Make the PACS location characteristic optional, and
also optionally writable.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-04-26 09:00:48 +02:00
Vinayak Kariappa Chettimada
31f49936e2 Bluetooth: Controller: Fix missing cond. compile for ext. scan filter
Fix missing conditional compile when Advertising Extensions
is enabled without Extended Scan Filter Policy support.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-25 11:44:22 -07:00
Thomas Ebert Hansen
d1c9efa83d Bluetooth: controller: LLCP PRT rewrite
Rewrite the entire Procedure Response Timeout mechanism.

Use two separate timers for local and remote initiated procedures.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2022-04-25 15:36:16 +02:00
Andries Kruithof
ecae7a9c7f Bluetooth: controller: llcp: terminate connection on collission
As per bluetooth spec Vol. 6 part B section 5.3 we need to terminate
the connection under given situation

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2022-04-25 15:35:45 +02:00
Piotr Pryga
0ead951649 Bluetooth: Controller: llcp: Fix PHY update instant val if no PHY change
BT Core spec 5.3 Vol 6, Part B section 2.4.23 LL_PHY_UPDATE_IND says:
"If both the PHY_C_TO_P and PHY_P_TO_C fields are zero then there is no
Instant and the Instant field is reserved for future use."
Fields that are reserved for future shall be filled with zeros.

New LLCPs implementation didn't handle this case and set the instant
as if there were a PHY change. That caused qualification tests to fail.

The commit fixes the issue.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-04-25 13:10:42 +02:00
Vinayak Kariappa Chettimada
4efd9b80c8 Bluetooth: Controller: Fix typo in BT_CTLR_ISOAL_SOURCES prompt
Fix typo in BT_CTLR_ISOAL_SOURCES Kconfig prompt message.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-24 19:47:46 +02:00
Herman Berget
c8b2279f89 Bluetooth: Host: Make tx complete callback work for EATT channels
Previously, if a callback was set for notifications, they would always be
sent over unenhanced ATT.

The nfy_mult_data was bigger than the buffer user_data and we were this
overflowing the buffer when setting the tx callback user_data. Now the
data is stored separately and only a pointer to it is added to the
buffer user_data.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-24 19:46:41 +02:00
Herman Berget
cf3832f0bf Bluetooth: Host: Add support for tx complete callback for ECRED channels
Previously callbacks were only supported on unenhanced channels.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-24 19:46:41 +02:00
Anas Nashif
399a0b4b31 debug: generate call graph profile data using gprof
This will generate profile data that can be analyzed using gprof. When
you build the application (currently for native_posix only), after
running the application you will get a file "gmon.out" with the call
graph which can be processed with gprof:

  gprof build/zephyr/zephyr.exe gmon.out > analysis.txt

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-04-22 16:04:08 -04:00
Aleksander Wasaznik
8e5c177233 Bluetooth: Host: Validate IRK ID in range
Validate `id` so that `bt_dev.irk[id]` cannot result in an out-of-bounds
access.

This fixes coverity report 239569.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-04-22 10:24:43 -05:00
Kamil Gawor
3defc3dfc2 Bluetooth: Controller: Fix timings for Tx test
The Tx interval is now calculated at the beginning
of the Tx test and the next transmission is
triggerd by the switch timer instead of event
timer. This fixes a corner case issue when
timer rollover.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2022-04-22 13:46:34 +02:00
Piotr Pryga
77ae58ee72 Bluetooth: Controller: fix wrong use of LE Features in CTE REQ llcp
When Host calls HCI_LE_Connection_CTE_Request_Enable with cte type
set to AoD with 1us slots or AoD with  2 us slots, the Controller
verifies if peer device supports Antenna Switching During CTE
Transmission (AoD) feature.

That is wrong because the feature is marked as optional when send
to peer, so it shall be igonerd by remote device.

There are no means to check if peer device supports particular
CTE type, hence the check has to be removed.

The check causes enable CTE REQ procedure to fail after feature
exchange has happened.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-04-22 09:45:27 +02:00
Piotr Pryga
45bba8e5f8 Bluetooth: Controller: df: Fix missing disable CTE req LLCP after compl
The CTE request procedure can be run in periodic and non-periodic mode.
In periodic mode it stays enabled until Host call HCI_LE_Connection_CTE-
_Request_Enable(Enable=0x0).
In non-periodic mode the command is disabled after completion,
LL_CTE_RSP is successfully received.

There is missing disable of the procedure in the current code,
so Host is not able to run the command HCI_LE_Connection_CTE_Request_-
Enable(Enable=0x1) again without explicit call to HCI_LE_Connection_-
CTE_Request_Enable(Enable=0x0).

The commit adds missing code responsible for disable of the procedure.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-04-22 09:45:14 +02:00
Veijo Pesonen
cfcc891d3d net: lwm2m: makes CBOR as one of the default...
...content formats

In case that SenML CBOR or SenML JSON are both disabled there is need to
use plain CBOR as backup.

Signed-off-by: Veijo Pesonen <veijo.pesonen@nordicsemi.no>
2022-04-22 09:44:36 +02:00
Veijo Pesonen
11b8b4e7ba net: lwm2m: enables CBOR content format
With LwM2M v1.1 the content format is enabled by default.

Signed-off-by: Veijo Pesonen <veijo.pesonen@nordicsemi.no>
2022-04-22 09:44:36 +02:00
Veijo Pesonen
8fd283a788 net: lwm2m: Single instance read&write with CBOR
Raw CBOR content format support.

Signed-off-by: Veijo Pesonen <veijo.pesonen@nordicsemi.no>
2022-04-22 09:44:36 +02:00
Aleksandr Khromykh
a7bb928420 Bluetooth: Mesh: subscription on fixed group addresses
There is errata clarification (Errata ID:18700)
about subscriptions on fixed group addresses.
It is possible to subscribe models on non primary elements
on any fixed group address except all nodes address.
Devices should be able to receive messages on fixed addresses
even if they do not support the feature
to which the fixed group address belongs.

Signed-off-by: Aleksandr Khromykh <Aleksandr.Khromykh@nordicsemi.no>
2022-04-22 09:44:00 +02:00
Emil Gydesen
102a6210bb Bluetooth: Kconfig: Increase TX stack size for BT_CTLR && BT_LL_SW_SPLIT
Increase the default TX stack size for BT_CTLR && BT_LL_SW_SPLIT,
as we have seen applications/samples nearing and even reaching
the stack size, causing stack overflows. This is especially
true if CONFIG_FPU=y which takes 96 bytes of the TX stack.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-04-22 09:43:12 +02:00
Vinayak Kariappa Chettimada
13fe3bb6c3 Bluetooth: Controller: Fix assert on LL BIG terminate
Fix assert on LL BIG terminate call before BIG sync is
established. Assert was caused due to duplicate calls to
release stream contexts, once in LL BIG terminate function
then when releasing the HCI BIG sync failed to be
established node rx was being released.

Use iso_broadcast and iso_receive samples, power cycle the
iso_broadcast device when iso_receive sample is waiting for
BIG sync to be established, iso_receive sample will perform
a BIG sync terminate that leads to the assert.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-22 09:41:50 +02:00
Vinayak Kariappa Chettimada
335315fc71 Bluetooth: Controller: Fix spurious transmit after mic failure
Fix spurious transmit of corrupt PDU after reception of PDU
with MIC failure.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-22 09:41:32 +02:00
Peter Mitsis
a30cf39975 kernel: update k_thread_state_str() API
When threads are in more than one state at a time, k_thread_state_str()
returns a string that lists each of its states delimited by a '+'.
This in turn necessitates a change to the API that includes both a
pointer to the buffer to use for the string and the size of the buffer.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2022-04-20 20:20:13 -04:00
Al Semjonovs
fef6e46f01 ztest: Add Z_TEST_SKIP_IFDEF macro
Defined Z_TEST_SKIP_IFDEF macro to skip tests when specified
config is enabled.

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2022-04-20 15:28:14 -04:00
Omkar Kulkarni
12553800f1 Bluetooth: Mesh: Update defaults - proxy filter, msg cache
This updates the default proxy filter size to 16. Previous value of 3
is too less for the most practical uses and demos. The default proxy
filter type is accept list type and in this mode proxy server rejects
incoming messages from source addresses not in the accept list. The
addresses are added to the accept list when proxy client sends
messages to unicast addresses or manually adds certain addresses to
the accept list. Once this list is full more addresses cannot be added.

This also updates the default network message cache size to 32. The
network message cache helps in preventing duplicate messages getting
repeatedly relayed and helps in reducing unnecessary network traffic.
Previous value of 10 is quite less for most usecases and makes the
node appear to generate much more traffic in mixed network. The
updated value should suffice for most use cases.

Additional explannation is added in Kconfig to help users understand
the significance of this setting.

These two changes result in 176 bytes of additional RAM usage in mesh
samples.

Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
2022-04-20 16:36:42 +02:00
Peter Mitsis
79b57e2cbb logging: Enable Sys-T on ADSP backend
Enables the Sys-T formatting on the ADSP backend when the
SYST logging format is selected.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2022-04-20 10:25:16 -04:00
Herman Berget
0916eba4ad Bluetooth: Host: Send the "Out of Sync" error only once on each channel
The "Database Out Of Sync" error response shall only be sent once on
each channel after a client becomes change-unaware.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-20 16:10:46 +02:00
Herman Berget
1732ec061b Bluetooth: Host: Add CF_DB_HASH_READ flag
This fixes the case where the client reads the DB hash without reading
another attribute first after becoming change-unaware.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-20 16:10:46 +02:00
Asbjørn Sæbø
79d96b8112 Bluetooth: Audio: Add void() cast to memcpy
Cast memcpy to void().

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-04-20 15:51:01 +02:00
Asbjørn Sæbø
b0d5db147b Bluetooth: Audio: Media control - pass structs by reference
Changes the media_proxy API to pass structs by reference instead of by
value.

Also pass structs by reference in internal functions in media player
and in media controller test.

Add pointer checks to the public API implementation where
user/application code provides structs by reference.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-04-20 15:51:01 +02:00
Asbjørn Sæbø
ebaad4501c Bluetooth: Audio: Media - search to not modify parameter
Update the search parser to not modify the supplied parameter.
This will allow the parameter to be made 'const'.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-04-20 15:51:01 +02:00
Asbjørn Sæbø
1d66729a0a Bluetooth: Audio: Remove zero-ing of variable
Commit dc812539b8 ("Bluetooth: MPL: Fix use of uninitialized
command.param value") fixed the use of a potentially un-initialized
variable, by
- splitting a log statement, so that the variable is only
  logged (=used) if in use (and therefore hopefully also initialized)
- setting the variable to zero if not in use

The second part is not required, as all other code in the module
checks whether the variable is in use before using it.  And this
second part also prevents the parent struct from being made 'const'.

This commits removes the zeroing of the variable, so that the struct
can be made 'const'.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-04-20 15:51:01 +02:00
Asbjørn Sæbø
fa5b8a1e38 Bluetooth: Audio: MCC - pass structs by reference
Changes the media control client API to pass structs by reference
instead of by value.

Also change internals of test to pass struct by reference.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-04-20 15:51:01 +02:00
Jordan Yates
855f4b9c96 Bluetooth: hci: correct ext adv cmd definition
Update the definition of the set extended advertising data command to be
a variable array instead of hardcoded to the maximum length. This
conforms to the definition from the Bluetooth specification and allows
the corresponding code to be slightly cleaner.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-04-20 15:49:54 +02:00
Robert Lubos
e2fe8e7307 net: socket: Add option to create native TLS sock with offloaded TCP
In some cases (for examples when offloaded socket implementation does
not implement TLS functionality) it could be desired to create a native
TLS socket with an underlying offloaded socket.

This cannot be achieved with SO_BINDTODEVICE option only, as TLS socket
type is not really associated with a particular interface - it either
has to be offloaded, or a fully native socket is created (native TLS on
a native interface).

In order to address the problem, introduce TLS_NATIVE socket option.
This option instructs the socket dispatcher layer to create a native TLS
socket. As with the socket dispatcher the underlying socket
implementation is not decided during TLS socket creation, therefore it's
possible to use SO_BINDTODEVICE to choose either native or offloaded
interface for the underlying socket.

Additionally remove NET_SOCKETS_OFFLOAD_TLS Kconfig option, as it's no
longer needed with an runtime option to select whether to offload TLS or
not.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-04-20 11:27:05 +02:00
Robert Lubos
641b2a0d93 net: sockets: Add socket dispatcher
Add an intermediate socket implementation called socket dispatcher. This
layer can be used along with the socket offloading, to postpone the
actual socket creation until a first operation on a socket is executed.

This approach leaves an opening to bind a socket to a particular
offloaded network interface, and thus offloaded socket implementation,
using SO_BINDTODEVICE socket option. Thanks to this, it is now possible
to use multiple offloaded sockets implementations along with native
sockets, and easily select which socket should use with network
interface (even if it's an offloaded interface).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-04-20 11:27:05 +02:00
Juha Heiskanen
53fbf40227 net: lwm2m: SenML Json fix RW Time
Added missing get_time and put_time for fixing crash.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
2022-04-20 11:10:12 +02:00
Omkar Kulkarni
dbc7689404 Bluetooth: Mesh: Foundation model Client timeout setting
Adds a Kconfig option for setting the Config Client and Health Client
timeout. Updates updates the default for Config Client to allow
reception of full sized message from a similar peer device at zero hops.

Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
2022-04-20 10:44:23 +02:00
Nicolas Pitre
1a21ac8122 shell: fix history optimization
Commit f7c4fe6778 ("shell: optimize history storage a bit") forgot
to distinguish between the newly allocated history item and the previous
one, causing havoc on ring buffer wraparounds with excess padding.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2022-04-20 09:50:03 +02:00
Ryan McClelland
1216f19a89 logging: fix LOG_TAG_MAX_LEN min warning
if CONFIG_LOG_TAG_MAX_LEN is 0, then a warning would be generated
on the MIN macro always being false, but as
CONFIG_LOG_TAG_MAX_LEN is a constant, then it is better to just
compile out the function if it's 0.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2022-04-19 11:49:34 +02:00
Bartosz Bilas
306f92e646 tracing: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-19 11:49:27 +02:00
Bartosz Bilas
e89f441146 testsuite: ztest: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-19 11:49:27 +02:00
Bartosz Bilas
1ace84a896 shell: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-19 11:49:27 +02:00
Bartosz Bilas
f9d8f34eba net: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-19 11:49:27 +02:00
Bartosz Bilas
6367075dfe logging: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-19 11:49:27 +02:00
Bartosz Bilas
9e3d9784ff canbus: isotp: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-19 11:49:27 +02:00
Bartosz Bilas
95f3b4bc70 bluetooth: audio: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-19 11:49:27 +02:00
Dominik Ermel
ef199e92df mgmt/mcumgr/lib: doc: Minor fixes to zcbor_bulk documentation
Little polishing here and there.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-19 11:35:16 +02:00
Dominik Ermel
fb4afe2112 mgmt/mcumgr/lib: Remove mcumgr_util
With replacement of (u)ll_to_s with snprintf the util is no longer
needed.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-19 11:34:40 +02:00
Dominik Ermel
3445c29979 mgmt/mcumgr/lib: Use snprintf instead of ll_to_s in OS group
The commit replaces usage of ll_to_s with snprintf.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-19 11:34:40 +02:00