The flag `BT_LINK_KEY_SC` of LK will also be set when derive LK from
LTK.
It is a incorrect behavior.
The flag `BT_LINK_KEY_SC` should only be set if the flag `BT_KEYS_SC`
of LTK has been set.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The flag `SMP_FLAG_BR_CONNECTED` is cleared by the function
`smp_br_reset()` and `smp_br_init`. But the flag
`SMP_FLAG_BR_CONNECTED` should not be cleared at this time.
Recovery the flag `SMP_FLAG_BR_CONNECTED` after the all flags of SMP
cleared.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
If the encrypt value of classic connection is
`BT_HCI_ENCRYPTION_ON_BR_AES_CCM`, set the flag `BT_KEYS_SC` for
the derived LTK.
Or, clear the flag `BT_KEYS_SC` for the derived LTK.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, the flag `local_dist` will be cleared when
the distributed key frame is performed if the local is the SMP
initiator. After the distributed key is sent out, the function
`smp_pairing_br_complete()` will be called if all bits of `local_dist`
are cleared.
It causes the function `smp_pairing_br_complete()` will be called
multiple times.
Add a flag `local_distributed` to flag the all sent keys. Add only the
flag `local_distributed` is not set, preform the key distribution
frame.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The derived LE keys are not saved to NVM. And the IRK is not added to
controller resolving list. It causes two issues,
Issue 1, the LE connection connection cannot be established if the adv
address of peer is RPA.
Issue 2, the LE keys are missing after the power reset.
For issue 1, add a function `smp_br_id_add_replace` to add LE keys.
For issue 2, check the BR bondable flag `BT_CONN_BR_NOBOND` instead of
`SMP_FLAG_BOND`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Fix incorrect payload count at CIS Establish due to existing
CIG event overlapping the ACL event at the instant when the
CIS gets the active flag set.
The overlapping CIG event picked up the new CIS that had its
active flag set in the current CIG event instead of at the
actual CIS offset which is in the next CIG event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix CIS offset calculation due to use of decremented ACL
event counter, where as the CIS offset is inquired in the
next ACL event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix incorrect CIS offset in use if instant is picked from
the peer sent CIS RSP PDU. Instead, keep the instant that
was sent in the CIS REQ PDU as the instant to send in the
CIS IND PDU.
This fixes CIS failed to be established when dissimilar
ACL and ISO intervals are in use.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix incorrect payload count at CIS Establish due to existing
CIG event overlapping the ACL event at the instant when the
CIS gets the active flag set.
The overlapping CIG event picked up the new CIS that had its
active flag set in the current CIG event instead of at the
actual CIS offset which is in the next CIG event.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Peripheral CIS sorted by CIG implemenation to use CIS
offset stored in LLL context which is the correct offset
from the CIG anchor point. CIS offset in the ULL context
is the offset from the ACL anchor point at the time of
the CIS establishment.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix CIS event_count_prepare use missed as part of fixes
related to commit be91cfedfb ("Bluetooth: Controller: Fix
incorrect event_count when CIG overlaps").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Commit removes device key candidate if provisionee failed
during device key refresh procedure or mesh reset has been
called in between. Otherwise, device key candidate gets
stuck in the internal trusted storage of crypto library.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
According to AVCTP v1.4: On the controller and the target side,
handling of transaction labels is dependent on the application.
Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
Remove the transaction label mechanism because:
1. Not necessary at stack, typically an application can handle the
timeout mechanism if required (very rarely).
2. It is a burden on memory size to record all pending commands.
Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
This patch allows the upper layer to acquire the remote AVRCP
capabilities. These capabilities can be further used in register
notifications.
Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
sizeof('\0') is misleading as it will return 4 instead of 1,
since it will evaluate to sizeof(0), which returns the size
of the `int` type. Modify the expression to use sizeof(char)
with a comment.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fixes typos in the BT_DEVICE_NAME_GATT_WRITABLE_SECURITY and
BT_DEVICE_APPEARANCE_GATT_WRITABLE descriptions.
Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
When the board has been provisioned and the board is rebooted
it was not possible to connect to the board through the proxy
servcie. This fixes that the Mesh Proxy servive is restarted
after the board is rebooted.
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
Previously, PB-GATT unprovisioned advs would continue being sent if a
device is provisioned or in the process of being provisioned (an active
provisioning link) over PB-ADV.
This commit introduces the `link_cancel` callback for the `prov_bearer`
struct. When a provisioning link is established over a prov bearer, all
other (active) prov bearers will be suspended through this callback, and
re-enabled when the link is closed. An exception is made for PB-REMOTE,
which can utilize the other bearers.
The call to `bt_mesh_pb_gatt_srv_disable` in settings.c is removed. This
is called in `mesh_commit`, and is not needed as this is only used
during boot, at which point the Mesh provisioning service has not yet
been enabled/registered, meaning the function does nothing.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Fix ull_hdr_get_cb() for advanced scheduling to return
ticks_slot for Peripheral role.
Relates to commit d6c3e04eb8 ("Bluetooth: Controller:
Central maximum data PDU size time spacing").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
added function to calculate antenna path
based on the antenna permutation index and
total number of antenna paths
Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
Move functions `bt_sco_cleanup()`, `bt_conn_create_br()`,
`bt_hci_connect_br_cancel()`, and `bt_conn_get_dst_br()` from `conn.c`
to `conn_br.c`.
Change the function `bt_hci_connect_br_cancel()` to internal public
function.
Add a header file `conn_br_internal.h`. And declare the function
`bt_hci_connect_br_cancel()` in the header file.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Clarifies the use of identity in `bluetooth.h` by specifying whether the
documentation refers to the identity address, i. e. the actual address
`bt_addr_le_t`, or the identity handle, i. e. an index corresponding to
a specific identity address.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Several members of the ull_hdr can be removed, saving 12 bytes
from all ULL instances used (and a bit of code as well)
ticks_active_to_start is always 0 and can be removed completely
ticks_prepare_to_start is always set to
HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_XTAL_US), so replace usage
of it by this constant
ticks_preempt_to_start is always set to
HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_PREEMPT_MIN_US), so replace
usage of it by this constant
In addition, remove logic handling usage of XON_BITMASK since it
was only used by the long removed legacy LL
Signed-off-by: Troels Nilsson <trnn@demant.com>
The lost_payloads calculation in ull_conn_iso_start() could easily
end up negative for CIS with FT > 1; Add a check to avoid this
Signed-off-by: Troels Nilsson <trnn@demant.com>
Use `UINT_TO_POINTER` to convert a number to pointer.
Use `POINTER_TO_UINT` to get a number from a pointer.
Fixes#87527.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
When the GATT server is enabled the proxy advertiser
server need to be stopped. This solved a bug where the
Mesh Proxy Service is not restared.
This fix is done to fix several failing PTS test that
was failing when CONFIG_BT_MESH_ADV_EXT_GATT_SEPARATE
was enabled. Calling the stop_proxy_adv was left out
in a prevouis commit when doing code cleanup.
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
The Generic Provisioning protocol requires that a transaction must be
acknowledged before the next Generic Provisioning PDU is processed
(section 5.3.3, MshPRT_v1.1).
In the current PB-ADV implementation, if there is an ongoing transaction
(link.tx.adv points to a valid advertisement), any received Generic
Provisioning Start and Continuation PDUs are ignored.
This creates a scenario where a remote device misses the Transaction
Acknowledgment PDU and retransmits the last PDUs, but they are ignored
by the local device because the local device has already started sending
the next Provisioning PDU.
In particular, in the observed failure, the Provisioner missed the
Generic Transaction Acknowledgment PDU during the transmission of the
Provisioning Data PDU.
This commit modifies the processing logic for Generic Provisioning Start
and Continuation PDUs by checking if the received PDU has already been
received. If so, it attempts to re-send the Generic Transaction
Acknowledgment PDU.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
The options for BT_CTLR_CENTRAL_ISO and
BT_CTLR_PERIPHERAL_ISO did not have the proper defaults not
dependencies when BT_LL_SW_SPLIT=y
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Keep the err in code as it is convention in Bluetooth code, remove ret,
change error_code as avdtp_err_code for avdtp protocol error.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
The set size can now be dynamically set and notified.
The rank is added as a argument in the case that changing
the set size, also affects the device's rank, as ranks
in a coordinated set needs to be continuous.
The set coordinator implementation has been updated
to support receiving the new set size, and providing
this information to the upper layers.
This commit adds a babblesim test for the new API,
as well as a shell command.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The current overhead check needlessly flushes some events for
CONFIG_BT_TICKER_SLOT_AGNOSTIC resulting in some lost or incomplete
advertising events; Use a lower overhead value for this configuration
to avoid that
Signed-off-by: Troels Nilsson <trnn@demant.com>
For a CIG with a CIG Sync Delay larger than a SDU interval, we cannot
be sure that we can target the very next ISO event when the CIG event
is ongoing; Only reduce event_offset if CIG Sync Delay is smaller
than an SDU interval
Signed-off-by: Troels Nilsson <trnn@demant.com>
Add more parameters to command `connect` and `register`, including mode,
mode_optional, extended_control, and hold_credit.
Add command `credits` to give the rx credit.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a sub-command set `l2cap` for command set `br`.
Move command `l2cap-register` to sub-command set. And rename it to
`register`.
Add command `connect`, `disconnect`, and `send` for command set
`l2cap`.
Remove original net buffer pool from `data_pool` to `data_rx_pool`.
Add a net buffer pool `data_tx_pool` for command `send`.
Do not wait anymore if no net buffer can be allocated from
`data_rx_pool`.
Dump all received data in L2CAP data received callback.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Improve the retransmission and flow control to support sending
multiple SDU at the same time if the TX windows is not full.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add mode optional support for BR l2cap connect initiator role.
If `chan->rx.optional` is true, set the mode to basic mode instead of
return error code `-ENOTSUP`.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Enable signaling channel configuration for retransmission and Flow
control feature.
Send I-frame and S-frame. Support retransmission and Flow control for
sending.
Receive and handle I-frame and S-frame.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>