mesh: Store Krp phase after krp value changed

Store krp phase persistently when this value has been changed.

this is port of 6a4aefb66917d2a9fac0b00e0cef4bb976447144
This commit is contained in:
Krzysztof Kopyściński
2021-01-12 14:05:19 +01:00
committed by Łukasz Rymanowski
parent ca59f8d8f6
commit 2bcd23d6d9
2 changed files with 10 additions and 0 deletions
+5
View File
@@ -2918,6 +2918,11 @@ static void krp_set(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
phase == BT_MESH_KR_PHASE_2) {
sub->kr_phase = BT_MESH_KR_PHASE_2;
sub->kr_flag = 1;
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
BT_DBG("Storing krp phase persistently");
bt_mesh_store_subnet(sub);
}
bt_mesh_net_beacon_update(sub);
} else if ((sub->kr_phase == BT_MESH_KR_PHASE_1 ||
sub->kr_phase == BT_MESH_KR_PHASE_2) &&
+5
View File
@@ -518,6 +518,11 @@ bool bt_mesh_kr_update(struct bt_mesh_subnet *sub, u8_t new_kr, bool new_key)
if (sub->kr_phase == BT_MESH_KR_PHASE_1) {
BT_DBG("Phase 1 -> Phase 2");
sub->kr_phase = BT_MESH_KR_PHASE_2;
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
BT_DBG("Storing krp phase persistently");
bt_mesh_store_subnet(sub);
}
return true;
}
} else {