Fixes the following warning:
<wrn> cbprintf_package: cbprintf_package_convert:
(unsigned) char * used for %p argument. It's recommended
to cast it to void * because it may cause misbehavior in
certain configurations. String:"%s: meta %p len %zu" argument:1
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The functions `le_sc_oob_config_set`, `generate_dhkey` and
`display_passkey` in `smp.c` were only defined when
`CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY` was not defined. This created
issues at build time.
Remove the guard as the code calling those functions is not guarded
itself.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
These callbacks are trigger for changes that affect the entire
broadcast sink, such as the BIG synced and terminated events.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
These callbacks are trigger for changes that affect the entire
broadcast source, such as the BIG started and terminated events.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
These callbacks are trigger for changes that affect the entire
broadcast source, such as the BIG started and terminated events.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add callbacks that is called for the entire BIG.
The BIG state is from an HCI perspective a single state change
that we previously only propagated as a state change for each
channel.
However it may be simpler for applications and higher layers
to use BIG changes to trigger their behavior.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This fixes an issue that occurred if deferred_work is queued by another
procedure before we run bt_conn_set_state(BT_CONN_DISCONNECTED).
bt_conn_set_state yields to the system work queue in bt_conn_tx_notify,
and then deferred_work runs and handles the disconnected callbacks.
bt_conn_set_state then enqueues another deferred_work which calls the
disconnected callbacks again and causes an assert. k_work_cancel_delayable
will clear queued deferred work when we call
bt_conn_set_state(BT_CONN_DISCONNECTED), guaranteeing that the disconnect
callbacks will only be called once.
Signed-off-by: Timothy Keys <timothy.keys@nordicsemi.no>
Since the function `bt_sdp_discover` has been updated, the caller of
function needs to be updated to avoid the building and functionality
fault.
Add set the parameter `type` to value
`BT_SDP_DISCOVER_SERVICE_SEARCH_ATTR`.
Update the SDP discovery callback function. Make it align with
`bt_sdp_discover_func_t`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Extend the function `bt_sdp_discover` to support service search
transaction and service attribute transaction.
Improve the `session->rec_buf`. If the net buffer cannot be allocated
from the channel, disconnect the SDP session.
Set the `MaximumAttributeByteCount` of the request
`SDP_SERVICE_SEARCH_ATTR_REQ` with the tail room of `session->rec_buf`.
Set the `MaximumAttributeByteCount` of the request `SDP_SERVICE_ATTR_REQ`
with the tail room of `session->rec_buf`.
Set the `MaximumServiceRecordCount` of the request
`SDP_SERVICE_SEARCH_REQ` according to the tail room of
`session->rec_buf`.
Handle the response code `SDP_SERVICE_SEARCH_RSP`, and
`SDP_SERVICE_ATTR_RSP`.
Handle the error `SDP_ERROR_RSP`. Start the next SDP discovery if the
error received.
If there no more request, disconnect the session.
If the request cannot be sent, start the next SDP discovery.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
This change aims to eliminate the dependency on `ctx_shell` in
the Bluetooth `host/shell/*`, making the code more maintainable.
Replaced `shell_*` functions that depended on `ctx_shell` with
the appropriate `bt_shell_*` functions.
The shell-less functions `bt_do_scan_filter_clear_name`, `bt_do_scan_off`,
and `bt_do_connect_le` were added so they can be called without `sh`.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Limit the usage of `ctx_shell` to cases where printing requires it
and `sh` is not available.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Introduced `bt_shell_private.c` and `bt_shell_private.h` to provide
common functions for the Bluetooth `shell_wall_print`.
These functions are equivalent to `shell_fprintf`, `shell_info`,
`shell_print`, `shell_warn`, `shell_error` and `shell_hexdump`
but without requiring the `sh` parameter.
The cost of the newly added `bt_shell_fprintf_info` ... `_error` functions
will be negligible when there are many individual calls that need to pass
both the `sh` and `color` parameters each time.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Fix reschedule for ticker that yield such that reduce the
slot window after intersection to include required
ticks_slot, and we do not take the interval of the
colliding ticker provided every expiry increments the
interval by random amount of ticks. This is the case for
primary channel advertising.
Fixes commit e1cd5ba77f59 ("Bluetooth: Controller: Fix to
reschedule after overlap when yielding").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Default the Minimum encryption key size to 16.
Key with reduced size is easier to brut force.
Disable LE legacy pairing by default since it's not secure.
These defaults should suite majority of newly developed applications.
It's better to use sensible more secure defaults,
so applications that really need less secure option consciously change it,
not the other way around.
This may help to prevent downgrade attacks.
Signed-off-by: Sergey Korotkov <sergey.korotkov@nordicsemi.no>
Log the create BIG params for debugging purposes.
Also slightly modifies the `qos` struct to use a more
suitable struct to avoid always doing `qos->tx->` and
can now just be `qos->`.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Referring to MshDFU_v1.0 Sections 6.1.1, 6.2.1 and 7.1.1 model
descriptions: DFU/DFD server/clients extend BLOB Transfer root models
and DFD server requires Firmware Update Client on the same element. For
this reason we need to make sure that those main models or root models
exist on the same element. And also firmware update client can not be
forced to be in the first element.
For all model extention call return the error code in case of an error.
Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
It is recommended to record the subunit type itself instead of the
subunit ID when validating the transaction. This approach is more
meaningful and less prone to misinterpretation.
Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
Deprecate BT_CTLR, and add a new HAS_BT_CTLR as a virtual option which
specific users (like BT_LL_SW_SPLIT) select. This also means that we can
remove all places that were forcefully enabling the BT_CTLR option, and
instead we now depend on devicetree to get some local LL HCI driver
enabled which in turn also enables the HAS_BT_CTLR option.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Removes legacy configuration options. The same coverage is provided by
existing PSA_WANT_... selects.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Initializes the `net_idx` field of the ack context properly for KRP
functions in the Config Client.
This fixes a problem where `bt_mesh_cfg_cli_krp_get` and
`bt_mesh_cfg_cli_krp_set` would always fail the ack ctx comparison if
`key_net_idx` was != 0.
Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
After the switch from TinyCrypt to PSA Crypto API as crypto
backend, runtime crashes might happen on some platform due
to BT_LONG_WQ's stack size not being large enough. This
commit fixes this issue.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
When BT_SEND_ECC_EMULATION and the platform uses Mbed TLS as PSA
Crypto provider, we select the Cortex-M software optimized
implementation of the secp256r1 curve algorithms. This is much
faster than the standard support provided by Mbed TLS and it
also reduces ROM footprint.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
This commits puts in order log messages when unpacking CDP0 and CDP1 so
that it a bit more clear where the error happens.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit checks that config client doesn't pull out data outside of
the buffer.
Fixes#80012
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Coverity complains about uninitialized prohibited fields. Even though it
is not used because it is "prohibited", it is simpler to just
initialized it with the value received from a server.
Fixes#81939
Coverity-CID: 434649
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This moves GATT releated defines that are used by both Mesh Proxy
Service and Mesh Provisioning Service implementations to a common
header file.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
By default if CONFIG_BT_MESH_PROXY_USE_DEVICE_NAME
or CONFIG_BT_MESH_PB_GATT_USE_DEVICE_NAME is enabled, the mesh stack
will add BT_DATA_NAME_COMPLETE AD Type along with the Mesh Proxy Service
or Mesh Provisioning Service advertisements accordingly.
When BT_LE_ADV_OPT_USE_NAME was present and
CONFIG_BT_DEVICE_NAME_DYNAMIC is enabled, the advertised name was
automatically updated by the host. This turned out to be a side-effect
rather than expected behavior and after #71700 this behavior waa
changed.
But customers use dynamic name feature.
This commit makes the mesh stack use bt_get_name to get the device name,
which returns runtime name if CONFIG_BT_DEVICE_NAME_DYNAMIC is enabled.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Since the TinyCrypt library is being deprecated in Zephyr, this
commit modified the dependencies of BT_RPA. Instead of selecting
TinyCrypt, it relies on BT_HOST_CRYPTO or BT_CTLR_CRYPTO. This
helps both in the deprecation process of TinyCrypt, but also this
is more correct dependency since these 2 symbols are extensively
used in the rpa.c source code.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Since the TinyCrypt library is being deprecated in Zephyr, this
commit set TinyCrypt usage in BT mesh as deprecated and it sets
Mbed TLS PSA Crypto API as the default option (when TF-M is not
available).
Tests are also updated in this commit.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
This commit sets PSA Crypto API as the default library to perform
ECC-DH in HCI, replacing TinyCrypt (which is being deprecated).
Therefore the symbol BT_TINYCRYPT_ECC is renamed as BT_SEND_ECC_EMULATION.
References in samples/tests are also fixed.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
CONFIG_BT_USE_PSA_API was used in BT crypto/host modules to select
PSA crypto API over TinyCrypt (which was the default until now).
Since TinyCrypt is being deprecated and PSA crypto API is the new
standard library for crypto operations, CONFIG_BT_USE_PSA_API is
no more needed.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
The API documentation already states that the controller may require
the scan interval and window used for scanning and connection
establishment to be equal to obtain the best performance.
This commit prints out a warning when this is not the case. The code
size is unchanged when `CONFIG_BT_SCAN_AND_INITIATE_IN_PARALLEL=n`.
This makes application developers aware that using the parameters
`BT_LE_SCAN_ACTIVE_CONTINUOUS` with `BT_CONN_LE_CREATE_CONN` may not
give the best performance.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Because the number of ACL RX buffers must be at least the number of
maximum connections plus one, increasing `CONFIG_BT_MAX_CONN` could
inadvertently lead to a build failure if the number of ACL RX buffers is
not also increased. This dependency may not be obvious to users.
To address this issue, this commit deprecates the
`CONFIG_BT_BUF_RX_COUNT` Kconfig symbol and computes the value in
`buf.h` using the new `BT_BUF_RX_COUNT` define. Note that the default
value and the minimum range value have been changed to 0 to "disable"
the option.
Additionally, to allow users to increase the number of ACL RX buffers,
this commit introduces the new `CONFIG_BT_BUF_RX_COUNT_EXTRA` Kconfig
symbol. The value of this symbol will be added to the computed value of
`BT_BUF_RX_COUNT`.
The configurations of tests and samples have been updated to reflect
these changes.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
when receiving the io cap request from controller, call
pairing_accept to check whether application accept the
pairing. If no, reply BT_HCI_OP_IO_CAPABILITY_NEG_REPLY.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
Fix CIS offset calculation by Central for subsequent CISes
such that when compensating for dissimilar ACL and ISO
intervals, ensure that minimum offset does not cause a
collision between the ACL and the CIS event at the instant.
Fixes commit 3b3d53f09e ("Bluetooth: Controller: Fix CIS
offset_min for dissimilar interval").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This API gives better control on L2CAP COC credits and suits better
for Upper Tester implementation.
Co-authored-by: Szymon Janc <szymon.janc@codecoup.pl>
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
This fix calling seg_recv() callback being called even though channel
is being disconnected due to SDU overflow.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
Fix ISO Sync Receiver implementation to correctly prevent
subevent from pre-empted in the unreserve time space.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ISO Sync Receiver time reservation calculation to use
peer broadcasted bis_spacing and sub_interval, instead of
incorrectly calculating using local implementation used
tMSS value.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ISO Sync Receiver implementation to correctly reflect
the payload number and timestamp for the skipped SDU.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The ASCS unit tests had various errors after adding support for
dynamic registration.
Several tests did not properly clean up after failure, causing other
tests to fail when they shouldn't.
Moved the register tests to their own file as they should not
do the register in the "before" function.
The test_ascs_unregister_with_ases_in_config_state test was also
removed, as it had both issues and the state that it wants to test
cannot be reached with the current API - It is not possible to
put an ASE in the configured state without callbacks,
and registered callbacks prevents us from calling
bt_bap_unicast_server_unregister to trigger the case as that can
only be done if callbacks are unregistered. Since unregistering
callbacks also puts all ASEs to the idle state, it is not possible
to call bt_bap_unicast_server_unregister for a non-idle ASE.
The testcase.yaml was also missing some Kconfig options to
properly enable the client tests.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
bt_le_set_auto_conn() function is not working as
expected. Also, it doesn't have any test coverage
and any usage in sample applications.
The function is deprecated
Fixes#81597
Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>