diff options
author | giovanni <giovanni@cvs.openbsd.org> | 2012-05-09 12:54:14 +0000 |
---|---|---|
committer | giovanni <giovanni@cvs.openbsd.org> | 2012-05-09 12:54:14 +0000 |
commit | df199b2d76b5974f799c00e0408a3b3e3032f454 (patch) | |
tree | 81fe2f63d4cedafe2c3383cea2b1b04ab14efe70 | |
parent | 4cd6b1856b89c7e18377a7c4a879177310193a3e (diff) |
Fix a desynchronization on host change during a running check
closes pr system/6627
diff submitted by Martin Matuska, thanks
ok benno@
-rw-r--r-- | usr.sbin/relayd/hce.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/usr.sbin/relayd/hce.c b/usr.sbin/relayd/hce.c index ead5530a053..3d5551f4890 100644 --- a/usr.sbin/relayd/hce.c +++ b/usr.sbin/relayd/hce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hce.c,v 1.62 2012/01/21 13:40:48 camield Exp $ */ +/* $OpenBSD: hce.c,v 1.63 2012/05/09 12:54:13 giovanni Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -207,10 +207,27 @@ hce_notify_done(struct host *host, enum host_error he) struct timeval tv_now, tv_dur; u_long duration; u_int logopt; - struct host *h; + struct host *h, *hostnst; int hostup; const char *msg; + if ((hostnst = host_find(env, host->conf.id)) == NULL) + fatalx("hce_notify_done: desynchronized"); + + if ((table = table_find(env, host->conf.tableid)) == NULL) + fatalx("hce_notify_done: invalid table id"); + + if (hostnst->flags & F_DISABLE) { + if (env->sc_opts & RELAYD_OPT_LOGUPDATE) { + log_info("host %s, check %s%s (ignoring result, " + "host disabled)", + host->conf.name, table_check(table->conf.check), + (table->conf.flags & F_SSL) ? " use ssl" : ""); + } + host->flags |= (F_CHECK_SENT|F_CHECK_DONE); + return; + } + hostup = host->up; host->he = he; @@ -251,9 +268,6 @@ hce_notify_done(struct host *host, enum host_error he) else duration = 0; - if ((table = table_find(env, host->conf.tableid)) == NULL) - fatalx("hce_notify_done: invalid table id"); - if (env->sc_opts & logopt) { log_info("host %s, check %s%s (%lums), state %s -> %s, " "availability %s", |