]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: fix yang_dnode_dup
authorIgor Ryzhov <iryzhov@nfware.com>
Wed, 24 Jan 2024 20:26:47 +0000 (22:26 +0200)
committerIgor Ryzhov <iryzhov@nfware.com>
Sun, 28 Jan 2024 21:28:40 +0000 (23:28 +0200)
When duplicating nodes, we should always keep flags, especially the
LYD_NEW flag that indicates not validated data. This allows to select a
new choice's case without the need to explicitly remove the existing one.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
lib/yang.c

index 7a3d6df497f4fff2f97b4c25c343a31b46dfa6a9..3dd2513a4ba4edf5a506464df51379f5c72d1b21 100644 (file)
@@ -628,7 +628,8 @@ struct lyd_node *yang_dnode_dup(const struct lyd_node *dnode)
 {
        struct lyd_node *dup = NULL;
        LY_ERR err;
-       err = lyd_dup_siblings(dnode, NULL, LYD_DUP_RECURSIVE, &dup);
+       err = lyd_dup_siblings(dnode, NULL,
+                              LYD_DUP_RECURSIVE | LYD_DUP_WITH_FLAGS, &dup);
        assert(!err);
        return dup;
 }