+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
+
2006-08-27 Paul Jakma <paul.jakma@sun.com>
* configure.ac: Bump to 0.99.5
{ "user", required_argument, NULL, 'u'},
{ "group", required_argument, NULL, 'g'},
{ "version", no_argument, NULL, 'v'},
+ { "dryrun", no_argument, NULL, 'C'},
{ "help", no_argument, NULL, 'h'},
{ 0 }
};
-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);
char *p;
int opt;
int daemon_mode = 0;
+ int dryrun = 0;
char *progname;
struct thread thread;
/* Command line argument treatment. */
while (1)
{
- opt = getopt_long (argc, argv, "df:i:hp:A:P:rnu:g:v", longopts, 0);
+ opt = getopt_long (argc, argv, "df:i:hp:A:P:rnu:g:vC", longopts, 0);
if (opt == EOF)
break;
print_version (progname);
exit (0);
break;
+ case 'C':
+ dryrun = 1;
+ break;
case 'h':
usage (progname, 0);
break;
/* Parse config file. */
vty_read_config (config_file, config_default);
+ /* Start execution only if not in dry-run mode */
+ if(dryrun)
+ return(0);
+
/* Turn into daemon if daemon_mode is set. */
if (daemon_mode)
daemon (0, 0);
{"user", required_argument, NULL, 'u'},
{"group", required_argument, NULL, 'g'},
{"version", no_argument, NULL, 'v'},
+ {"dryrun", no_argument, NULL, 'C'},
{"help", no_argument, NULL, 'h'},
{0}
};
-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 http://bugzilla.quagga.net\n", progname);
struct thread thread;
char *config_file = NULL;
char *vty_addr = NULL;
+ int dryrun = 0;
/* Get the programname without the preceding path. */
progname = ((p = strrchr (argv[0], '/')) ? ++p : argv[0]);
/* Command line argument treatment. */
while (1)
{
- opt = getopt_long (argc, argv, "df:i:hA:p:P:u:g:v", longopts, 0);
+ opt = getopt_long (argc, argv, "df:i:hA:p:P:u:g:vC", longopts, 0);
if (opt == EOF)
break;
print_version ("Zebra");
exit (0);
break;
+ case 'C':
+ dryrun = 1;
+ break;
case 'h':
usage (0);
break;
vty_read_config (config_file, config_default);
vty_read_config (config_file, config_default);
+ /* Start execution only if not in dry-run mode */
+ if (dryrun)
+ return(0);
+
/* demonize */
if (daemon_mode)
daemon (0, 0);
{ "user", required_argument, NULL, 'u'},
{ "group", required_argument, NULL, 'g'},
{ "version", no_argument, NULL, 'v'},
+ { "dryrun", no_argument, NULL, 'C'},
{ "help", no_argument, NULL, 'h'},
{ 0 }
};
-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 zebra@zebra.org\n", progname);
int vty_port = 0;
char *config_file = NULL;
struct thread thread;
+ int dryrun = 0;
/* Set umask before anything for security */
umask (0027);
/* Command line argument treatment. */
while (1)
{
- opt = getopt_long (argc, argv, "df:i:hp:A:P:u:g:v", longopts, 0);
+ opt = getopt_long (argc, argv, "df:i:hp:A:P:u:g:vC", longopts, 0);
if (opt == EOF)
break;
print_version (progname);
exit (0);
break;
+ case 'C':
+ dryrun = 1;
+ break;
case 'h':
usage (progname, 0);
break;
/* parse config file */
vty_read_config (config_file, config_default);
+ /* Start execution only if not in dry-run mode */
+ if (dryrun)
+ return(0);
+
if (daemon_mode)
daemon (0, 0);
{ "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'},
-g, --group Group to run as\n\
-a. --apiserver Enable OSPF apiserver\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);
char *config_file = NULL;
char *progname;
struct thread thread;
+ int dryrun = 0;
/* Set umask before anything for security */
umask (0027);
{
int opt;
- opt = getopt_long (argc, argv, "dlf:i:hA:P:u:g:av", longopts, 0);
+ opt = getopt_long (argc, argv, "dlf:i:hA:P:u:g:avC", longopts, 0);
if (opt == EOF)
break;
print_version (progname);
exit (0);
break;
+ case 'C':
+ dryrun = 1;
+ break;
case 'h':
usage (progname, 0);
break;
/* 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);
{ "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'},
-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\
{
char *p;
int daemon_mode = 0;
+ int dryrun = 0;
char *progname;
struct thread thread;
{
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;
case 'r':
retain_mode = 1;
break;
+ case 'C':
+ dryrun = 1;
+ break;
case 'u':
ripd_privs.user = optarg;
break;
/* 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);
{ "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'},
-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);
int daemon_mode = 0;
char *progname;
struct thread thread;
+ int dryrun = 0;
/* Set umask before anything for security */
umask (0027);
{
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;
print_version (progname);
exit (0);
break;
+ case 'C':
+ dryrun = 1;
+ break;
case 'h':
usage (progname, 0);
break;
/* 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);
"-c, --command Execute argument as command\n" \
"-d, --daemon Connect only to the specified daemon\n" \
"-E, --echo Echo prompt and command in -c mode\n" \
+ "-C, --dryrun Check configuration for validity and exit\n" \
"-h, --help Display this help and exit\n\n" \
"Note that multiple commands may be executed from the command\n" \
"line by passing multiple -c args, or by embedding linefeed\n" \
{ "command", required_argument, NULL, 'c'},
{ "daemon", required_argument, NULL, 'd'},
{ "echo", no_argument, NULL, 'E'},
+ { "dryrun", no_argument, NULL, 'C'},
{ "help", no_argument, NULL, 'h'},
{ 0 }
};
{
char *p;
int opt;
+ int dryrun = 0;
int boot_flag = 0;
const char *daemon_name = NULL;
struct cmd_rec {
/* Option handling. */
while (1)
{
- opt = getopt_long (argc, argv, "be:c:d:Eh", longopts, 0);
+ opt = getopt_long (argc, argv, "be:c:d:EhC", longopts, 0);
if (opt == EOF)
break;
case 'E':
echo_command = 1;
break;
+ case 'C':
+ dryrun = 1;
+ break;
case 'h':
usage (0);
break;
/* Read vtysh configuration file before connecting to daemons. */
vtysh_read_config (config_default);
+ /* Start execution only if not in dry-run mode */
+ if(dryrun)
+ return(0);
+
/* Make sure we pass authentication before proceeding. */
vtysh_auth ();
{ "vty_addr", required_argument, NULL, 'A'},
{ "vty_port", required_argument, NULL, 'P'},
{ "retain", no_argument, NULL, 'r'},
+ { "dryrun", no_argument, NULL, 'C'},
#ifdef HAVE_NETLINK
{ "nl-bufsize", required_argument, NULL, 's'},
#endif /* HAVE_NETLINK */
"-k, --keep_kernel Don't delete old routes which installed by "\
"zebra.\n"\
"-l, --log_mode Set verbose log mode flag\n"\
+ "-C, --dryrun Check configuration for validity and exit\n"\
"-A, --vty_addr Set vty's bind address\n"\
"-P, --vty_port Set vty's port number\n"\
"-r, --retain When program terminates, retain added route "\
char *p;
char *vty_addr = NULL;
int vty_port = ZEBRA_VTY_PORT;
+ int dryrun = 0;
int batch_mode = 0;
int daemon_mode = 0;
char *config_file = NULL;
int opt;
#ifdef HAVE_NETLINK
- opt = getopt_long (argc, argv, "bdklf:i:hA:P:ru:g:vs:", longopts, 0);
+ opt = getopt_long (argc, argv, "bdklf:i:hA:P:ru:g:vs:C", longopts, 0);
#else
- opt = getopt_long (argc, argv, "bdklf:i:hA:P:ru:g:v", longopts, 0);
+ opt = getopt_long (argc, argv, "bdklf:i:hA:P:ru:g:vC", longopts, 0);
#endif /* HAVE_NETLINK */
if (opt == EOF)
case 'k':
keep_kernel_mode = 1;
break;
+ case 'C':
+ dryrun = 1;
+ break;
case 'l':
/* log_mode = 1; */
break;
/* Configuration file read*/
vty_read_config (config_file, config_default);
+ /* Don't start execution if we are in dry-run mode */
+ if (dryrun)
+ return(0);
+
/* Clean up rib. */
rib_weed_tables ();