summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd
diff options
context:
space:
mode:
authorPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-11-20 15:44:22 +0000
committerPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-11-20 15:44:22 +0000
commit06cda98f2ac65d76367d70562e5e25990af9200b (patch)
treed12e087d7fbacc36c80efc526062aba56524bb2e /usr.sbin/relayd
parent592ca4a35f528940ac0c5a13b93918092acab8af (diff)
Allow overriding the global interval in a table.
Table specific intervals must be multiples of the global interval. help and ok reyk@
Diffstat (limited to 'usr.sbin/relayd')
-rw-r--r--usr.sbin/relayd/hce.c8
-rw-r--r--usr.sbin/relayd/parse.y11
-rw-r--r--usr.sbin/relayd/relayd.conf.57
-rw-r--r--usr.sbin/relayd/relayd.h4
4 files changed, 25 insertions, 5 deletions
diff --git a/usr.sbin/relayd/hce.c b/usr.sbin/relayd/hce.c
index ce00543fe03..28665609b14 100644
--- a/usr.sbin/relayd/hce.c
+++ b/usr.sbin/relayd/hce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hce.c,v 1.33 2007/11/19 15:31:36 reyk Exp $ */
+/* $OpenBSD: hce.c,v 1.34 2007/11/20 15:44:21 pyr Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -229,6 +229,12 @@ hce_launch_checks(int fd, short event, void *arg)
TAILQ_FOREACH(table, env->tables, entry) {
if (table->conf.flags & F_DISABLE)
continue;
+ if (table->conf.skip_cnt) {
+ if (table->skipped++ > table->conf.skip_cnt)
+ table->skipped = 0;
+ if (table->skipped != 1)
+ continue;
+ }
if (table->conf.check == CHECK_NOCHECK)
fatalx("hce_launch_checks: unknown check type");
diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y
index 859ddbf2798..f8db0d6c26e 100644
--- a/usr.sbin/relayd/parse.y
+++ b/usr.sbin/relayd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.84 2007/11/19 15:31:36 reyk Exp $ */
+/* $OpenBSD: parse.y,v 1.85 2007/11/20 15:44:21 pyr Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -578,6 +578,15 @@ tableoptsl : host {
| DISABLE {
table->conf.flags |= F_DISABLE;
}
+ | INTERVAL NUMBER {
+ if ($2 < conf->interval.tv_sec ||
+ $2 % conf->interval.tv_sec) {
+ yyerror("table interval must be "
+ "divisible by global interval");
+ YYERROR;
+ }
+ table->conf.skip_cnt = ($2 / conf->interval.tv_sec) - 1;
+ }
;
proto : PROTO STRING {
diff --git a/usr.sbin/relayd/relayd.conf.5 b/usr.sbin/relayd/relayd.conf.5
index 9b96861487a..d863f6972e9 100644
--- a/usr.sbin/relayd/relayd.conf.5
+++ b/usr.sbin/relayd/relayd.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: relayd.conf.5,v 1.54 2007/10/22 15:45:40 jmc Exp $
+.\" $OpenBSD: relayd.conf.5,v 1.55 2007/11/20 15:44:21 pyr Exp $
.\"
.\" Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org>
.\" Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: October 22 2007 $
+.Dd $Mdocdate: November 20 2007 $
.Dt HOSTSTATED.CONF 5
.Os
.Sh NAME
@@ -288,6 +288,9 @@ The optional retry option adds a tolerance for failed host checks,
the check will be retried for
.Ar number
more times before setting the host state to down.
+.It Ic interval Ar number
+Override the global interval and specify one for this table.
+It must be a multiple of the global interval.
.It Ic real port Ar port
When using the TCP or HTTP checking methods, use this
.Ar port
diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h
index c615c94e183..5091bbb785b 100644
--- a/usr.sbin/relayd/relayd.h
+++ b/usr.sbin/relayd/relayd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.h,v 1.74 2007/11/20 13:01:13 pyr Exp $ */
+/* $OpenBSD: relayd.h,v 1.75 2007/11/20 15:44:21 pyr Exp $ */
/*
* Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -344,6 +344,7 @@ struct table_config {
struct timeval timeout;
in_port_t port;
int retcode;
+ int skip_cnt;
char name[TABLE_NAME_SIZE];
char path[MAXPATHLEN];
char exbuf[64];
@@ -354,6 +355,7 @@ struct table {
TAILQ_ENTRY(table) entry;
struct table_config conf;
int up;
+ int skipped;
struct hostlist hosts;
SSL_CTX *ssl_ctx;
int sendbuf_len;