diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2017-04-04 22:37:02 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2017-04-04 22:37:02 +0000 |
commit | f7393e6cb454e4d5ac4e463861261d3841d0500d (patch) | |
tree | abb2c8f5e38aed4e9f48550624f98e99851c451a | |
parent | c2d3c603f576085616dcd7ca77c4759a44adce58 (diff) |
add a config test flag to sasyncd
ok reyk@ deraadt@ jmc@
-rw-r--r-- | usr.sbin/sasyncd/sasyncd.8 | 9 | ||||
-rw-r--r-- | usr.sbin/sasyncd/sasyncd.c | 16 |
2 files changed, 18 insertions, 7 deletions
diff --git a/usr.sbin/sasyncd/sasyncd.8 b/usr.sbin/sasyncd/sasyncd.8 index 89ce15ca158..7772847090c 100644 --- a/usr.sbin/sasyncd/sasyncd.8 +++ b/usr.sbin/sasyncd/sasyncd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sasyncd.8,v 1.11 2010/06/16 17:39:05 reyk Exp $ +.\" $OpenBSD: sasyncd.8,v 1.12 2017/04/04 22:37:01 jsg Exp $ .\" .\" Copyright (c) 2005 Håkan Olsson. All rights reserved. .\" @@ -27,7 +27,7 @@ .\" .\" Manual page for sasyncd .\" -.Dd $Mdocdate: June 16 2010 $ +.Dd $Mdocdate: April 4 2017 $ .Dt SASYNCD 8 .Os .Sh NAME @@ -35,7 +35,7 @@ .Nd IPsec SA synchronization daemon for failover gateways .Sh SYNOPSIS .Nm -.Op Fl dv +.Op Fl dnv .Op Fl c Ar config-file .Sh DESCRIPTION The @@ -117,6 +117,9 @@ Without this option, .Nm sends log messages to .Xr syslog 3 . +.It Fl n +Configtest mode. +Only check the configuration file for validity. .It Fl v The .Fl v diff --git a/usr.sbin/sasyncd/sasyncd.c b/usr.sbin/sasyncd/sasyncd.c index a02745f3e96..8e3be4f1ba9 100644 --- a/usr.sbin/sasyncd/sasyncd.c +++ b/usr.sbin/sasyncd/sasyncd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sasyncd.c,v 1.25 2017/04/04 14:04:54 reyk Exp $ */ +/* $OpenBSD: sasyncd.c,v 1.26 2017/04/04 22:37:01 jsg Exp $ */ /* * Copyright (c) 2005 Håkan Olsson. All rights reserved. @@ -135,7 +135,7 @@ usage(void) { extern char *__progname; - fprintf(stderr, "usage: %s [-dv] [-c config-file]\n", __progname); + fprintf(stderr, "usage: %s [-dnv] [-c config-file]\n", __progname); exit(1); } @@ -144,7 +144,7 @@ main(int argc, char **argv) { extern char *__progname; char *cfgfile = 0; - int ch; + int ch, noaction = 0; if (geteuid() != 0) { /* No point in continuing. */ @@ -153,7 +153,7 @@ main(int argc, char **argv) return 1; } - while ((ch = getopt(argc, argv, "c:dv")) != -1) { + while ((ch = getopt(argc, argv, "c:dnv")) != -1) { switch (ch) { case 'c': if (cfgfile) @@ -163,6 +163,9 @@ main(int argc, char **argv) case 'd': cfgstate.debug++; break; + case 'n': + noaction = 1; + break; case 'v': cfgstate.verboselevel++; break; @@ -198,6 +201,11 @@ main(int argc, char **argv) exit(1); } + if (noaction) { + fprintf(stderr, "configuration OK\n"); + exit(0); + } + carp_demote(CARP_INC, 0); if (carp_init()) |