]> git.puffer.fish Git - matthieu/frr.git/commitdiff
mgmtd: don't add implicit state data when reading config from file
authorIgor Ryzhov <idryzhov@gmail.com>
Wed, 7 Aug 2024 21:40:51 +0000 (00:40 +0300)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Sat, 10 Aug 2024 08:11:52 +0000 (08:11 +0000)
When mgmt reads configuration from file, it shouldn't add implicit state
data to the candidate datastore. Configuration datastores like candidate
should never store state, otherwise they fail validation.

Fixes #15814

Signed-off-by: Igor Ryzhov <idryzhov@gmail.com>
(cherry picked from commit 61e8d5e0b9f0ccb7647a04974f7134ede67fedd8)

mgmtd/mgmt_ds.c

index eaf52dfb29207c01e7e05a71d5899f3057ef2706..dabae4afd1b0274884ce258dcf8b9a1dadcda148 100644 (file)
@@ -127,7 +127,8 @@ static int mgmt_ds_load_cfg_from_file(const char *filepath,
 
        *dnode = NULL;
        ret = lyd_parse_data_path(ly_native_ctx, filepath, LYD_JSON,
-                                 LYD_PARSE_STRICT, 0, dnode);
+                                 LYD_PARSE_NO_STATE | LYD_PARSE_STRICT,
+                                 LYD_VALIDATE_NO_STATE, dnode);
 
        if (ret != LY_SUCCESS) {
                if (*dnode)