summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/control.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/relayd/control.c')
-rw-r--r--usr.sbin/relayd/control.c80
1 files changed, 42 insertions, 38 deletions
diff --git a/usr.sbin/relayd/control.c b/usr.sbin/relayd/control.c
index 33124defa88..ba6963eebf7 100644
--- a/usr.sbin/relayd/control.c
+++ b/usr.sbin/relayd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.30 2009/06/05 00:04:01 pyr Exp $ */
+/* $OpenBSD: control.c,v 1.31 2009/06/05 00:20:50 pyr Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -237,13 +237,13 @@ control_dispatch_imsg(int fd, short event, void *arg)
fatalx("invalid imsg header len");
memcpy(&id, imsg.data, sizeof(id));
if (disable_rdr(c, &id))
- imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1,
- NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL,
+ 0, 0, -1, NULL, 0);
else {
memcpy(imsg.data, &id, sizeof(id));
control_imsg_forward(&imsg);
- imsg_compose_event(&c->ibuf, IMSG_CTL_OK, 0, 0, -1,
- NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_OK,
+ 0, 0, -1, NULL, 0);
}
break;
case IMSG_CTL_RDR_ENABLE:
@@ -251,13 +251,13 @@ control_dispatch_imsg(int fd, short event, void *arg)
fatalx("invalid imsg header len");
memcpy(&id, imsg.data, sizeof(id));
if (enable_rdr(c, &id))
- imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1,
- NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL,
+ 0, 0, -1, NULL, 0);
else {
memcpy(imsg.data, &id, sizeof(id));
control_imsg_forward(&imsg);
- imsg_compose_event(&c->ibuf, IMSG_CTL_OK, 0, 0, -1,
- NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_OK,
+ 0, 0, -1, NULL, 0);
}
break;
case IMSG_CTL_TABLE_DISABLE:
@@ -265,13 +265,13 @@ control_dispatch_imsg(int fd, short event, void *arg)
fatalx("invalid imsg header len");
memcpy(&id, imsg.data, sizeof(id));
if (disable_table(c, &id))
- imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1,
- NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL,
+ 0, 0, -1, NULL, 0);
else {
memcpy(imsg.data, &id, sizeof(id));
control_imsg_forward(&imsg);
- imsg_compose_event(&c->ibuf, IMSG_CTL_OK, 0, 0, -1,
- NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_OK,
+ 0, 0, -1, NULL, 0);
}
break;
case IMSG_CTL_TABLE_ENABLE:
@@ -279,13 +279,13 @@ control_dispatch_imsg(int fd, short event, void *arg)
fatalx("invalid imsg header len");
memcpy(&id, imsg.data, sizeof(id));
if (enable_table(c, &id))
- imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1,
- NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL,
+ 0, 0, -1, NULL, 0);
else {
memcpy(imsg.data, &id, sizeof(id));
control_imsg_forward(&imsg);
- imsg_compose_event(&c->ibuf, IMSG_CTL_OK, 0, 0, -1,
- NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_OK,
+ 0, 0, -1, NULL, 0);
}
break;
case IMSG_CTL_HOST_DISABLE:
@@ -293,13 +293,13 @@ control_dispatch_imsg(int fd, short event, void *arg)
fatalx("invalid imsg header len");
memcpy(&id, imsg.data, sizeof(id));
if (disable_host(c, &id, NULL))
- imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1,
- NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL,
+ 0, 0, -1, NULL, 0);
else {
memcpy(imsg.data, &id, sizeof(id));
control_imsg_forward(&imsg);
- imsg_compose_event(&c->ibuf, IMSG_CTL_OK, 0, 0, -1,
- NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_OK,
+ 0, 0, -1, NULL, 0);
}
break;
case IMSG_CTL_HOST_ENABLE:
@@ -307,31 +307,33 @@ control_dispatch_imsg(int fd, short event, void *arg)
fatalx("invalid imsg header len");
memcpy(&id, imsg.data, sizeof(id));
if (enable_host(c, &id, NULL))
- imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1,
- NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL,
+ 0, 0, -1, NULL, 0);
else {
memcpy(imsg.data, &id, sizeof(id));
control_imsg_forward(&imsg);
- imsg_compose_event(&c->ibuf, IMSG_CTL_OK, 0, 0, -1,
- NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_OK,
+ 0, 0, -1, NULL, 0);
}
break;
case IMSG_CTL_SHUTDOWN:
- imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1, NULL,
- 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL,
+ 0, 0, -1, NULL, 0);
break;
case IMSG_CTL_POLL:
- imsg_compose_event(ibuf_hce, IMSG_CTL_POLL, 0, 0,-1, NULL, 0);
- imsg_compose_event(&c->ibuf, IMSG_CTL_OK, 0, 0, -1, NULL, 0);
+ imsg_compose_event(ibuf_hce, IMSG_CTL_POLL,
+ 0, 0,-1, NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_OK,
+ 0, 0, -1, NULL, 0);
break;
case IMSG_CTL_RELOAD:
if (env->sc_prefork_relay > 0) {
- imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1,
- NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL,
+ 0, 0, -1, NULL, 0);
break;
}
- imsg_compose_event(ibuf_main, IMSG_CTL_RELOAD, 0, 0, -1, NULL,
- 0);
+ imsg_compose_event(ibuf_main, IMSG_CTL_RELOAD,
+ 0, 0, -1, NULL, 0);
/*
* we unconditionnaly return a CTL_OK imsg because
* we have no choice.
@@ -340,14 +342,15 @@ control_dispatch_imsg(int fd, short event, void *arg)
* that the reload command has been set,
* it doesn't say wether the command succeeded or not.
*/
- imsg_compose_event(&c->ibuf, IMSG_CTL_OK, 0, 0, -1, NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_OK,
+ 0, 0, -1, NULL, 0);
break;
case IMSG_CTL_NOTIFY:
if (c->flags & CTL_CONN_NOTIFY) {
log_debug("control_dispatch_imsg: "
"client requested notify more than once");
- imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL, 0, 0, -1,
- NULL, 0);
+ imsg_compose_event(&c->ibuf, IMSG_CTL_FAIL,
+ 0, 0, -1, NULL, 0);
break;
}
c->flags |= CTL_CONN_NOTIFY;
@@ -370,8 +373,9 @@ control_imsg_forward(struct imsg *imsg)
TAILQ_FOREACH(c, &ctl_conns, entry)
if (c->flags & CTL_CONN_NOTIFY)
- imsg_compose_event(&c->ibuf, imsg->hdr.type, 0, imsg->hdr.pid,
- -1, imsg->data, imsg->hdr.len - IMSG_HEADER_SIZE);
+ imsg_compose_event(&c->ibuf, imsg->hdr.type,
+ 0, imsg->hdr.pid, -1, imsg->data,
+ imsg->hdr.len - IMSG_HEADER_SIZE);
}
void