diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-12-22 15:07:06 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-12-22 15:07:06 +0000 |
commit | 77748065dd8ef1ede805b0af5727ccaba0bcd22a (patch) | |
tree | 291fce9c6f5b4828fa81a43148b4dbcc3526eb45 /usr.sbin/bgpd | |
parent | 1aa84235852ab028e4428386c2c32b3e345b4659 (diff) |
add a configtest mode
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/bgpd.8 | 7 | ||||
-rw-r--r-- | usr.sbin/bgpd/bgpd.c | 14 | ||||
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 3 |
3 files changed, 18 insertions, 6 deletions
diff --git a/usr.sbin/bgpd/bgpd.8 b/usr.sbin/bgpd/bgpd.8 index 441efc3a561..e10464b4aef 100644 --- a/usr.sbin/bgpd/bgpd.8 +++ b/usr.sbin/bgpd/bgpd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bgpd.8,v 1.1 2003/12/22 00:10:33 henning Exp $ +.\" $OpenBSD: bgpd.8,v 1.2 2003/12/22 15:07:05 henning Exp $ .\" .\" Copyright (c) 2003 Henning Brauer <henning@openbsd.org> .\" @@ -23,7 +23,7 @@ .Sh SYNOPSIS .Nm bgpd .Bk -words -.Op Fl dv +.Op Fl dnv .Op Fl D Ar macro=value .Op Fl f Ar file .Ek @@ -49,6 +49,9 @@ in the configuration file. Specify an alternate location, .Ar file , for the configuration file. +.It Fl n +Configtest mode. +Only check the config file for validity. .It Fl v Produce more verbose output. .El diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c index d4af64ed7a5..2395d583389 100644 --- a/usr.sbin/bgpd/bgpd.c +++ b/usr.sbin/bgpd/bgpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.c,v 1.15 2003/12/22 11:11:25 miod Exp $ */ +/* $OpenBSD: bgpd.c,v 1.16 2003/12/22 15:07:05 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -73,7 +73,7 @@ usage(void) { extern char *__progname; - fprintf(stderr, "usage: %s [-dv] ", __progname); + fprintf(stderr, "usage: %s [-dnv] ", __progname); fprintf(stderr, "[-D macro=value] [-f file]\n"); exit(1); } @@ -110,7 +110,7 @@ main(int argc, char *argv[]) bzero(&mrtconf, sizeof(mrtconf)); LIST_INIT(&mrtconf); - while ((ch = getopt(argc, argv, "dD:f:v")) != -1) { + while ((ch = getopt(argc, argv, "dD:f:nv")) != -1) { switch (ch) { case 'd': debug = 1; @@ -124,6 +124,9 @@ main(int argc, char *argv[]) case 'f': conffile = optarg; break; + case 'n': + conf.opts |= BGPD_OPT_NOACTION; + break; case 'v': if (conf.opts & BGPD_OPT_VERBOSE) conf.opts |= BGPD_OPT_VERBOSE2; @@ -138,6 +141,11 @@ main(int argc, char *argv[]) if (parse_config(conffile, &conf, &mrtconf)) exit (1); + if (conf.opts & BGPD_OPT_NOACTION) { + fprintf(stderr, "configuration OK\n"); + exit(0); + } + signal(SIGTERM, sighdlr); signal(SIGINT, sighdlr); signal(SIGCHLD, sighdlr); diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 808aa1a9f83..486928421f8 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.11 2003/12/21 23:28:39 henning Exp $ */ +/* $OpenBSD: bgpd.h,v 1.12 2003/12/22 15:07:05 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -37,6 +37,7 @@ #define BGPD_OPT_VERBOSE 0x0001 #define BGPD_OPT_VERBOSE2 0x0002 +#define BGPD_OPT_NOACTION 0x0004 enum { PROC_MAIN, |