mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
ble_mesh: Fix restore when revoke keys [Zephyr]
Store keys (NetKey and AppKey) again after revoking.
This commit is contained in:
@ -501,6 +501,10 @@ void bt_mesh_net_revoke_keys(struct bt_mesh_subnet *sub)
|
|||||||
BT_DBG("idx 0x%04x", sub->net_idx);
|
BT_DBG("idx 0x%04x", sub->net_idx);
|
||||||
|
|
||||||
memcpy(&sub->keys[0], &sub->keys[1], sizeof(sub->keys[0]));
|
memcpy(&sub->keys[0], &sub->keys[1], sizeof(sub->keys[0]));
|
||||||
|
if (IS_ENABLED(CONFIG_BLE_MESH_SETTINGS)) {
|
||||||
|
BT_DBG("Store updated NetKey persistently");
|
||||||
|
bt_mesh_store_subnet(sub);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(bt_mesh.app_keys); i++) {
|
for (i = 0; i < ARRAY_SIZE(bt_mesh.app_keys); i++) {
|
||||||
struct bt_mesh_app_key *key = &bt_mesh.app_keys[i];
|
struct bt_mesh_app_key *key = &bt_mesh.app_keys[i];
|
||||||
@ -511,6 +515,10 @@ void bt_mesh_net_revoke_keys(struct bt_mesh_subnet *sub)
|
|||||||
|
|
||||||
memcpy(&key->keys[0], &key->keys[1], sizeof(key->keys[0]));
|
memcpy(&key->keys[0], &key->keys[1], sizeof(key->keys[0]));
|
||||||
key->updated = false;
|
key->updated = false;
|
||||||
|
if (IS_ENABLED(CONFIG_BLE_MESH_SETTINGS)) {
|
||||||
|
BT_DBG("Store updated AppKey persistently");
|
||||||
|
bt_mesh_store_app_key(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user