diff options
Diffstat (limited to 'lib/northbound.c')
| -rw-r--r-- | lib/northbound.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/northbound.c b/lib/northbound.c index 18500a8bd2..99c6ab57ec 100644 --- a/lib/northbound.c +++ b/lib/northbound.c @@ -122,8 +122,8 @@ static int nb_node_new_cb(const struct lys_node *snode, void *arg) if (CHECK_FLAG(snode->nodetype, LYS_CONTAINER | LYS_LIST)) { bool config_only = true; - yang_snodes_iterate_subtree(snode, nb_node_check_config_only, - YANG_ITER_ALLOW_AUGMENTATIONS, + yang_snodes_iterate_subtree(snode, NULL, + nb_node_check_config_only, 0, &config_only); if (config_only) SET_FLAG(nb_node->flags, F_NB_NODE_CONFIG_ONLY); @@ -141,6 +141,7 @@ static int nb_node_new_cb(const struct lys_node *snode, void *arg) * another. */ nb_node->snode = snode; + assert(snode->priv == NULL); lys_set_private(snode, nb_node); return YANG_ITER_CONTINUE; @@ -383,6 +384,10 @@ static void nb_config_diff_add_change(struct nb_config_cbs *changes, { struct nb_config_change *change; + /* Ignore unimplemented nodes. */ + if (!dnode->schema->priv) + return; + change = XCALLOC(MTYPE_TMP, sizeof(*change)); change->cb.operation = operation; change->cb.seq = *seq; @@ -416,6 +421,10 @@ static void nb_config_diff_created(const struct lyd_node *dnode, uint32_t *seq, enum nb_operation operation; struct lyd_node *child; + /* Ignore unimplemented nodes. */ + if (!dnode->schema->priv) + return; + switch (dnode->schema->nodetype) { case LYS_LEAF: case LYS_LEAFLIST: @@ -450,6 +459,10 @@ static void nb_config_diff_created(const struct lyd_node *dnode, uint32_t *seq, static void nb_config_diff_deleted(const struct lyd_node *dnode, uint32_t *seq, struct nb_config_cbs *changes) { + /* Ignore unimplemented nodes. */ + if (!dnode->schema->priv) + return; + if (nb_operation_is_valid(NB_OP_DESTROY, dnode->schema)) nb_config_diff_add_change(changes, NB_OP_DESTROY, seq, dnode); else if (CHECK_FLAG(dnode->schema->nodetype, LYS_CONTAINER)) { @@ -618,7 +631,7 @@ static int nb_candidate_validate_code(struct nb_context *context, struct nb_node *nb_node; nb_node = child->schema->priv; - if (!nb_node->cbs.pre_validate) + if (!nb_node || !nb_node->cbs.pre_validate) goto next; ret = nb_callback_pre_validate(context, nb_node, child, @@ -1385,7 +1398,7 @@ static void nb_transaction_apply_finish(struct nb_transaction *transaction, struct nb_node *nb_node; nb_node = dnode->schema->priv; - if (!nb_node->cbs.apply_finish) + if (!nb_node || !nb_node->cbs.apply_finish) goto next; /* |
