summaryrefslogtreecommitdiffstats
path: root/lib/yang.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2024-01-24 21:26:47 +0100
committerIgor Ryzhov <iryzhov@nfware.com>2024-01-28 22:28:40 +0100
commitfe76036002c65428c189849b578d30a3a4c179a2 (patch)
treecea5de3155a5af1dd7b8118877df0efe4ea20822 /lib/yang.c
parentzebra: convert vrf configuration output to NB (diff)
downloadfrr-fe76036002c65428c189849b578d30a3a4c179a2.tar.xz
frr-fe76036002c65428c189849b578d30a3a4c179a2.zip
lib: fix yang_dnode_dup
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>
Diffstat (limited to 'lib/yang.c')
-rw-r--r--lib/yang.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/yang.c b/lib/yang.c
index 7a3d6df49..3dd2513a4 100644
--- a/lib/yang.c
+++ b/lib/yang.c
@@ -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;
}