The LE Connection Complete HCI event, unlike its Enhanced counterpart,
only uses 0x0 and 0x1 for Peer Address Type. Fix it so that it reflects
the specification correctly.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This PR fixes#23482. The preamble size for a 2M phy was incorrect.
There is a bug in calculation of time for the DLE procedure:
the preamble size is incorrect for the 2M phy
Fixes#23482
Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
When PB-GATT Procedure timeout, func `bt_mesh_pb_gatt_close`
will also dumplicated with `link_closed()`
Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
Check the return value of LE Set Extended Advertising Parameters
command when starting an advertiser from bt_le_adv_start with
CONFIG_BT_EXT_ADV enabled.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
The LE Set Extended Advertising Set Random Address command may be
issued at any time after an advertising set identified by
the Advertising Handle parameter has been created using the
LE Set Extended Advertising Parameters command.
This commit fixes the advertising set issueing the set random address
command before the advertising set is created in the controller.
Since the le_adv_set_random_addr function has is used to get the the
own address parameter for the it could not simply be moved, and
moving the own address parameter handling out of this function
would create a potentioal maintaince problem.
Also this function is used for both with and without advertising
extension feature so changing it is not trivial without breaking all
the previous random address handling already put in place.
The simplest solution was therefore to postpone the command until the
parameters has been set using 2 flags.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Use bluetooth assert on HCI command send error since this assertion is
always enabled and we should not continue after this has failed.
Log command status failure with information in order to make it more
visible as the HCI status code is more interesting than the -EIO error
code returned by the function.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Add BT_ASSERT_MSG assert mechanism that can print assertion messages
when verbose bluetooth asserts are enabled.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix seg_tx occupy when no segment not send
and allocate rx_seg when receive such message.
Fixes: #24101
Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
For the ll code we know the exact entropy device as its the one for the
SoC that we are on. So use the new DT macro's to get the entropy device
via DT_INST rather than using CONFIG_ENTROPY_NAME.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Fix the pending slave set connection latency and timeout values not used
in the connection update procedure when
CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS has not been enabled.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
The board target for emulation of nRF52810 on nRF5DK, so far
known as nrf52810_pca10040, is renamed to nrf52dk_nrf52810.
Its documentation and all references to its name in the tree are
updated accordingly. Overlay and configuration files specific to
this board are also renamed, to match the new board name.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The board name for the nRF52 DK, so far known as nrf52_pca10040, is
renamed to nrf52dk_nrf52832. Its documentation and all references
to its name in the tree are updated accordingly. Overlay and
configuration files specific to this board are also renamed, to
match the new board name.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Extends the bt_conn_le_create_param struct to provide the option
to set a custom timeout for the initiation of the connection.
The logic for the default values of window_coded and interval_coded
were moved to conn.c in order to resolve all defaults for the
create_param struct at a single location.
Timeout is not added as a parameter to the BT_CONN_LE_CREATE_PARAM
macro due to the expectation that CONFIG_BT_CREATE_CONN_TIMEOUT
will be the typical value that users will expect.
Fixes#23468
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Fixed overflow risk when `poll_timeout` is 1s,
although it is not recommended to use it like this,
when it is used like this, `POLL_TIMEOUT_MAX`
will overflow.
When the poll timeout set like above, the default `6`
req_attemps for first pull request lost,
may cause this procedure bigger than poll_timeout,
Well, stop scanning when lpn terminated friendship,
this will save lots of energy, when lpn mode enable,
the scanning will be start after `FRIEND_REQ_RETRY_TIMEOUT`
Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
Fix an an issue where established bonding information in the peripheral
are deleted when the central does not have the bond information.
This could be because the central has removed the bond information, or
this is in fact not the central but someone spoofing it's identity, or
an accidental RPA match.
This is a regression from: a3e89e84a8
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
The net_buf subsystem is now fully compatible with the new timeout
API, so move the selection of the legacy API to those specific
subsystems that use net_buf and still need converting.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Update implementation of master and slave LLL's to correctly
handle event counter values when latencies introduced due to
connection events cancelled by active events operating in
unreserved time space.
When an active radio event extends into unreserved time
space, and a connection event prepare is scheduled but at
the time of pre-emption timeout if the connection event is
cancelled then the event count and latencies needs to be
continiued to get acummulated.
In the current controller usecases the above scenarios does
not get exercised, the changes in this commit is needed for
future roles that can extend into unreserved time space and
would cancel a scheduled connection event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add additional build configurations to the shell to catch build errors
when enabling extended advertising.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix compilation issue when extended advertising is enabled but privacy
is disabled. In this case the rpa_update work is compiled out.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Run the int_literal_to_timeout Coccinelle script to fix places where
it is clear that an integer duration is being passed where a timeout
value is required.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Most places used an int so that should have handled most cases but
keys_set was using an unsigned int, which meant that checking len > 0
is an expression that is always false, and the error handling is not
working.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
The publication context is checked for NULL in bt_mesh_model_publish()
however it was dereferenced before that. Move the assignment to
ctx.send_rel to the same place where other ctx members are set.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Fix regression in cancelling slave latency during Connection
Update Procedure.
Slave latency should not be applied between the ack of a
Connection Update Indication PDU and until the instant.
When caching was introduced, implementation missed this
consideration.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Ticker is now fixed to avoid catch up of periodic timeout under
large ISR latencies.
Revert commit a749e28d98 ("Bluetooth: controller: split:
nRF: Use ticker compat mode as default").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
If must_expire is set for a ticker instance, then ticker
expiry shall still perform catchup.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Reset ticker state in ticker_job for ticker instances that
have been skipped in the ticker_worker.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ticker to avoid catch up of periodic timeouts in case of
large ISR latencies like in case of flash erase scenarios.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix regression in cancelling slave latency during Connection
Update Procedure.
Slave latency should not be applied between the ack of a
Connection Update Indication PDU and until the instant.
When caching was introduced, implementation missed this
consideration.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Simplify the Data Length Update Procedure state check when
processing incoming LENGTH_REQ/RSP PDUs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Simplify the Data Length Update Procedure state check when
processing incoming LENGTH_REQ/RSP PDUs.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add validation of channel map and hop increment value
received in CONNECT_IND PDU.
Zero bit count leads to controller assert or divide-by-zero
fault.
Hop increment shall be between 5 and 16 by BT Specification.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add validation of channel map and hop increment value
received in CONNECT_IND PDU.
Zero bit count leads to controller assert or divide-by-zero
fault.
Hop increment shall be between 5 and 16 by BT Specification.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix high-duty cycle directed advertising when extended advertising
feature has been enabled. The duration parameter when starting extended
high duty cycle directed advertising has to be set to a non-zero value
less than or equal to 1.28 seconds.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Avoid removing identity keys from the controller during the pairing
procedure. During the pairing procedure the keys will be cleared before
they are updated. This causes an unnecessary warning from HCI core where
it tries to remove an IRK key-set from the controller that has has not
been added yet.
While this is not an issue, the warning from HCI core is misleading and
might lead to unnecessary questions and investigations.
Warning appeared after: 6c6bd8c49e
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Move the pending ID keys add and delete flag out of keys storage area.
These flags are runtime flags and should not be stored in persistent
storage.
Due to struct alignment storage start has to be aligned so that
variables added before storage start does not affect the storage bytes
by introducing padding in the storage area
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Replace all occurences of BUILD_ASSERT_MSG() with BUILD_ASSERT()
as a result of merging BUILD_ASSERT() and BUILD_ASSERT_MSG().
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
Add shell advertise set info get command to print advertiser set local
identity and TX power selected by the controller.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Skip feature testing of controller features when legacy advertising
commands are not supported. For combined builds or builds where the
capability of the controller is known it is not required to have runtime
check of controller extended advertising support.
This gives the following size reduction for hci_core.c:
Without legacy support
hci_core.c 19980 7.75%
total 257679
With legacy support
hci_core.c 21816 8.41%
total 259519
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Handle updating the identity keys in the controller while a scanner
limited by timeout or advertiser limited by number of events or timeout
is active in the controller. For this case we mark they keys as pending
and handle the update of the resolving list ones the roles are stopped.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>