summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-11-14 15:25:27 +0000
committerPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-11-14 15:25:27 +0000
commit2341a970dfd1f1edadd62ce65edab2e6ea2e5d41 (patch)
treeba3d9fba19b58b2d83af3b1cf3f6df7c02a3e233
parent0c005549eced2cdcc5759a4de35ac048d70ea1e4 (diff)
do go through relays when none exist.
-rw-r--r--usr.sbin/hoststated/pfe.c9
-rw-r--r--usr.sbin/relayd/pfe.c9
2 files changed, 14 insertions, 4 deletions
diff --git a/usr.sbin/hoststated/pfe.c b/usr.sbin/hoststated/pfe.c
index 4eb3b094940..522607d9971 100644
--- a/usr.sbin/hoststated/pfe.c
+++ b/usr.sbin/hoststated/pfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfe.c,v 1.39 2007/10/30 21:04:45 reyk Exp $ */
+/* $OpenBSD: pfe.c,v 1.40 2007/11/14 15:25:26 pyr Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -509,6 +509,8 @@ show(struct ctl_conn *c)
struct host *host;
struct relay *rlay;
+ if (env->services == NULL)
+ goto relays;
TAILQ_FOREACH(service, env->services, entry) {
imsg_compose(&c->ibuf, IMSG_CTL_SERVICE, 0, 0, -1,
service, sizeof(*service));
@@ -531,6 +533,9 @@ show(struct ctl_conn *c)
imsg_compose(&c->ibuf, IMSG_CTL_HOST, 0, 0, -1,
host, sizeof(*host));
}
+relays:
+ if (env->relays == NULL)
+ goto end;
TAILQ_FOREACH(rlay, env->relays, entry) {
rlay->stats[env->prefork_relay].id = EMPTY_ID;
imsg_compose(&c->ibuf, IMSG_CTL_RELAY, 0, 0, -1,
@@ -547,7 +552,7 @@ show(struct ctl_conn *c)
imsg_compose(&c->ibuf, IMSG_CTL_HOST, 0, 0, -1,
host, sizeof(*host));
}
-
+end:
imsg_compose(&c->ibuf, IMSG_CTL_END, 0, 0, -1, NULL, 0);
}
diff --git a/usr.sbin/relayd/pfe.c b/usr.sbin/relayd/pfe.c
index 4eb3b094940..522607d9971 100644
--- a/usr.sbin/relayd/pfe.c
+++ b/usr.sbin/relayd/pfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfe.c,v 1.39 2007/10/30 21:04:45 reyk Exp $ */
+/* $OpenBSD: pfe.c,v 1.40 2007/11/14 15:25:26 pyr Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -509,6 +509,8 @@ show(struct ctl_conn *c)
struct host *host;
struct relay *rlay;
+ if (env->services == NULL)
+ goto relays;
TAILQ_FOREACH(service, env->services, entry) {
imsg_compose(&c->ibuf, IMSG_CTL_SERVICE, 0, 0, -1,
service, sizeof(*service));
@@ -531,6 +533,9 @@ show(struct ctl_conn *c)
imsg_compose(&c->ibuf, IMSG_CTL_HOST, 0, 0, -1,
host, sizeof(*host));
}
+relays:
+ if (env->relays == NULL)
+ goto end;
TAILQ_FOREACH(rlay, env->relays, entry) {
rlay->stats[env->prefork_relay].id = EMPTY_ID;
imsg_compose(&c->ibuf, IMSG_CTL_RELAY, 0, 0, -1,
@@ -547,7 +552,7 @@ show(struct ctl_conn *c)
imsg_compose(&c->ibuf, IMSG_CTL_HOST, 0, 0, -1,
host, sizeof(*host));
}
-
+end:
imsg_compose(&c->ibuf, IMSG_CTL_END, 0, 0, -1, NULL, 0);
}