summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2020-12-16 13:47:24 -0500
committerGitHub <noreply@github.com>2020-12-16 13:47:24 -0500
commit91653aefd487fb35ffca8f2d8db35b8c2b03fd6c (patch)
tree3a96a30f3397e791b2c397e451e1c044ca843bd2
parent764785a2b1f6667a825f949b8fc166c1692b89a2 (diff)
parent77f7b4b018735076ca7795f6e0741fb3e0d1a018 (diff)
Merge pull request #7744 from donaldsharp/end_configuration
End configuration changes
-rw-r--r--lib/lib_vty.c4
-rw-r--r--vtysh/vtysh.c2
-rw-r--r--vtysh/vtysh.h2
-rw-r--r--vtysh/vtysh_config.c12
-rw-r--r--vtysh/vtysh_main.c10
5 files changed, 16 insertions, 14 deletions
diff --git a/lib/lib_vty.c b/lib/lib_vty.c
index 0cc25f24ed..cd8b5c9809 100644
--- a/lib/lib_vty.c
+++ b/lib/lib_vty.c
@@ -222,7 +222,7 @@ static struct call_back {
DEFUN_HIDDEN (start_config,
start_config_cmd,
- "start_configuration",
+ "XFRR_start_configuration",
"The Beginning of Configuration\n")
{
callback.readin_time = monotime(NULL);
@@ -235,7 +235,7 @@ DEFUN_HIDDEN (start_config,
DEFUN_HIDDEN (end_config,
end_config_cmd,
- "end_configuration",
+ "XFRR_end_configuration",
"The End of Configuration\n")
{
time_t readin_time;
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index c78132508f..c3fb663f55 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -3187,7 +3187,7 @@ DEFUN (vtysh_copy_to_running,
int ret;
const char *fname = argv[1]->arg;
- ret = vtysh_read_config(fname);
+ ret = vtysh_read_config(fname, true);
/* Return to enable mode - the 'read_config' api leaves us up a level */
vtysh_execute_no_pager("enable");
diff --git a/vtysh/vtysh.h b/vtysh/vtysh.h
index d2675a81b9..b2e37074f7 100644
--- a/vtysh/vtysh.h
+++ b/vtysh/vtysh.h
@@ -92,7 +92,7 @@ void config_add_line(struct list *, const char *);
int vtysh_mark_file(const char *filename);
-int vtysh_read_config(const char *);
+int vtysh_read_config(const char *filename, bool dry_run);
int vtysh_write_config_integrated(void);
void vtysh_config_parse_line(void *, const char *);
diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c
index f35a8af4b9..47f426b5e0 100644
--- a/vtysh/vtysh_config.c
+++ b/vtysh/vtysh_config.c
@@ -515,7 +515,7 @@ void vtysh_config_dump(void)
}
/* Read up configuration file from file_name. */
-static int vtysh_read_file(FILE *confp)
+static int vtysh_read_file(FILE *confp, bool dry_run)
{
struct vty *vty;
int ret;
@@ -528,12 +528,14 @@ static int vtysh_read_file(FILE *confp)
vtysh_execute_no_pager("enable");
vtysh_execute_no_pager("configure terminal");
- vtysh_execute_no_pager("start_configuration");
+ if (!dry_run)
+ vtysh_execute_no_pager("XFRR_start_configuration");
/* Execute configuration file. */
ret = vtysh_config_from_file(vty, confp);
- vtysh_execute_no_pager("end_configuration");
+ if (!dry_run)
+ vtysh_execute_no_pager("XFRR_end_configuration");
vtysh_execute_no_pager("end");
vtysh_execute_no_pager("disable");
@@ -544,7 +546,7 @@ static int vtysh_read_file(FILE *confp)
}
/* Read up configuration file from config_default_dir. */
-int vtysh_read_config(const char *config_default_dir)
+int vtysh_read_config(const char *config_default_dir, bool dry_run)
{
FILE *confp = NULL;
int ret;
@@ -557,7 +559,7 @@ int vtysh_read_config(const char *config_default_dir)
return CMD_ERR_NO_FILE;
}
- ret = vtysh_read_file(confp);
+ ret = vtysh_read_file(confp, dry_run);
fclose(confp);
return (ret);
diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c
index 6e28df79d6..db7cc312d6 100644
--- a/vtysh/vtysh_main.c
+++ b/vtysh/vtysh_main.c
@@ -459,7 +459,7 @@ int main(int argc, char **argv, char **env)
/* Read vtysh configuration file before connecting to daemons.
* (file may not be readable to calling user in SUID mode) */
suid_on();
- vtysh_read_config(vtysh_config);
+ vtysh_read_config(vtysh_config, dryrun);
suid_off();
}
/* Error code library system */
@@ -478,9 +478,9 @@ int main(int argc, char **argv, char **env)
/* Start execution only if not in dry-run mode */
if (dryrun && !cmd) {
if (inputfile) {
- ret = vtysh_read_config(inputfile);
+ ret = vtysh_read_config(inputfile, dryrun);
} else {
- ret = vtysh_read_config(frr_config);
+ ret = vtysh_read_config(frr_config, dryrun);
}
exit(ret);
@@ -561,7 +561,7 @@ int main(int argc, char **argv, char **env)
if (inputfile) {
vtysh_flock_config(inputfile);
- ret = vtysh_read_config(inputfile);
+ ret = vtysh_read_config(inputfile, dryrun);
vtysh_unflock_config();
exit(ret);
}
@@ -670,7 +670,7 @@ int main(int argc, char **argv, char **env)
/* Boot startup configuration file. */
if (boot_flag) {
vtysh_flock_config(frr_config);
- ret = vtysh_read_config(frr_config);
+ ret = vtysh_read_config(frr_config, dryrun);
vtysh_unflock_config();
if (ret) {
fprintf(stderr,