]> git.meshlink.io Git - meshlink/blobdiff - src/net_setup.c
Add meshlink_set_storage_policy().
[meshlink] / src / net_setup.c
index 6168c4ca340dfc92f9551c2c17f78eb624600758..a7a538f01c75d1b4ed66fa77114391bbce123ce1 100644 (file)
@@ -218,11 +218,26 @@ bool node_read_from_config(meshlink_handle_t *mesh, node_t *n, const config_t *c
        return packmsg_done(&in);
 }
 
-bool node_write_config(meshlink_handle_t *mesh, node_t *n) {
+bool node_write_config(meshlink_handle_t *mesh, node_t *n, bool new_key) {
        if(!mesh->confbase) {
                return true;
        }
 
+       switch(mesh->storage_policy) {
+       case MESHLINK_STORAGE_KEYS_ONLY:
+               if(!new_key) {
+                       return true;
+               }
+
+               break;
+
+       case MESHLINK_STORAGE_DISABLED:
+               return true;
+
+       default:
+               break;
+       }
+
        uint8_t buf[4096];
        packmsg_output_t out = {buf, sizeof(buf)};
 
@@ -271,6 +286,7 @@ bool node_write_config(meshlink_handle_t *mesh, node_t *n) {
                return false;
        }
 
+       n->status.dirty = false;
        return true;
 }