Bluetooth: Mesh: Fix restore when revoke keys

Store keys again after revokes keys

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
This commit is contained in:
Lingao Meng 2020-03-29 06:37:18 -07:00 committed by Johan Hedberg
commit 96c733c4d7

View file

@ -481,6 +481,10 @@ void bt_mesh_net_revoke_keys(struct bt_mesh_subnet *sub)
BT_DBG("idx 0x%04x", sub->net_idx);
memcpy(&sub->keys[0], &sub->keys[1], sizeof(sub->keys[0]));
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
BT_DBG("Storing Updated NetKey persistently");
bt_mesh_store_subnet(sub);
}
for (i = 0; i < ARRAY_SIZE(bt_mesh.app_keys); i++) {
struct bt_mesh_app_key *key = &bt_mesh.app_keys[i];
@ -491,6 +495,10 @@ void bt_mesh_net_revoke_keys(struct bt_mesh_subnet *sub)
memcpy(&key->keys[0], &key->keys[1], sizeof(key->keys[0]));
key->updated = false;
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
BT_DBG("Storing Updated AppKey persistently");
bt_mesh_store_app_key(key);
}
}
}