Fix uninitialized advertiser rl_idx used to check own identity
in CONNECT_IND received for directed advertisements.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This API will be deprecated in favor of the new API that clearly
specifies whether it works on logical or physical levels.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Some compilers can't resolve the conditional if/else/else construction
in ull_conn event_len_prep function, and fail with an 'uninitialized
variables' error. The change has no functional impact.
Signed-off-by: Morten Priess <mtpr@oticon.com>
BT_CTLR_SETTINGS should not depend on BT_SETTINGS as this will prevent
using settings system in the controller in a controller only build.
(BT_SETTINGS depends on BT_HCI_HOST)
Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
Fix infinite recursion in host-based bt_rand function. This would call
HCI LE Random Number command, which would in turn call bt_rand, causing
an infinite recursion.
bt_rand -> prng_reseed -> BT_HCI_OP_LE_RAND -> le_rand -> bt_rand
To solve this issue the controller should avoid doing calls into the
host, so all calls to bt_rand in the controller should be replaced with
a call to a controller function.
Fixes#22202
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
SW based privacy is an implementation detail in the zephyr link layers.
Therefore it should not be visible when selecting an out-of-tree
controller.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Since a peer MIC failure closes the event, it does not allow a terminate
acknowledge. For that reason a peer MIC fail for central role must force
a conn_cleanup.
Signed-off-by: Morten Priess <mtpr@oticon.com>
This fixes the EBQ tests 129 and 130. These tests check behaviour for
the DLE procedure when Encoded PHY or 2M PHY are not supported.
See also BT core spec. Version 5.1, Vol6, Part B, Section 5.1.9
Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
When clearing the whitelist, possible white listings in resolve list
were left. These are now also cleared.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Clean up the nRF cmake include file to remove redundant
check for BT_LLL_VENDOR_NORDIC inside the file.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
SMI TX is different than other controller features in that it does not
necessarily imply any software changes; whether SMI TX is supported
may be simply a matter of hardware calibration. This change supports
using the same software on chips that do or do not support SMI TX
depending on calibration.
Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
As a part of a ticker extension interface, it is now possible to specify
a slot_window when starting a ticker. When setting the
ticks_slot_window to a non-zero value, it is requested that the node
timeout is re-located to a position within the window, where the node
does not collide with other nodes - aligning to the end of the window.
The solution takes into consideration if a node has already been
updated with drift correction (e.g. ADV randomization), subtracting this
from the window.
Signed-off-by: Morten Priess <mtpr@oticon.com>
Updated the lll_conn_flush interface to pass the connection
handle while the LLL connection context stored handle has
been invalidated.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Zephyr aims to enable supporting of multiple SW defined
BLE LL. There is a complex hierarchy of defines in the
CMake files controlling the compilation units that part of
the final library. Adding another SW LL implementation
from a different SoC provider will make the main controller
CMake file unmaintable.
As such, split the into vendor-specific CMake files for
easier additions.
Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
Change adds missing Kconfig dependency.
The CONFIG_BT_CTLR_FILTER is used only for SW Link Layers.
Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
generated_dts_board.h is pretty redundant and confusing as a name. Call
it devicetree.h instead.
dts.h would be another option, but DTS stands for "devicetree source"
and is the source code format, so it's a bit confusing too.
The replacement was done by grepping for 'generated_dts_board' and
'GENERATED_DTS_BOARD'.
Two build diagram and input-output SVG files were updated as well, along
with misc. documentation.
hal_ti, mcuboot, and ci-tools updates are included too, in the west.yml
update.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Moving struct definitions into header file and adding API to
allow accessing data-structures from lll context
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Bluetooth sample with controller crypto, requires sys_rand32_get that
used to be linked with Tinycrypt. The selection, within Kconfig of
Tinycrypt, that has been enabling compilation of the symbol has
been removed and thus preventing controller crypto to link.
This commit moves the selection to BT_CTLR_CRYPTO.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Under race conditions it is possible that there is no call
to k_sem_give to the waiting k_sem_take in the ull_disable
function.
ull_disable function checks for reference count before
using a mayfly to schedule lll_disable, which in turn
would close requested currently active role event leading
to done event being propogated to ULL. Done event would
then call the set disabled_cb callback when the reference
count is zero, giving the semaphore to the waiting
k_sem_give in the ull_disable.
Under race conditions if the reference count reached zero
after the reference count check and before the disabled_cb
was assigned in the ull_disable function, then there are
chances that a k_sem_give is not called while ull_disable
proceeds to waiting using k_sem_take.
Fixes#21586.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix CONFIG_BT_CTLR_TX_BUFFER_SIZE value range to 251 Bytes
due to implementation limitation in use of u8_t for PDU
length fields in controller Tx buffers.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix controllers address check in cases of controller-based
privacy is supported but not used to start advertising.
This fixes regression introduced in
commit 896619ad40 ("Bluetooth: controller: Fix
controller address check").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Refactor the event_len_prep routine to increase readability without
affecting code size
Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
There is an obscure bug in the case that CFG_BT_CTLR_PHY is not defined;
when a feature-exchange already has happened the lr->max_tx_time and
lr->max_rx_time are not calculated.
This bug is fixed by this commit.
Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
This change prevents zephyr LL specific configurations to show up when
using an out of tree BLE controller.
BT_CTLR_ASSERT_HANDLER is used outside the controller as well,
so this is kept as is.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Fix controllers address check in cases of controller-based privacy.
When controller has been instructed by the host to use privacy
the controller should look up the peer identity address and generate
an address based on the local IRK. In the case where no match
is found or the local IRK is all zeroes the controller shall use
the fallback address. If the fallback address is not valid the
controller shall return invalid params.
This commit fixes these issues:
- Starting a private advertiser without valid random address set
but a valid local IRK exists. In this case the advertiser should
be able to advertise using the RPA regardless of a valid random
or public address.
- Starting a private advertiser with a fallback to the public
address type or an adveriser using public address does not
check if a valid public address exists. The host cannot
advertise with an all-zero public address.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix bug when connecting using whitelist and split controller.
The peer address was set to an all zeroes address.
Bug using shell:
bt init
bt wl-add <addr>
bt wl-connect on
Connected: 00:00:00:00:00:00 (public)
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Added Kconfig option to conditionally compile in HCI command
parameter validation code.
When building a combined host plus controller application,
only validations in the host at the top level close to the
API caller is sufficient.
The controller validations are included in controller only
builds.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Pass the scanner LLL context in the generated connection
complete event with unknown connecion id for HCI Create
Connection Cancel Command Response.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Directed advertising timeout released PDU Rx quota which it
should not be.
Relates to assert in #21006.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix tx_time calculation for the case that BT_CTRL_PHY is defined and
there has not been a feature exchange.
Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix tx_time calculation for the case that BT_CTRL_PHY is defined and
there has not been a feature exchange.
Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit reverts the change that moved the remote version event from
a priority event to a normal event. This is done because the strategy
for using this event has been changed and will be used with a callback
instead of a semaphore that could be locked from the RX thread.
This commit retains the infrastructure that was added in the controller
so that moving events to priority processing is still possible.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix multiple issues related to the way the host handles
Identity Information related to privacy
1. If the controller provided a public address the IRK
for this identity would be randomly generated but not
stored persistenly.
2. Fix the handling of the above issue which was fixed
for the random address but would initiate settings save
ID on every boot.
3. Fix the host not using the Vendor Specific HCI commands
related to retrieving the Identity Root (IR) from the
controller and using the key diversified function d1
to generate an IRK as specified in the BT Core spec.
Make sure that a Host generated ID is only saved when it is first
generated.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Return the IR defined in FICR as the Identity Root for the static
address through the read static addresses command instead of providing
it through the Read Key Hierarchy Root command.
This is following the recommendations in the Zephyr HCI extension
document in doc/reference/bluetooth/hci.txt
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix controllers address check in cases of controller-based privacy.
When controller has been instructed by the host to use privacy
the controller should look up the peer identity address and generate
an address based on the local IRK. In the case where no match
is found or the local IRK is all zeroes the controller shall use
the fallback address. If the fallback address is not valid the
controller shall return invalid params.
This commit fixes these issues:
- Starting a private advertiser without valid random address set
but a valid local IRK exists. In this case the advertiser should
be able to advertise using the RPA regardless of a valid random
or public address.
- Starting a private advertiser with a fallback to the public
address type or an adveriser using public address does not
check if a valid public address exists. The host cannot
advertise with an all-zero public address.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Remove the 4us advanced radio reception, the implementation
passes all timing conformance tests without this.
This change should reduce some radio power consumption by
avoiding redundant reception duration.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Low frequency and high frequency clocks had separate devices
while they are actually handled by single peripheral with single
interrupt. The split was done probably because opaque subsys
argument in the API was used for other purposes and there was
no way to pass the information which clock should be controlled.
Implementation changes some time ago and subsys parameter was
no longer used. It now can be used to indicate which clock should
be controlled.
Change become necessary when nrf5340 is taken into account where
there are more clocks and current approach would lead to create
multiple devices - mess.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>