summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/hce.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2008-07-19 10:52:33 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2008-07-19 10:52:33 +0000
commita29b78681c68363bff2f4403add1c13ecccc6632 (patch)
tree22b340b1e99dfa6cf33278acf4095075578c67e2 /usr.sbin/relayd/hce.c
parent2e36ce62e78a3e17f4e280a66bb9663fdc65d1a4 (diff)
If the new 'parent' keyword is specified for a host in a table,
inherit the state from another host with the specified Id; no additional check will be for the inheriting host. This helps in scenarios with lots of IP aliases that all point to the same service on the same host (like web hosting with many SSL domains). discussed with pyr, tested in different setups
Diffstat (limited to 'usr.sbin/relayd/hce.c')
-rw-r--r--usr.sbin/relayd/hce.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/usr.sbin/relayd/hce.c b/usr.sbin/relayd/hce.c
index f0cd92cfb47..262f7f646c9 100644
--- a/usr.sbin/relayd/hce.c
+++ b/usr.sbin/relayd/hce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hce.c,v 1.41 2008/03/12 10:50:44 pyr Exp $ */
+/* $OpenBSD: hce.c,v 1.42 2008/07/19 10:52:32 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -240,7 +240,7 @@ hce_launch_checks(int fd, short event, void *arg)
fatalx("hce_launch_checks: unknown check type");
TAILQ_FOREACH(host, &table->hosts, entry) {
- if (host->flags & F_DISABLE)
+ if (host->flags & F_DISABLE || host->conf.parentid)
continue;
switch (table->conf.check) {
case CHECK_ICMP:
@@ -276,6 +276,10 @@ hce_notify_done(struct host *host, const char *msg)
struct timeval tv_now, tv_dur;
u_long duration;
u_int logopt;
+ struct host *h;
+ int hostup;
+
+ hostup = host->up;
if (host->up == HOST_DOWN && host->retry_cnt) {
log_debug("hce_notify_done: host %s retry %d",
@@ -327,6 +331,15 @@ hce_notify_done(struct host *host, const char *msg)
snmp_hosttrap(table, host);
host->last_up = host->up;
+
+ if (TAILQ_EMPTY(&host->children))
+ return;
+
+ /* Notify for all other hosts that inherit the state from this one */
+ TAILQ_FOREACH(h, &host->children, child) {
+ h->up = hostup;
+ hce_notify_done(h, msg);
+ }
}
void