Bluetooth: Classic: SMP: Derived LE keys are not handled correctly
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>
This commit is contained in:
parent
a7ba802dbe
commit
8bb67c5824
1 changed files with 23 additions and 1 deletions
|
@ -822,6 +822,24 @@ static void smp_br_reset(struct bt_smp_br *smp)
|
|||
atomic_set_bit(smp->allowed_cmds, BT_SMP_CMD_PAIRING_REQ);
|
||||
}
|
||||
|
||||
static void smp_br_id_add_replace(struct bt_keys *keys)
|
||||
{
|
||||
struct bt_keys *conflict;
|
||||
|
||||
conflict = bt_id_find_conflict(keys);
|
||||
if (conflict != NULL) {
|
||||
int err;
|
||||
|
||||
LOG_DBG("Un-pairing old conflicting bond and finalizing new.");
|
||||
|
||||
err = bt_unpair(conflict->id, &conflict->addr);
|
||||
__ASSERT_NO_MSG(!err);
|
||||
}
|
||||
|
||||
__ASSERT_NO_MSG(!bt_id_find_conflict(keys));
|
||||
bt_id_add(keys);
|
||||
}
|
||||
|
||||
static void smp_pairing_br_complete(struct bt_smp_br *smp, uint8_t status)
|
||||
{
|
||||
struct bt_conn *conn = smp->chan.chan.conn;
|
||||
|
@ -852,9 +870,13 @@ static void smp_pairing_br_complete(struct bt_smp_br *smp, uint8_t status)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
bool bond_flag = atomic_test_bit(smp->flags, SMP_FLAG_BOND);
|
||||
bool bond_flag = !atomic_test_bit(conn->flags, BT_CONN_BR_NOBOND);
|
||||
struct bt_conn_auth_info_cb *listener, *next;
|
||||
|
||||
if (keys) {
|
||||
smp_br_id_add_replace(keys);
|
||||
}
|
||||
|
||||
if (bond_flag && keys) {
|
||||
bt_keys_store(keys);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue