summaryrefslogtreecommitdiff
path: root/lib/yang.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yang.c')
-rw-r--r--lib/yang.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/yang.c b/lib/yang.c
index 0e7ea3037e..660a54a22a 100644
--- a/lib/yang.c
+++ b/lib/yang.c
@@ -496,12 +496,18 @@ void *yang_dnode_get_entry(const struct lyd_node *dnode)
abort();
}
-struct lyd_node *yang_dnode_new(struct ly_ctx *ly_ctx)
+struct lyd_node *yang_dnode_new(struct ly_ctx *ly_ctx, bool config_only)
{
struct lyd_node *dnode;
+ int options;
+
+ if (config_only)
+ options = LYD_OPT_CONFIG;
+ else
+ options = LYD_OPT_DATA | LYD_OPT_DATA_NO_YANGLIB;
dnode = NULL;
- if (lyd_validate(&dnode, LYD_OPT_CONFIG, ly_ctx) != 0) {
+ if (lyd_validate(&dnode, options, ly_ctx) != 0) {
/* Should never happen. */
flog_err(EC_LIB_LIBYANG, "%s: lyd_validate() failed", __func__);
exit(1);