summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2007-02-22 05:58:07 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2007-02-22 05:58:07 +0000
commitbcefe5c2e682e793f76d803b02bb23b885b658c9 (patch)
tree5a062d7d8ba6e6d618a2a29fc4ebbbed35c9cada /usr.sbin/relayd
parent9e07dc64a7f609b15dbf537d3f984b72641c918e (diff)
spacing
Diffstat (limited to 'usr.sbin/relayd')
-rw-r--r--usr.sbin/relayd/carp.c6
-rw-r--r--usr.sbin/relayd/check_tcp.c8
-rw-r--r--usr.sbin/relayd/pfe.c13
-rw-r--r--usr.sbin/relayd/pfe_filter.c15
-rw-r--r--usr.sbin/relayd/relayd.c18
-rw-r--r--usr.sbin/relayd/relayd.h22
-rw-r--r--usr.sbin/relayd/ssl.c14
7 files changed, 52 insertions, 44 deletions
diff --git a/usr.sbin/relayd/carp.c b/usr.sbin/relayd/carp.c
index 64c1091d1ab..cb97cbf32e3 100644
--- a/usr.sbin/relayd/carp.c
+++ b/usr.sbin/relayd/carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: carp.c,v 1.1 2007/02/22 03:32:39 reyk Exp $ */
+/* $OpenBSD: carp.c,v 1.2 2007/02/22 05:58:06 reyk Exp $ */
/*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@@ -73,7 +73,7 @@ carp_demote_init(char *group, int force)
free(c);
return (-1);
}
-
+
/* only demote if this group already is demoted */
if ((level = carp_demote_get(group)) == -1)
return (-1);
@@ -204,6 +204,6 @@ carp_demote_ioctl(char *group, int demote)
log_info("%s the demote state of group '%s'",
(demote > 0) ? "incremented" : "decremented", group);
- close (s);
+ close(s);
return (res);
}
diff --git a/usr.sbin/relayd/check_tcp.c b/usr.sbin/relayd/check_tcp.c
index 905b0becbfd..82bb01f7186 100644
--- a/usr.sbin/relayd/check_tcp.c
+++ b/usr.sbin/relayd/check_tcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check_tcp.c,v 1.22 2007/02/08 13:32:24 reyk Exp $ */
+/* $OpenBSD: check_tcp.c,v 1.23 2007/02/22 05:58:06 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -176,8 +176,8 @@ void
tcp_send_req(int s, short event, void *arg)
{
struct ctl_tcp_event *cte = arg;
- int bs;
- int len;
+ int bs;
+ int len;
if (event == EV_TIMEOUT) {
cte->host->up = HOST_DOWN;
@@ -217,7 +217,7 @@ tcp_read_buf(int s, short event, void *arg)
char rbuf[SMALL_READ_BUF_SIZE];
struct ctl_tcp_event *cte = arg;
- if (event == EV_TIMEOUT) {
+ if (event == EV_TIMEOUT) {
cte->host->up = HOST_DOWN;
buf_free(cte->buf);
hce_notify_done(cte->host, "tcp_read_buf: timeout");
diff --git a/usr.sbin/relayd/pfe.c b/usr.sbin/relayd/pfe.c
index c6f0bbb7133..eb9fc4939f6 100644
--- a/usr.sbin/relayd/pfe.c
+++ b/usr.sbin/relayd/pfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfe.c,v 1.15 2007/02/22 03:32:39 reyk Exp $ */
+/* $OpenBSD: pfe.c,v 1.16 2007/02/22 05:58:06 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -233,8 +233,8 @@ pfe_dispatch_imsg(int fd, short event, void *ptr)
/* Forward to relay engine(s) */
for (n = 0; n < env->prefork_relay; n++)
- imsg_compose(&ibuf_relay[n], IMSG_HOST_STATUS, 0, 0,
- &st, sizeof(st));
+ imsg_compose(&ibuf_relay[n],
+ IMSG_HOST_STATUS, 0, 0, &st, sizeof(st));
if ((table = table_find(env, host->tableid)) == NULL)
fatalx("pfe_dispatch_imsg: invalid table id");
@@ -363,7 +363,8 @@ pfe_dispatch_relay(int fd, short event, void * ptr)
fatalx("invalid imsg header len");
bcopy(imsg.data, &crs, sizeof(crs));
if (crs.proc > env->prefork_relay)
- fatalx("pfe_dispatch_relay: invalid relay proc");
+ fatalx("pfe_dispatch_relay: "
+ "invalid relay proc");
if ((rlay = relay_find(env, crs.id)) == NULL)
fatalx("pfe_dispatch_relay: invalid relay id");
bcopy(&crs, &rlay->stats[crs.proc], sizeof(crs));
@@ -616,8 +617,8 @@ pfe_sync(void)
struct service *service;
struct table *active;
struct table *table;
- struct ctl_id id;
- struct imsg imsg;
+ struct ctl_id id;
+ struct imsg imsg;
struct ctl_demote demote;
bzero(&id, sizeof(id));
diff --git a/usr.sbin/relayd/pfe_filter.c b/usr.sbin/relayd/pfe_filter.c
index 27442c34006..2688089c1fb 100644
--- a/usr.sbin/relayd/pfe_filter.c
+++ b/usr.sbin/relayd/pfe_filter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfe_filter.c,v 1.14 2007/02/22 03:32:40 reyk Exp $ */
+/* $OpenBSD: pfe_filter.c,v 1.15 2007/02/22 05:58:06 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -238,7 +238,7 @@ flush_table(struct hoststated *env, struct service *service)
goto toolong;
if (strlcpy(io.pfrio_table.pfrt_name, service->name,
sizeof(io.pfrio_table.pfrt_name)) >=
- sizeof(io.pfrio_table.pfrt_name))
+ sizeof(io.pfrio_table.pfrt_name))
goto toolong;
if (ioctl(env->pf->dev, DIOCRCLRADDRS, &io) == -1)
fatal("flush_table: cannot flush table");
@@ -347,7 +347,8 @@ sync_ruleset(struct hoststated *env, struct service *service, int enable)
pio.addr.addr.type = PF_ADDR_TABLE;
if (strlcpy(pio.addr.addr.v.tblname, service->name,
- sizeof(pio.addr.addr.v.tblname)) >= sizeof(pio.addr.addr.v.tblname))
+ sizeof(pio.addr.addr.v.tblname)) >=
+ sizeof(pio.addr.addr.v.tblname))
fatal("sync_ruleset: table name too long");
if (ioctl(env->pf->dev, DIOCADDADDR, &pio) == -1)
fatal("sync_ruleset: cannot add address to pool");
@@ -397,7 +398,7 @@ flush_rulesets(struct hoststated *env)
log_warn("flush_rulesets: transaction for %s failed",
HOSTSTATED_ANCHOR);
log_debug("flush_rulesets: flushed rules");
- return;
+ return;
toolong:
fatal("flush_rulesets: name too long");
@@ -463,8 +464,10 @@ natlook(struct hoststated *env, struct ctl_natlook *cnl)
case AF_INET6:
in6 = (struct sockaddr_in6 *)&cnl->rsrc;
out6 = (struct sockaddr_in6 *)&cnl->rdst;
- bcopy(&pnl.rsaddr.addr8, &in6->sin6_addr, sizeof(in6->sin6_addr));
- bcopy(&pnl.rdaddr.addr8, &out6->sin6_addr, sizeof(out6->sin6_addr));
+ bcopy(&pnl.rsaddr.addr8, &in6->sin6_addr,
+ sizeof(in6->sin6_addr));
+ bcopy(&pnl.rdaddr.addr8, &out6->sin6_addr,
+ sizeof(out6->sin6_addr));
break;
}
cnl->rsrc.ss_family = pnl.af;
diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c
index 093b35fb849..ff4690a825f 100644
--- a/usr.sbin/relayd/relayd.c
+++ b/usr.sbin/relayd/relayd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.c,v 1.17 2007/02/22 03:32:39 reyk Exp $ */
+/* $OpenBSD: relayd.c,v 1.18 2007/02/22 05:58:06 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -64,7 +64,7 @@ void
main_sig_handler(int sig, short event, void *arg)
{
struct hoststated *env = arg;
- int die = 0;
+ int die = 0;
log_debug("signal %d", sig);
@@ -173,13 +173,17 @@ main(int argc, char *argv[])
log_info("startup");
- if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pipe_parent2pfe) == -1)
+ if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC,
+ pipe_parent2pfe) == -1)
fatal("socketpair");
- if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pipe_parent2hce) == -1)
+ if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC,
+ pipe_parent2hce) == -1)
fatal("socketpair");
- if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pipe_parent2relay) == -1)
+ if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC,
+ pipe_parent2relay) == -1)
fatal("socketpair");
- if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pipe_pfe2hce) == -1)
+ if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC,
+ pipe_pfe2hce) == -1)
fatal("socketpair");
for (c = 0; c < env.prefork_relay; c++) {
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC,
@@ -589,7 +593,7 @@ expand_string(char *label, size_t len, const char *srch, const char *repl)
return (-1);
}
p = q = label;
- while ((q = strstr(p, srch)) != NULL) {
+ while ((q = strstr(p, srch)) != NULL) {
*q = '\0';
if ((strlcat(tmp, p, len) >= len) ||
(strlcat(tmp, repl, len) >= len)) {
diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h
index 1008882e8ab..5d2a2f9eacc 100644
--- a/usr.sbin/relayd/relayd.h
+++ b/usr.sbin/relayd/relayd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.h,v 1.25 2007/02/22 03:32:39 reyk Exp $ */
+/* $OpenBSD: relayd.h,v 1.26 2007/02/22 05:58:06 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -160,13 +160,13 @@ struct ctl_icmp_event {
};
struct ctl_tcp_event {
- int s;
+ int s;
char *req;
struct buf *buf;
struct host *host;
struct table *table;
- struct timeval tv_start;
- struct event ev;
+ struct timeval tv_start;
+ struct event ev;
int (*validate_read)(struct ctl_tcp_event *);
int (*validate_close)(struct ctl_tcp_event *);
SSL *ssl;
@@ -198,7 +198,7 @@ struct ctl_relay_event {
int marked;
int line;
size_t toread;
- enum httpmethod method;
+ enum httpmethod method;
u_int8_t *buf;
int buflen;
@@ -328,18 +328,18 @@ struct service {
TAILQ_HEAD(servicelist, service);
struct session {
- objid_t id;
- struct ctl_relay_event in;
- struct ctl_relay_event out;
+ objid_t id;
+ struct ctl_relay_event in;
+ struct ctl_relay_event out;
u_int32_t outkey;
struct event ev;
- struct timeval timeout;
+ struct timeval timeout;
struct timeval tv_start;
struct timeval tv_last;
- int done;
+ int done;
void *relay;
struct ctl_natlook *cnl;
- TAILQ_ENTRY(session) entry;
+ TAILQ_ENTRY(session) entry;
};
TAILQ_HEAD(sessionlist, session);
diff --git a/usr.sbin/relayd/ssl.c b/usr.sbin/relayd/ssl.c
index cf5016d69e7..c42e4b3e999 100644
--- a/usr.sbin/relayd/ssl.c
+++ b/usr.sbin/relayd/ssl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl.c,v 1.7 2007/02/22 03:32:40 reyk Exp $ */
+/* $OpenBSD: ssl.c,v 1.8 2007/02/22 05:58:06 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -94,7 +94,7 @@ ssl_read(int s, short event, void *arg)
break;
}
return;
- }
+ }
if (buf_add(cte->buf, rbuf, ret) == -1)
fatal("ssl_read: buf_add error");
if (cte->validate_read != NULL) {
@@ -120,7 +120,7 @@ ssl_write(int s, short event, void *arg)
{
struct ctl_tcp_event *cte = arg;
int len;
- int ret;
+ int ret;
int ssl_err;
int retry_flag;
@@ -134,7 +134,7 @@ ssl_write(int s, short event, void *arg)
len = strlen(cte->table->sendbuf);
retry_flag = EV_WRITE;
- ret = SSL_write(cte->ssl, cte->table->sendbuf, len);
+ ret = SSL_write(cte->ssl, cte->table->sendbuf, len);
if (ret <= 0) {
ssl_err = SSL_get_error(cte->ssl, ret);
switch (ssl_err) {
@@ -167,7 +167,7 @@ void
ssl_connect(int s, short event, void *arg)
{
struct ctl_tcp_event *cte = arg;
- int ret;
+ int ret;
int ssl_err;
int retry_flag;
@@ -179,7 +179,7 @@ ssl_connect(int s, short event, void *arg)
retry_flag = ssl_err = 0;
- ret = SSL_connect(cte->ssl);
+ ret = SSL_connect(cte->ssl);
if (ret <= 0) {
ssl_err = SSL_get_error(cte->ssl, ret);
switch (ssl_err) {
@@ -268,7 +268,7 @@ ssl_transaction(struct ctl_tcp_event *cte)
if (SSL_set_fd(cte->ssl, cte->s) == 0) {
cte->host->up = HOST_UNKNOWN;
- ssl_error(cte->host->name, "cannot set fd");
+ ssl_error(cte->host->name, "cannot set fd");
ssl_cleanup(cte);
hce_notify_done(cte->host,
"ssl_transaction: cannot set SSL fd");