summaryrefslogtreecommitdiff
path: root/ripngd
diff options
context:
space:
mode:
Diffstat (limited to 'ripngd')
-rw-r--r--ripngd/ripng_main.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c
index e6276c1b..70553910 100644
--- a/ripngd/ripng_main.c
+++ b/ripngd/ripng_main.c
@@ -48,6 +48,7 @@ struct option longopts[] =
{ "config_file", required_argument, NULL, 'f'},
{ "pid_file", required_argument, NULL, 'i'},
{ "log_mode", no_argument, NULL, 'l'},
+ { "dryrun", no_argument, NULL, 'C'},
{ "help", no_argument, NULL, 'h'},
{ "vty_addr", required_argument, NULL, 'A'},
{ "vty_port", required_argument, NULL, 'P'},
@@ -119,6 +120,7 @@ Daemon which manages RIPng.\n\n\
-u, --user User to run as\n\
-g, --group Group to run as\n\
-v, --version Print program version\n\
+-C, --dryrun Check configuration for validity and exit\n\
-h, --help Display this help and exit\n\
\n\
Report bugs to %s\n", progname, ZEBRA_BUG_ADDRESS);
@@ -190,6 +192,7 @@ main (int argc, char **argv)
int daemon_mode = 0;
char *progname;
struct thread thread;
+ int dryrun = 0;
/* Set umask before anything for security */
umask (0027);
@@ -204,7 +207,7 @@ main (int argc, char **argv)
{
int opt;
- opt = getopt_long (argc, argv, "dlf:i:hA:P:u:g:v", longopts, 0);
+ opt = getopt_long (argc, argv, "dlf:i:hA:P:u:g:vC", longopts, 0);
if (opt == EOF)
break;
@@ -252,6 +255,9 @@ main (int argc, char **argv)
print_version (progname);
exit (0);
break;
+ case 'C':
+ dryrun = 1;
+ break;
case 'h':
usage (progname, 0);
break;
@@ -281,6 +287,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);