From 573de11fab9c6ffd5b647ab1b9b0c23ad99fb52e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 7 May 2018 21:01:15 -0400 Subject: [PATCH] lib: Add ability to retry if backup is specified If we fail to read in the config file and we have specified a backup of the backup, attempt to read that information. Signed-off-by: Donald Sharp --- lib/libfrr.c | 7 ++++++- lib/libfrr.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/libfrr.c b/lib/libfrr.c index 88203fbeb6..4620cb2586 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -725,7 +725,12 @@ void frr_config_fork(void) { hook_call(frr_late_init, master); - vty_read_config(di->config_file, config_default); + if (!vty_read_config(di->config_file, config_default) && + di->backup_config_file) { + zlog_info("Attempting to read backup config file: %s specified", + di->backup_config_file); + vty_read_config(di->backup_config_file, config_default); + } /* Don't start execution if we are in dry-run mode */ if (di->dryrun) diff --git a/lib/libfrr.h b/lib/libfrr.h index 7ffa780bfb..bd572cce1b 100644 --- a/lib/libfrr.h +++ b/lib/libfrr.h @@ -51,6 +51,7 @@ struct frr_daemon_info { bool daemon_mode; bool terminal; const char *config_file; + const char *backup_config_file; const char *pid_file; const char *vty_path; const char *module_path; -- 2.39.5