diff options
author | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2007-10-19 12:08:56 +0000 |
---|---|---|
committer | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2007-10-19 12:08:56 +0000 |
commit | 1919128b52ab85cdce80c42468da3dd2c2e24cc8 (patch) | |
tree | 5017385397d80aa13d325e26392cbc6715f386e8 /usr.sbin/hoststated | |
parent | 606ce456a609f715d65446676b7212d3d4a28715 (diff) |
Add the ability to schedule an immediate check through hoststatectl.
Especially useful when interval is rather long.
I was supposed to commit this before 4.2.
Diffstat (limited to 'usr.sbin/hoststated')
-rw-r--r-- | usr.sbin/hoststated/control.c | 13 | ||||
-rw-r--r-- | usr.sbin/hoststated/hce.c | 6 | ||||
-rw-r--r-- | usr.sbin/hoststated/hoststated.h | 5 | ||||
-rw-r--r-- | usr.sbin/hoststated/pfe.c | 4 |
4 files changed, 20 insertions, 8 deletions
diff --git a/usr.sbin/hoststated/control.c b/usr.sbin/hoststated/control.c index 08094fe9547..5ea9d46fb02 100644 --- a/usr.sbin/hoststated/control.c +++ b/usr.sbin/hoststated/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.18 2007/09/07 08:20:24 reyk Exp $ */ +/* $OpenBSD: control.c,v 1.19 2007/10/19 12:08:55 pyr Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -43,6 +43,7 @@ struct ctl_conn *control_connbyfd(int); void control_close(int); struct imsgbuf *ibuf_main = NULL; +struct imsgbuf *ibuf_hce = NULL; int control_init(void) @@ -94,10 +95,12 @@ control_init(void) } int -control_listen(struct hoststated *env, struct imsgbuf *ibuf) +control_listen(struct hoststated *env, struct imsgbuf *i_main, + struct imsgbuf *i_hce) { - ibuf_main = ibuf; + ibuf_main = i_main; + ibuf_hce = i_hce; if (listen(control_state.fd, CONTROL_BACKLOG) == -1) { log_warn("control_listen: listen"); @@ -316,6 +319,10 @@ control_dispatch_imsg(int fd, short event, void *arg) imsg_compose(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1, NULL, 0); break; + case IMSG_CTL_POLL: + imsg_compose(ibuf_hce, IMSG_CTL_POLL, 0, 0,-1, NULL, 0); + imsg_compose(&c->ibuf, IMSG_CTL_OK, 0, 0, -1, NULL, 0); + break; case IMSG_CTL_RELOAD: if (env->prefork_relay > 0) { imsg_compose(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1, diff --git a/usr.sbin/hoststated/hce.c b/usr.sbin/hoststated/hce.c index 2c01db611bf..62a34e8b6e4 100644 --- a/usr.sbin/hoststated/hce.c +++ b/usr.sbin/hoststated/hce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hce.c,v 1.31 2007/10/12 12:50:59 blambert Exp $ */ +/* $OpenBSD: hce.c,v 1.32 2007/10/19 12:08:55 pyr Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -395,6 +395,10 @@ hce_dispatch_imsg(int fd, short event, void *ptr) TAILQ_FOREACH(host, &table->hosts, entry) host->up = HOST_UNKNOWN; break; + case IMSG_CTL_POLL: + evtimer_del(&env->ev); + hce_launch_checks(-1, EV_TIMEOUT, env); + break; default: log_debug("hce_dispatch_msg: unexpected imsg %d", imsg.hdr.type); diff --git a/usr.sbin/hoststated/hoststated.h b/usr.sbin/hoststated/hoststated.h index f6c77880298..cc20e904474 100644 --- a/usr.sbin/hoststated/hoststated.h +++ b/usr.sbin/hoststated/hoststated.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hoststated.h,v 1.68 2007/10/12 12:50:59 blambert Exp $ */ +/* $OpenBSD: hoststated.h,v 1.69 2007/10/19 12:08:55 pyr Exp $ */ /* * Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -118,6 +118,7 @@ enum imsg_type { IMSG_CTL_HOST_DISABLE, IMSG_CTL_SHUTDOWN, IMSG_CTL_RELOAD, + IMSG_CTL_POLL, IMSG_CTL_NOTIFY, IMSG_CTL_STATISTICS, IMSG_SERVICE_ENABLE, /* notifies from pfe to hce */ @@ -628,7 +629,7 @@ TAILQ_HEAD(ctl_connlist, ctl_conn); /* control.c */ int control_init(void); -int control_listen(struct hoststated *, struct imsgbuf *); +int control_listen(struct hoststated *, struct imsgbuf *, struct imsgbuf *); void control_accept(int, short, void *); void control_dispatch_imsg(int, short, void *); void control_imsg_forward(struct imsg *); diff --git a/usr.sbin/hoststated/pfe.c b/usr.sbin/hoststated/pfe.c index 6b27a81df4f..29451e4cdfe 100644 --- a/usr.sbin/hoststated/pfe.c +++ b/usr.sbin/hoststated/pfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfe.c,v 1.36 2007/09/28 13:29:56 pyr Exp $ */ +/* $OpenBSD: pfe.c,v 1.37 2007/10/19 12:08:55 pyr Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -156,7 +156,7 @@ pfe(struct hoststated *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2], TAILQ_INIT(&ctl_conns); - if (control_listen(env, ibuf_main) == -1) + if (control_listen(env, ibuf_main, ibuf_hce) == -1) fatalx("pfe: control socket listen failed"); /* Initial sync */ |