diff options
author | Paul Jakma <paul.jakma@sun.com> | 2006-10-15 23:35:57 +0000 |
---|---|---|
committer | Paul Jakma <paul.jakma@sun.com> | 2006-10-15 23:35:57 +0000 |
commit | 876b8be0ab24721e8f94d47dde022563f76db992 (patch) | |
tree | 60afcf14974d39a081b64c71191038701e73a3f5 /ripd | |
parent | 98954844ae56d142e96341d5dff959ec5518111e (diff) |
[daemon startup] Add --dry-run/-C argument to daemons, to check config file syntax
2006-10-04 Oliver Hookins <ohookins@gmail.com>
* bgpd/bgp_main.c: Add configuration check option, with
'-C' rather than '-c' for consistency between daemons.
* isisd/isis_main.c: ditto
* ospf6d/ospf6_main.c: ditto
* ospfd/ospf_main.c: ditto
* ripngd/ripng_main.c: ditto
* vtysh/vtysh_main.c: ditto
* ripd/rip_main.c: Change the config check option to
'-C' and tidy up the code.
* zebra/main.c: ditto
2006-10-04 Stergiakis Alexandros <astergiakis@antcor.com>
* ripd/rip_main.c: This trivial patch introduces a new
command-line option '-c', which instructs zebra/ripd
to check its configuration file for validity, print
any error message, and then exit. This is useful when
the configuration file is edited by hand or otherwise,
and you simply want to validate it without any other
effect.
* zebra/main.c: ditto
Diffstat (limited to 'ripd')
-rw-r--r-- | ripd/rip_main.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/ripd/rip_main.c b/ripd/rip_main.c index c9d564b7..dfcd6c26 100644 --- a/ripd/rip_main.c +++ b/ripd/rip_main.c @@ -42,6 +42,7 @@ static struct option longopts[] = { "config_file", required_argument, NULL, 'f'}, { "pid_file", required_argument, NULL, 'i'}, { "help", no_argument, NULL, 'h'}, + { "dryrun", no_argument, NULL, 'C'}, { "vty_addr", required_argument, NULL, 'A'}, { "vty_port", required_argument, NULL, 'P'}, { "retain", no_argument, NULL, 'r'}, @@ -110,6 +111,7 @@ Daemon which manages RIP version 1 and 2.\n\n\ -i, --pid_file Set process identifier file name\n\ -A, --vty_addr Set vty's bind address\n\ -P, --vty_port Set vty's port number\n\ +-C, --dryrun Check configuration for validity and exit\n\ -r, --retain When program terminates, retain added route by ripd.\n\ -u, --user User to run as\n\ -g, --group Group to run as\n\ @@ -185,6 +187,7 @@ main (int argc, char **argv) { char *p; int daemon_mode = 0; + int dryrun = 0; char *progname; struct thread thread; @@ -203,7 +206,7 @@ main (int argc, char **argv) { int opt; - opt = getopt_long (argc, argv, "df:i:hA:P:u:g:rv", longopts, 0); + opt = getopt_long (argc, argv, "df:i:hA:P:u:g:rvC", longopts, 0); if (opt == EOF) break; @@ -238,6 +241,9 @@ main (int argc, char **argv) case 'r': retain_mode = 1; break; + case 'C': + dryrun = 1; + break; case 'u': ripd_privs.user = optarg; break; @@ -280,6 +286,10 @@ main (int argc, char **argv) /* Get configuration file. */ vty_read_config (config_file, config_default); + /* Start execution only if not in dry-run mode */ + if(dryrun) + return (0); + /* Change to the daemon program. */ if (daemon_mode) daemon (0, 0); |