host/mesh: Verify that all stored mesh entries removed
This ensures that all mesh settings were removed from persistent storage
after node reset.
This is port of
@@ -1161,6 +1161,7 @@ void bt_mesh_net_pending_seq_store(void)
struct seq_val seq;
int err;
+ if (atomic_test_bit(bt_mesh.flags, BT_MESH_VALID)) {
sys_put_le24(bt_mesh.seq, seq.val);
str = settings_str_from_bytes(&seq, sizeof(seq), buf, sizeof(buf));
@@ -1176,6 +1177,14 @@ void bt_mesh_net_pending_seq_store(void)
} else {
BT_DBG("Stored Seq value");
}
+ } else {
+ err = settings_save_one("bt_mesh/Seq", NULL);
+ if (err) {
+ BT_ERR("Failed to clear Seq value");
+ } else {
+ BT_DBG("Cleared Seq value");
+ }
+ }
}
void bt_mesh_net_clear(void)
@@ -1183,6 +1192,7 @@ void bt_mesh_net_clear(void)
bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_NET_PENDING);
bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_IV_PENDING);
bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_CFG_PENDING);
+ bt_mesh_settings_store_schedule(BT_MESH_SETTINGS_SEQ_PENDING);
}
void bt_mesh_net_settings_commit(void)
