diff options
| -rw-r--r-- | lib/libfrr.c | 22 | ||||
| -rw-r--r-- | lib/vty.c | 3 |
2 files changed, 18 insertions, 7 deletions
diff --git a/lib/libfrr.c b/lib/libfrr.c index d4aa1f899a..8ef32eaa8a 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -853,22 +853,34 @@ static void frr_daemonize(void) */ static int frr_config_read_in(struct thread *t) { - if (!vty_read_config(NULL, di->config_file, config_default) && - di->backup_config_file) { + if (!vty_read_config(vty_shared_candidate_config, di->config_file, + config_default) + && di->backup_config_file) { char *orig = XSTRDUP(MTYPE_TMP, host_config_get()); zlog_info("Attempting to read backup config file: %s specified", di->backup_config_file); - vty_read_config(NULL, di->backup_config_file, config_default); + vty_read_config(vty_shared_candidate_config, + di->backup_config_file, config_default); host_config_set(orig); XFREE(MTYPE_TMP, orig); } /* - * Update the shared candidate after reading the startup configuration. + * Automatically commit the candidate configuration after + * reading the configuration file. */ - nb_config_replace(vty_shared_candidate_config, running_config, true); + if (frr_get_cli_mode() == FRR_CLI_TRANSACTIONAL) { + int ret; + + ret = nb_candidate_commit(vty_shared_candidate_config, + NB_CLIENT_CLI, NULL, true, + "Read configuration file", NULL); + if (ret != NB_OK && ret != NB_ERR_NO_CHANGES) + zlog_err("%s: failed to read configuration file.", + __func__); + } return 0; } @@ -2341,8 +2341,7 @@ static void vty_read_file(struct nb_config *config, FILE *confp) * Automatically commit the candidate configuration after * reading the configuration file. */ - if (config == NULL && vty->candidate_config - && frr_get_cli_mode() == FRR_CLI_TRANSACTIONAL) { + if (config == NULL) { ret = nb_candidate_commit(vty->candidate_config, NB_CLIENT_CLI, vty, true, "Read configuration file", NULL); |
