Skip to content

Commit

Permalink
config UPDATE make netconf-server subtree optional
Browse files Browse the repository at this point in the history
  • Loading branch information
roman committed Sep 14, 2023
1 parent ccd4326 commit 56c2c78
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/server_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -4885,11 +4885,16 @@ static int
nc_server_config_fill_nectonf_server(const struct lyd_node *data, NC_OPERATION op)
{
int ret = 0;
uint32_t prev_lo;
struct lyd_node *tree;

/* silently search for ietf-netconf-server, it may not be present */
prev_lo = ly_log_options(0);

ret = lyd_find_path(data, "/ietf-netconf-server:netconf-server", 0, &tree);
if (ret) {
ERR(NULL, "Unable to find the netconf-server container in the YANG data.");
if (ret || (tree->flags & LYD_DEFAULT)) {
/* not found */
ret = 0;
goto cleanup;
}

Expand All @@ -4907,6 +4912,8 @@ nc_server_config_fill_nectonf_server(const struct lyd_node *data, NC_OPERATION o
#endif /* NC_ENABLED_SSH_TLS */

cleanup:
/* reset the logging options back to what they were */
ly_log_options(prev_lo);
return ret;
}

Expand All @@ -4915,6 +4922,8 @@ nc_server_config_setup_diff(const struct lyd_node *data)
{
int ret = 0;

NC_CHECK_ARG_RET(NULL, data, 1);

/* LOCK */
pthread_rwlock_wrlock(&server_opts.config_lock);

Expand Down Expand Up @@ -4953,6 +4962,8 @@ nc_server_config_setup_data(const struct lyd_node *data)
int ret = 0;
struct lyd_node *tree, *iter, *root;

NC_CHECK_ARG_RET(NULL, data, 1);

/* LOCK */
pthread_rwlock_wrlock(&server_opts.config_lock);

Expand Down

0 comments on commit 56c2c78

Please sign in to comment.