summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2007-12-07 17:17:02 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2007-12-07 17:17:02 +0000
commitd75f94d842d2ecbea5f31fb27532593b5021098d (patch)
tree093dc9b59b19f2b44a28f93174f16cf495744d98
parent91575290236879ecd46b2dc81b12488680ed3e22 (diff)
hoststated gets renamed to relayd. easier to type, and actually says
what the daemon does - it is a relayer that pays attention to the status of pools of hosts; not a status checkers that happens to do some relaying
-rw-r--r--etc/relayd.conf6
-rw-r--r--usr.sbin/relayctl/Makefile12
-rw-r--r--usr.sbin/relayctl/parser.c4
-rw-r--r--usr.sbin/relayctl/relayctl.818
-rw-r--r--usr.sbin/relayctl/relayctl.c12
-rw-r--r--usr.sbin/relayd/Makefile8
-rw-r--r--usr.sbin/relayd/buffer.c4
-rw-r--r--usr.sbin/relayd/carp.c4
-rw-r--r--usr.sbin/relayd/check_icmp.c14
-rw-r--r--usr.sbin/relayd/check_script.c10
-rw-r--r--usr.sbin/relayd/check_tcp.c4
-rw-r--r--usr.sbin/relayd/control.c28
-rw-r--r--usr.sbin/relayd/hce.c20
-rw-r--r--usr.sbin/relayd/imsg.c4
-rw-r--r--usr.sbin/relayd/log.c4
-rw-r--r--usr.sbin/relayd/name2id.c4
-rw-r--r--usr.sbin/relayd/parse.y14
-rw-r--r--usr.sbin/relayd/pfe.c16
-rw-r--r--usr.sbin/relayd/pfe_filter.c48
-rw-r--r--usr.sbin/relayd/relay.c18
-rw-r--r--usr.sbin/relayd/relay_udp.c8
-rw-r--r--usr.sbin/relayd/relayd.c62
-rw-r--r--usr.sbin/relayd/relayd.h98
-rw-r--r--usr.sbin/relayd/ssl.c8
24 files changed, 214 insertions, 214 deletions
diff --git a/etc/relayd.conf b/etc/relayd.conf
index f6f1c57d79c..c70e08d4275 100644
--- a/etc/relayd.conf
+++ b/etc/relayd.conf
@@ -1,4 +1,4 @@
-# $OpenBSD: relayd.conf,v 1.9 2007/11/28 15:16:18 reyk Exp $
+# $OpenBSD: relayd.conf,v 1.10 2007/12/07 17:17:00 reyk Exp $
#
# Macros
#
@@ -36,8 +36,8 @@ table fallback {
service www {
virtual host $ext_addr port http interface trunk0
- # tag every packet that goes thru the rdr rule with HOSTSTATED
- tag HOSTSTATED
+ # tag every packet that goes thru the rdr rule with RELAYD
+ tag RELAYD
table webhosts
backup table fallback
diff --git a/usr.sbin/relayctl/Makefile b/usr.sbin/relayctl/Makefile
index f2260e3e920..98ae5514b65 100644
--- a/usr.sbin/relayctl/Makefile
+++ b/usr.sbin/relayctl/Makefile
@@ -1,13 +1,13 @@
-# $OpenBSD: Makefile,v 1.2 2007/01/09 00:45:32 deraadt Exp $
+# $OpenBSD: Makefile,v 1.3 2007/12/07 17:17:01 reyk Exp $
-.PATH: ${.CURDIR}/../hoststated
+.PATH: ${.CURDIR}/../relayd
-PROG= hoststatectl
-SRCS= buffer.c imsg.c log.c hoststatectl.c parser.c
+PROG= relayctl
+SRCS= buffer.c imsg.c log.c relayctl.c parser.c
-MAN= hoststatectl.8
+MAN= relayctl.8
-CFLAGS+= -Wall -Werror -I${.CURDIR} -I${.CURDIR}/../hoststated
+CFLAGS+= -Wall -Werror -I${.CURDIR} -I${.CURDIR}/../relayd
CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes
CFLAGS+= -Wmissing-declarations
CFLAGS+= -Wshadow -Wpointer-arith -Wcast-qual
diff --git a/usr.sbin/relayctl/parser.c b/usr.sbin/relayctl/parser.c
index ec70d997eb8..26906333924 100644
--- a/usr.sbin/relayctl/parser.c
+++ b/usr.sbin/relayctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.16 2007/11/24 17:09:12 reyk Exp $ */
+/* $OpenBSD: parser.c,v 1.17 2007/12/07 17:17:01 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -36,7 +36,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
#include "parser.h"
diff --git a/usr.sbin/relayctl/relayctl.8 b/usr.sbin/relayctl/relayctl.8
index d0100a02257..888e586f5eb 100644
--- a/usr.sbin/relayctl/relayctl.8
+++ b/usr.sbin/relayctl/relayctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: relayctl.8,v 1.14 2007/11/21 09:55:21 pyr Exp $
+.\" $OpenBSD: relayctl.8,v 1.15 2007/12/07 17:17:01 reyk Exp $
.\"
.\" Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
.\"
@@ -14,11 +14,11 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: November 21 2007 $
-.Dt HOSTSTATECTL 8
+.Dd $Mdocdate: December 7 2007 $
+.Dt RELAYCTL 8
.Os
.Sh NAME
-.Nm hoststatectl
+.Nm relayctl
.Nd control the Host Status daemon
.Sh SYNOPSIS
.Nm
@@ -28,7 +28,7 @@
The
.Nm
program controls the
-.Xr hoststated 8
+.Xr relayd 8
daemon.
.Pp
The following commands are available:
@@ -80,13 +80,13 @@ Start doing checks for all hosts that aren't individually disabled
again.
.El
.Sh FILES
-.Bl -tag -width "/var/run/hoststated.sockXX" -compact
-.It /var/run/hoststated.sock
+.Bl -tag -width "/var/run/relayd.sockXX" -compact
+.It /var/run/relayd.sock
Unix-domain socket used for communication with
-.Xr hoststated 8 .
+.Xr relayd 8 .
.El
.Sh SEE ALSO
-.Xr hoststated 8
+.Xr relayd 8
.Sh HISTORY
The
.Nm
diff --git a/usr.sbin/relayctl/relayctl.c b/usr.sbin/relayctl/relayctl.c
index 8236229a9ef..7b1fc0ccff8 100644
--- a/usr.sbin/relayctl/relayctl.c
+++ b/usr.sbin/relayctl/relayctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayctl.c,v 1.27 2007/11/24 17:09:12 reyk Exp $ */
+/* $OpenBSD: relayctl.c,v 1.28 2007/12/07 17:17:01 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -40,7 +40,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
#include "parser.h"
__dead void usage(void);
@@ -92,7 +92,7 @@ usage(void)
exit(1);
}
-/* dummy function so that hoststatectl does not need libevent */
+/* dummy function so that relayctl does not need libevent */
void
imsg_event_add(struct imsgbuf *i)
{
@@ -113,13 +113,13 @@ main(int argc, char *argv[])
if ((res = parse(argc - 1, argv + 1)) == NULL)
exit(1);
- /* connect to hoststated control socket */
+ /* connect to relayd control socket */
if ((ctl_sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
err(1, "socket");
bzero(&sun, sizeof(sun));
sun.sun_family = AF_UNIX;
- strlcpy(sun.sun_path, HOSTSTATED_SOCKET, sizeof(sun.sun_path));
+ strlcpy(sun.sun_path, RELAYD_SOCKET, sizeof(sun.sun_path));
reconnect:
if (connect(ctl_sock, (struct sockaddr *)&sun, sizeof(sun)) == -1) {
/* Keep retrying if running in monitor mode */
@@ -128,7 +128,7 @@ main(int argc, char *argv[])
usleep(100);
goto reconnect;
}
- err(1, "connect: %s", HOSTSTATED_SOCKET);
+ err(1, "connect: %s", RELAYD_SOCKET);
}
if ((ibuf = malloc(sizeof(struct imsgbuf))) == NULL)
diff --git a/usr.sbin/relayd/Makefile b/usr.sbin/relayd/Makefile
index 4c2d3010aaf..8e8b9279827 100644
--- a/usr.sbin/relayd/Makefile
+++ b/usr.sbin/relayd/Makefile
@@ -1,10 +1,10 @@
-# $OpenBSD: Makefile,v 1.15 2007/11/26 09:38:25 reyk Exp $
+# $OpenBSD: Makefile,v 1.16 2007/12/07 17:17:00 reyk Exp $
-PROG= hoststated
+PROG= relayd
SRCS= parse.y log.c control.c buffer.c imsg.c ssl.c ssl_privsep.c \
- hoststated.c pfe.c pfe_filter.c hce.c relay.c relay_udp.c \
+ relayd.c pfe.c pfe_filter.c hce.c relay.c relay_udp.c \
carp.c check_icmp.c check_tcp.c check_script.c name2id.c
-MAN= hoststated.8 hoststated.conf.5
+MAN= relayd.8 relayd.conf.5
LDADD= -levent -lssl -lcrypto
DPADD= ${LIBEVENT} ${LIBSSL} ${LIBCRYPTO}
diff --git a/usr.sbin/relayd/buffer.c b/usr.sbin/relayd/buffer.c
index 5b3cba8e544..81f4b58d86a 100644
--- a/usr.sbin/relayd/buffer.c
+++ b/usr.sbin/relayd/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.8 2007/11/24 17:07:28 reyk Exp $ */
+/* $OpenBSD: buffer.c,v 1.9 2007/12/07 17:17:00 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -33,7 +33,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
int buf_realloc(struct buf *, size_t);
void buf_enqueue(struct msgbuf *, struct buf *);
diff --git a/usr.sbin/relayd/carp.c b/usr.sbin/relayd/carp.c
index 4288b01b513..25312497d5d 100644
--- a/usr.sbin/relayd/carp.c
+++ b/usr.sbin/relayd/carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: carp.c,v 1.4 2007/11/24 17:07:28 reyk Exp $ */
+/* $OpenBSD: carp.c,v 1.5 2007/12/07 17:17:00 reyk Exp $ */
/*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@@ -30,7 +30,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
struct carpgroup {
TAILQ_ENTRY(carpgroup) entry;
diff --git a/usr.sbin/relayd/check_icmp.c b/usr.sbin/relayd/check_icmp.c
index 25dc21f2117..e0dc68b7a90 100644
--- a/usr.sbin/relayd/check_icmp.c
+++ b/usr.sbin/relayd/check_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check_icmp.c,v 1.21 2007/11/24 17:07:28 reyk Exp $ */
+/* $OpenBSD: check_icmp.c,v 1.22 2007/12/07 17:17:00 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -37,9 +37,9 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
-void icmp_setup(struct hoststated *, struct ctl_icmp_event *, int);
+void icmp_setup(struct relayd *, struct ctl_icmp_event *, int);
void check_icmp_add(struct ctl_icmp_event *, int, struct timeval *,
void (*)(int, short, void *));
int icmp_checks_done(struct ctl_icmp_event *);
@@ -49,7 +49,7 @@ void recv_icmp(int, short, void *);
int in_cksum(u_short *, int);
void
-icmp_setup(struct hoststated *env, struct ctl_icmp_event *cie, int af)
+icmp_setup(struct relayd *env, struct ctl_icmp_event *cie, int af)
{
int proto = IPPROTO_ICMP;
@@ -63,7 +63,7 @@ icmp_setup(struct hoststated *env, struct ctl_icmp_event *cie, int af)
}
void
-icmp_init(struct hoststated *env)
+icmp_init(struct relayd *env)
{
icmp_setup(env, &env->icmp_send, AF_INET);
icmp_setup(env, &env->icmp_recv, AF_INET);
@@ -73,7 +73,7 @@ icmp_init(struct hoststated *env)
}
void
-schedule_icmp(struct hoststated *env, struct host *host)
+schedule_icmp(struct relayd *env, struct host *host)
{
host->last_up = host->up;
host->flags &= ~(F_CHECK_SENT|F_CHECK_DONE);
@@ -101,7 +101,7 @@ check_icmp_add(struct ctl_icmp_event *cie, int flags, struct timeval *start,
}
void
-check_icmp(struct hoststated *env, struct timeval *tv)
+check_icmp(struct relayd *env, struct timeval *tv)
{
if (env->has_icmp) {
check_icmp_add(&env->icmp_recv, EV_READ, tv, recv_icmp);
diff --git a/usr.sbin/relayd/check_script.c b/usr.sbin/relayd/check_script.c
index 2f09c2543a3..cf08bc117a4 100644
--- a/usr.sbin/relayd/check_script.c
+++ b/usr.sbin/relayd/check_script.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check_script.c,v 1.4 2007/11/24 17:07:28 reyk Exp $ */
+/* $OpenBSD: check_script.c,v 1.5 2007/12/07 17:17:00 reyk Exp $ */
/*
* Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org>
@@ -35,7 +35,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
void script_sig_alarm(int);
@@ -55,7 +55,7 @@ check_script(struct host *host)
}
void
-script_done(struct hoststated *env, struct ctl_script *scr)
+script_done(struct relayd *env, struct ctl_script *scr)
{
struct host *host;
@@ -85,7 +85,7 @@ script_sig_alarm(int sig)
}
int
-script_exec(struct hoststated *env, struct ctl_script *scr)
+script_exec(struct relayd *env, struct ctl_script *scr)
{
int status = 0, ret = 0;
sig_t save_quit, save_int, save_chld;
@@ -118,7 +118,7 @@ script_exec(struct hoststated *env, struct ctl_script *scr)
signal(SIGINT, SIG_DFL);
signal(SIGCHLD, SIG_DFL);
- if ((pw = getpwnam(HOSTSTATED_USER)) == NULL)
+ if ((pw = getpwnam(RELAYD_USER)) == NULL)
fatal("script_exec: getpwnam");
if (chdir("/") == -1)
fatal("script_exec: chdir(\"/\")");
diff --git a/usr.sbin/relayd/check_tcp.c b/usr.sbin/relayd/check_tcp.c
index d039a1d1335..cf83dcec3ac 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.30 2007/11/24 17:07:28 reyk Exp $ */
+/* $OpenBSD: check_tcp.c,v 1.31 2007/12/07 17:17:00 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -35,7 +35,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
void tcp_write(int, short, void *);
void tcp_host_up(int, struct ctl_tcp_event *);
diff --git a/usr.sbin/relayd/control.c b/usr.sbin/relayd/control.c
index 97597dd8489..e8214b4e72d 100644
--- a/usr.sbin/relayd/control.c
+++ b/usr.sbin/relayd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.21 2007/11/24 17:07:28 reyk Exp $ */
+/* $OpenBSD: control.c,v 1.22 2007/12/07 17:17:00 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -34,7 +34,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
#define CONTROL_BACKLOG 5
@@ -59,33 +59,33 @@ control_init(void)
}
sun.sun_family = AF_UNIX;
- if (strlcpy(sun.sun_path, HOSTSTATED_SOCKET,
+ if (strlcpy(sun.sun_path, RELAYD_SOCKET,
sizeof(sun.sun_path)) >= sizeof(sun.sun_path)) {
- log_warn("control_init: %s name too long", HOSTSTATED_SOCKET);
+ log_warn("control_init: %s name too long", RELAYD_SOCKET);
close(fd);
return (-1);
}
- if (unlink(HOSTSTATED_SOCKET) == -1)
+ if (unlink(RELAYD_SOCKET) == -1)
if (errno != ENOENT) {
- log_warn("control_init: unlink %s", HOSTSTATED_SOCKET);
+ log_warn("control_init: unlink %s", RELAYD_SOCKET);
close(fd);
return (-1);
}
old_umask = umask(S_IXUSR|S_IXGRP|S_IWOTH|S_IROTH|S_IXOTH);
if (bind(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) {
- log_warn("control_init: bind: %s", HOSTSTATED_SOCKET);
+ log_warn("control_init: bind: %s", RELAYD_SOCKET);
close(fd);
(void)umask(old_umask);
return (-1);
}
(void)umask(old_umask);
- if (chmod(HOSTSTATED_SOCKET, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) == -1) {
+ if (chmod(RELAYD_SOCKET, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) == -1) {
log_warn("control_init: chmod");
close(fd);
- (void)unlink(HOSTSTATED_SOCKET);
+ (void)unlink(RELAYD_SOCKET);
return (-1);
}
@@ -96,7 +96,7 @@ control_init(void)
}
int
-control_listen(struct hoststated *env, struct imsgbuf *i_main,
+control_listen(struct relayd *env, struct imsgbuf *i_main,
struct imsgbuf *i_hce)
{
@@ -118,7 +118,7 @@ control_listen(struct hoststated *env, struct imsgbuf *i_main,
void
control_cleanup(void)
{
- (void)unlink(HOSTSTATED_SOCKET);
+ (void)unlink(RELAYD_SOCKET);
}
/* ARGSUSED */
@@ -129,7 +129,7 @@ control_accept(int listenfd, short event, void *arg)
socklen_t len;
struct sockaddr_un sun;
struct ctl_conn *c;
- struct hoststated *env = arg;
+ struct relayd *env = arg;
len = sizeof(sun);
if ((connfd = accept(listenfd,
@@ -191,7 +191,7 @@ control_dispatch_imsg(int fd, short event, void *arg)
struct imsg imsg;
struct ctl_id id;
int n;
- struct hoststated *env = arg;
+ struct relayd *env = arg;
if ((c = control_connbyfd(fd)) == NULL) {
log_warn("control_dispatch_imsg: fd %d: not found", fd);
@@ -336,7 +336,7 @@ control_dispatch_imsg(int fd, short event, void *arg)
* we unconditionnaly return a CTL_OK imsg because
* we have no choice.
*
- * so in this case, the reply hoststatectl gets means
+ * so in this case, the reply relayctl gets means
* that the reload command has been set,
* it doesn't say wether the command succeeded or not.
*/
diff --git a/usr.sbin/relayd/hce.c b/usr.sbin/relayd/hce.c
index cb3240f52da..fee3867998f 100644
--- a/usr.sbin/relayd/hce.c
+++ b/usr.sbin/relayd/hce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hce.c,v 1.36 2007/11/24 17:07:28 reyk Exp $ */
+/* $OpenBSD: hce.c,v 1.37 2007/12/07 17:17:00 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -39,7 +39,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
__dead void hce_shutdown(void);
void hce_sig_handler(int sig, short, void *);
@@ -49,7 +49,7 @@ void hce_launch_checks(int, short, void *);
void hce_setup_events(void);
void hce_disable_events(void);
-static struct hoststated *env = NULL;
+static struct relayd *env = NULL;
struct imsgbuf *ibuf_pfe;
struct imsgbuf *ibuf_main;
int pipe_pfe;
@@ -70,7 +70,7 @@ hce_sig_handler(int sig, short event, void *arg)
}
pid_t
-hce(struct hoststated *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2],
+hce(struct relayd *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2],
int pipe_parent2relay[RELAY_MAXPROC][2], int pipe_pfe2hce[2],
int pipe_pfe2relay[RELAY_MAXPROC][2])
{
@@ -92,7 +92,7 @@ hce(struct hoststated *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2],
env = x_env;
purge_config(env, PURGE_SERVICES|PURGE_RELAYS|PURGE_PROTOS);
- if ((pw = getpwnam(HOSTSTATED_USER)) == NULL)
+ if ((pw = getpwnam(RELAYD_USER)) == NULL)
fatal("hce: getpwnam");
#ifndef DEBUG
@@ -105,7 +105,7 @@ hce(struct hoststated *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2],
#endif
setproctitle("host check engine");
- hoststated_process = PROC_HCE;
+ relayd_process = PROC_HCE;
/* this is needed for icmp tests */
icmp_init(env);
@@ -299,9 +299,9 @@ hce_notify_done(struct host *host, const char *msg)
imsg_compose(ibuf_pfe, IMSG_HOST_STATUS, 0, 0, -1, &st, sizeof(st));
if (host->up != host->last_up)
- logopt = HOSTSTATED_OPT_LOGUPDATE;
+ logopt = RELAYD_OPT_LOGUPDATE;
else
- logopt = HOSTSTATED_OPT_LOGNOTIFY;
+ logopt = RELAYD_OPT_LOGNOTIFY;
if (gettimeofday(&tv_now, NULL))
fatal("hce_notify_done: gettimeofday");
@@ -469,11 +469,11 @@ hce_dispatch_parent(int fd, short event, void * ptr)
case IMSG_RECONF:
log_debug("hce: reloading configuration");
if (imsg.hdr.len !=
- sizeof(struct hoststated) + IMSG_HEADER_SIZE)
+ sizeof(struct relayd) + IMSG_HEADER_SIZE)
fatalx("corrupted reload data");
hce_disable_events();
purge_config(env, PURGE_TABLES);
- merge_config(env, (struct hoststated *)imsg.data);
+ merge_config(env, (struct relayd *)imsg.data);
env->tables = calloc(1, sizeof(*env->tables));
if (env->tables == NULL)
diff --git a/usr.sbin/relayd/imsg.c b/usr.sbin/relayd/imsg.c
index bac50e2007a..b3c751405db 100644
--- a/usr.sbin/relayd/imsg.c
+++ b/usr.sbin/relayd/imsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg.c,v 1.9 2007/11/24 17:07:28 reyk Exp $ */
+/* $OpenBSD: imsg.c,v 1.10 2007/12/07 17:17:00 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -31,7 +31,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
void
imsg_init(struct imsgbuf *ibuf, int fd, void (*handler)(int, short, void *))
diff --git a/usr.sbin/relayd/log.c b/usr.sbin/relayd/log.c
index b013a1280e1..c90c1fdf315 100644
--- a/usr.sbin/relayd/log.c
+++ b/usr.sbin/relayd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.10 2007/11/24 17:07:28 reyk Exp $ */
+/* $OpenBSD: log.c,v 1.11 2007/12/07 17:17:00 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -37,7 +37,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
int debug;
diff --git a/usr.sbin/relayd/name2id.c b/usr.sbin/relayd/name2id.c
index 8b9e4a781b9..fb8f1054b0c 100644
--- a/usr.sbin/relayd/name2id.c
+++ b/usr.sbin/relayd/name2id.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: name2id.c,v 1.1 2007/11/26 09:38:25 reyk Exp $ */
+/* $OpenBSD: name2id.c,v 1.2 2007/12/07 17:17:00 reyk Exp $ */
/*
* Copyright (c) 2004, 2005 Henning Brauer <henning@openbsd.org>
@@ -30,7 +30,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
#define IDVAL_MAX 50000
diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y
index dc21d748b27..f729fb4d1eb 100644
--- a/usr.sbin/relayd/parse.y
+++ b/usr.sbin/relayd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.96 2007/11/26 09:38:25 reyk Exp $ */
+/* $OpenBSD: parse.y,v 1.97 2007/12/07 17:17:00 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -47,7 +47,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files);
static struct file {
@@ -80,7 +80,7 @@ struct sym {
int symset(const char *, const char *, int);
char *symget(const char *);
-struct hoststated *conf = NULL;
+struct relayd *conf = NULL;
static int errors = 0;
objid_t last_service_id = 0;
objid_t last_table_id = 0;
@@ -304,8 +304,8 @@ main : INTERVAL NUMBER {
}
;
-loglevel : UPDATES { $$ = HOSTSTATED_OPT_LOGUPDATE; }
- | ALL { $$ = HOSTSTATED_OPT_LOGALL; }
+loglevel : UPDATES { $$ = RELAYD_OPT_LOGUPDATE; }
+ | ALL { $$ = RELAYD_OPT_LOGALL; }
;
service : SERVICE STRING {
@@ -1746,7 +1746,7 @@ popfile(void)
return (EOF);
}
-struct hoststated *
+struct relayd *
parse_config(const char *filename, int opts)
{
struct sym *sym, *next;
@@ -1815,7 +1815,7 @@ parse_config(const char *filename, int opts)
/* Free macros and check which have not been used. */
for (sym = TAILQ_FIRST(&symhead); sym != NULL; sym = next) {
next = TAILQ_NEXT(sym, entry);
- if ((conf->opts & HOSTSTATED_OPT_VERBOSE) && !sym->used)
+ if ((conf->opts & RELAYD_OPT_VERBOSE) && !sym->used)
fprintf(stderr, "warning: macro '%s' not "
"used\n", sym->nam);
if (!sym->persist) {
diff --git a/usr.sbin/relayd/pfe.c b/usr.sbin/relayd/pfe.c
index 32f8c84df18..b8b3b7ccc7c 100644
--- a/usr.sbin/relayd/pfe.c
+++ b/usr.sbin/relayd/pfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfe.c,v 1.43 2007/11/24 17:07:28 reyk Exp $ */
+/* $OpenBSD: pfe.c,v 1.44 2007/12/07 17:17:00 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -33,7 +33,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
void pfe_sig_handler(int sig, short, void *);
void pfe_shutdown(void);
@@ -45,7 +45,7 @@ void pfe_dispatch_relay(int, short, void *);
void pfe_sync(void);
-static struct hoststated *env = NULL;
+static struct relayd *env = NULL;
struct imsgbuf *ibuf_main;
struct imsgbuf *ibuf_hce;
@@ -64,7 +64,7 @@ pfe_sig_handler(int sig, short event, void *arg)
}
pid_t
-pfe(struct hoststated *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2],
+pfe(struct relayd *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2],
int pipe_parent2relay[RELAY_MAXPROC][2], int pipe_pfe2hce[2],
int pipe_pfe2relay[RELAY_MAXPROC][2])
{
@@ -93,7 +93,7 @@ pfe(struct hoststated *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2],
init_filter(env);
init_tables(env);
- if ((pw = getpwnam(HOSTSTATED_USER)) == NULL)
+ if ((pw = getpwnam(RELAYD_USER)) == NULL)
fatal("pfe: getpwnam");
#ifndef DEBUG
@@ -106,7 +106,7 @@ pfe(struct hoststated *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2],
#endif
setproctitle("pf update engine");
- hoststated_process = PROC_PFE;
+ relayd_process = PROC_PFE;
#ifndef DEBUG
if (setgroups(1, &pw->pw_gid) ||
@@ -358,11 +358,11 @@ pfe_dispatch_parent(int fd, short event, void * ptr)
case IMSG_RECONF:
log_debug("pfe: reloading configuration");
if (imsg.hdr.len !=
- sizeof(struct hoststated) + IMSG_HEADER_SIZE)
+ sizeof(struct relayd) + IMSG_HEADER_SIZE)
fatalx("corrupted reload data");
pfe_disable_events();
purge_config(env, PURGE_SERVICES|PURGE_TABLES);
- merge_config(env, (struct hoststated *)imsg.data);
+ merge_config(env, (struct relayd *)imsg.data);
/*
* no relays when reconfiguring yet.
*/
diff --git a/usr.sbin/relayd/pfe_filter.c b/usr.sbin/relayd/pfe_filter.c
index e8721c4b5cc..d8e4b6a55d3 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.19 2007/11/24 17:07:28 reyk Exp $ */
+/* $OpenBSD: pfe_filter.c,v 1.20 2007/12/07 17:17:00 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -36,7 +36,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
struct pfdata {
int dev;
@@ -45,12 +45,12 @@ struct pfdata {
struct pfioc_trans_e pfte;
};
-int transaction_init(struct hoststated *, const char *);
-int transaction_commit(struct hoststated *);
-void kill_tables(struct hoststated *);
+int transaction_init(struct relayd *, const char *);
+int transaction_commit(struct relayd *);
+void kill_tables(struct relayd *);
void
-init_filter(struct hoststated *env)
+init_filter(struct relayd *env)
{
struct pf_status status;
@@ -66,7 +66,7 @@ init_filter(struct hoststated *env)
}
void
-init_tables(struct hoststated *env)
+init_tables(struct relayd *env)
{
int i;
struct service *service;
@@ -78,7 +78,7 @@ init_tables(struct hoststated *env)
i = 0;
TAILQ_FOREACH(service, env->services, entry) {
- if (strlcpy(tables[i].pfrt_anchor, HOSTSTATED_ANCHOR "/",
+ if (strlcpy(tables[i].pfrt_anchor, RELAYD_ANCHOR "/",
sizeof(tables[i].pfrt_anchor)) >= PF_ANCHOR_NAME_SIZE)
goto toolong;
if (strlcat(tables[i].pfrt_anchor, service->conf.name,
@@ -121,13 +121,13 @@ init_tables(struct hoststated *env)
}
void
-kill_tables(struct hoststated *env) {
+kill_tables(struct relayd *env) {
struct pfioc_table io;
struct service *service;
memset(&io, 0, sizeof(io));
TAILQ_FOREACH(service, env->services, entry) {
- if (strlcpy(io.pfrio_table.pfrt_anchor, HOSTSTATED_ANCHOR "/",
+ if (strlcpy(io.pfrio_table.pfrt_anchor, RELAYD_ANCHOR "/",
sizeof(io.pfrio_table.pfrt_anchor)) >= PF_ANCHOR_NAME_SIZE)
goto toolong;
if (strlcat(io.pfrio_table.pfrt_anchor, service->conf.name,
@@ -144,7 +144,7 @@ kill_tables(struct hoststated *env) {
}
void
-sync_table(struct hoststated *env, struct service *service, struct table *table)
+sync_table(struct relayd *env, struct service *service, struct table *table)
{
int i;
struct pfioc_table io;
@@ -169,7 +169,7 @@ sync_table(struct hoststated *env, struct service *service, struct table *table)
io.pfrio_size = table->up;
io.pfrio_size2 = 0;
io.pfrio_buffer = addlist;
- if (strlcpy(io.pfrio_table.pfrt_anchor, HOSTSTATED_ANCHOR "/",
+ if (strlcpy(io.pfrio_table.pfrt_anchor, RELAYD_ANCHOR "/",
sizeof(io.pfrio_table.pfrt_anchor)) >= PF_ANCHOR_NAME_SIZE)
goto toolong;
if (strlcat(io.pfrio_table.pfrt_anchor, service->conf.name,
@@ -224,12 +224,12 @@ sync_table(struct hoststated *env, struct service *service, struct table *table)
}
void
-flush_table(struct hoststated *env, struct service *service)
+flush_table(struct relayd *env, struct service *service)
{
struct pfioc_table io;
memset(&io, 0, sizeof(io));
- if (strlcpy(io.pfrio_table.pfrt_anchor, HOSTSTATED_ANCHOR "/",
+ if (strlcpy(io.pfrio_table.pfrt_anchor, RELAYD_ANCHOR "/",
sizeof(io.pfrio_table.pfrt_anchor)) >= PF_ANCHOR_NAME_SIZE)
goto toolong;
if (strlcat(io.pfrio_table.pfrt_anchor, service->conf.name,
@@ -249,7 +249,7 @@ flush_table(struct hoststated *env, struct service *service)
}
int
-transaction_init(struct hoststated *env, const char *anchor)
+transaction_init(struct relayd *env, const char *anchor)
{
env->pf->pft.size = 1;
env->pf->pft.esize = sizeof env->pf->pfte;
@@ -265,7 +265,7 @@ transaction_init(struct hoststated *env, const char *anchor)
}
int
-transaction_commit(struct hoststated *env)
+transaction_commit(struct relayd *env)
{
if (ioctl(env->pf->dev, DIOCXCOMMIT, &env->pf->pft) == -1)
return (-1);
@@ -273,7 +273,7 @@ transaction_commit(struct hoststated *env)
}
void
-sync_ruleset(struct hoststated *env, struct service *service, int enable)
+sync_ruleset(struct relayd *env, struct service *service, int enable)
{
struct pfioc_rule rio;
struct pfioc_pooladdr pio;
@@ -283,7 +283,7 @@ sync_ruleset(struct hoststated *env, struct service *service, int enable)
char anchor[PF_ANCHOR_NAME_SIZE];
bzero(anchor, sizeof(anchor));
- if (strlcpy(anchor, HOSTSTATED_ANCHOR "/", sizeof(anchor)) >=
+ if (strlcpy(anchor, RELAYD_ANCHOR "/", sizeof(anchor)) >=
PF_ANCHOR_NAME_SIZE)
goto toolong;
if (strlcat(anchor, service->conf.name, sizeof(anchor)) >=
@@ -371,14 +371,14 @@ sync_ruleset(struct hoststated *env, struct service *service, int enable)
}
void
-flush_rulesets(struct hoststated *env)
+flush_rulesets(struct relayd *env)
{
struct service *service;
char anchor[PF_ANCHOR_NAME_SIZE];
kill_tables(env);
TAILQ_FOREACH(service, env->services, entry) {
- if (strlcpy(anchor, HOSTSTATED_ANCHOR "/", sizeof(anchor)) >=
+ if (strlcpy(anchor, RELAYD_ANCHOR "/", sizeof(anchor)) >=
PF_ANCHOR_NAME_SIZE)
goto toolong;
if (strlcat(anchor, service->conf.name, sizeof(anchor)) >=
@@ -387,15 +387,15 @@ flush_rulesets(struct hoststated *env)
if (transaction_init(env, anchor) == -1 ||
transaction_commit(env) == -1)
log_warn("flush_rulesets: transaction for %s/ failed",
- HOSTSTATED_ANCHOR);
+ RELAYD_ANCHOR);
}
- if (strlcpy(anchor, HOSTSTATED_ANCHOR, sizeof(anchor)) >=
+ if (strlcpy(anchor, RELAYD_ANCHOR, sizeof(anchor)) >=
PF_ANCHOR_NAME_SIZE)
goto toolong;
if (transaction_init(env, anchor) == -1 ||
transaction_commit(env) == -1)
log_warn("flush_rulesets: transaction for %s failed",
- HOSTSTATED_ANCHOR);
+ RELAYD_ANCHOR);
log_debug("flush_rulesets: flushed rules");
return;
@@ -404,7 +404,7 @@ flush_rulesets(struct hoststated *env)
}
int
-natlook(struct hoststated *env, struct ctl_natlook *cnl)
+natlook(struct relayd *env, struct ctl_natlook *cnl)
{
struct pfioc_natlook pnl;
struct sockaddr_in *in, *out;
diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c
index 8039aec31ab..98a74dcbd90 100644
--- a/usr.sbin/relayd/relay.c
+++ b/usr.sbin/relayd/relay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay.c,v 1.74 2007/11/28 16:25:12 reyk Exp $ */
+/* $OpenBSD: relay.c,v 1.75 2007/12/07 17:17:01 reyk Exp $ */
/*
* Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -46,7 +46,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
void relay_sig_handler(int sig, short, void *);
void relay_statistics(int, short, void *);
@@ -133,7 +133,7 @@ extern void bufferevent_read_pressure_cb(struct evbuffer *, size_t,
volatile sig_atomic_t relay_sessions;
objid_t relay_conid;
-static struct hoststated *env = NULL;
+static struct relayd *env = NULL;
struct imsgbuf *ibuf_pfe;
struct imsgbuf *ibuf_main;
int proc_id;
@@ -155,7 +155,7 @@ relay_sig_handler(int sig, short event, void *arg)
}
pid_t
-relay(struct hoststated *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2],
+relay(struct relayd *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2],
int pipe_parent2relay[RELAY_MAXPROC][2], int pipe_pfe2hce[2],
int pipe_pfe2relay[RELAY_MAXPROC][2])
{
@@ -180,7 +180,7 @@ relay(struct hoststated *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2],
/* Need root privileges for relay initialization */
relay_privinit();
- if ((pw = getpwnam(HOSTSTATED_USER)) == NULL)
+ if ((pw = getpwnam(RELAYD_USER)) == NULL)
fatal("relay: getpwnam");
#ifndef DEBUG
@@ -194,7 +194,7 @@ relay(struct hoststated *x_env, int pipe_parent2pfe[2], int pipe_parent2hce[2],
#endif
setproctitle("socket relay engine");
- hoststated_process = PROC_RELAY;
+ relayd_process = PROC_RELAY;
#ifndef DEBUG
if (setgroups(1, &pw->pw_gid) ||
@@ -1835,10 +1835,10 @@ relay_close_http(struct session *con, u_int code, const char *msg,
"<hr><address>%s at %s port %d</address>\n"
"</body>\n"
"</html>\n",
- code, httperr, tmbuf, HOSTSTATED_SERVERNAME,
+ code, httperr, tmbuf, RELAYD_SERVERNAME,
code, httperr, style, httperr, text,
label == NULL ? "" : label,
- HOSTSTATED_SERVERNAME, hbuf, ntohs(rlay->conf.port)) == -1)
+ RELAYD_SERVERNAME, hbuf, ntohs(rlay->conf.port)) == -1)
goto done;
/* Dump the message without checking for success */
@@ -2186,7 +2186,7 @@ relay_close(struct session *con, const char *msg)
if (con->out.bev != NULL)
bufferevent_disable(con->out.bev, EV_READ|EV_WRITE);
- if (env->opts & HOSTSTATED_OPT_LOGUPDATE) {
+ if (env->opts & RELAYD_OPT_LOGUPDATE) {
bzero(&ibuf, sizeof(ibuf));
bzero(&obuf, sizeof(obuf));
(void)print_host(&con->in.ss, ibuf, sizeof(ibuf));
diff --git a/usr.sbin/relayd/relay_udp.c b/usr.sbin/relayd/relay_udp.c
index fce5779c3d4..d5fbb4078e3 100644
--- a/usr.sbin/relayd/relay_udp.c
+++ b/usr.sbin/relayd/relay_udp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay_udp.c,v 1.2 2007/11/24 17:07:28 reyk Exp $ */
+/* $OpenBSD: relay_udp.c,v 1.3 2007/12/07 17:17:01 reyk Exp $ */
/*
* Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org>
@@ -45,7 +45,7 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
extern volatile sig_atomic_t relay_sessions;
extern objid_t relay_conid;
@@ -61,7 +61,7 @@ extern int relay_socket_af(struct sockaddr_storage *, in_port_t);
extern int relay_cmp_af(struct sockaddr_storage *,
struct sockaddr_storage *);
-struct hoststated *env = NULL;
+struct relayd *env = NULL;
int relay_udp_socket(struct sockaddr_storage *, in_port_t,
struct protocol *);
@@ -76,7 +76,7 @@ void relay_dns_response(struct session *, u_int8_t *, size_t);
int relay_dns_cmp(struct session *, struct session *);
void
-relay_udp_privinit(struct hoststated *x_env, struct relay *rlay)
+relay_udp_privinit(struct relayd *x_env, struct relay *rlay)
{
struct protocol *proto = rlay->proto;
diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c
index cebc5659189..938cf767a97 100644
--- a/usr.sbin/relayd/relayd.c
+++ b/usr.sbin/relayd/relayd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.c,v 1.61 2007/11/28 11:37:59 reyk Exp $ */
+/* $OpenBSD: relayd.c,v 1.62 2007/12/07 17:17:01 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -41,17 +41,17 @@
#include <openssl/ssl.h>
-#include "hoststated.h"
+#include "relayd.h"
__dead void usage(void);
void main_sig_handler(int, short, void *);
-void main_shutdown(struct hoststated *);
+void main_shutdown(struct relayd *);
void main_dispatch_pfe(int, short, void *);
void main_dispatch_hce(int, short, void *);
void main_dispatch_relay(int, short, void *);
int check_child(pid_t, const char *);
-int send_all(struct hoststated *, enum imsg_type,
+int send_all(struct relayd *, enum imsg_type,
void *, u_int16_t);
void reconfigure(void);
void purge_tree(struct proto_tree *);
@@ -62,7 +62,7 @@ int pipe_pfe2hce[2];
int pipe_parent2relay[RELAY_MAXPROC][2];
int pipe_pfe2relay[RELAY_MAXPROC][2];
-struct hoststated *hoststated_env;
+struct relayd *relayd_env;
struct imsgbuf *ibuf_pfe;
struct imsgbuf *ibuf_hce;
@@ -75,7 +75,7 @@ pid_t relay_pid = 0;
void
main_sig_handler(int sig, short event, void *arg)
{
- struct hoststated *env = arg;
+ struct relayd *env = arg;
int die = 0;
switch (sig) {
@@ -123,7 +123,7 @@ main(int argc, char *argv[])
int c;
int debug;
u_int32_t opts;
- struct hoststated *env;
+ struct relayd *env;
const char *conffile;
struct event ev_sigint;
struct event ev_sigterm;
@@ -149,13 +149,13 @@ main(int argc, char *argv[])
break;
case 'n':
debug = 2;
- opts |= HOSTSTATED_OPT_NOACTION;
+ opts |= RELAYD_OPT_NOACTION;
break;
case 'f':
conffile = optarg;
break;
case 'v':
- opts |= HOSTSTATED_OPT_VERBOSE;
+ opts |= RELAYD_OPT_VERBOSE;
break;
default:
usage();
@@ -164,20 +164,20 @@ main(int argc, char *argv[])
if ((env = parse_config(conffile, opts)) == NULL)
exit(1);
- hoststated_env = env;
+ relayd_env = env;
- if (env->opts & HOSTSTATED_OPT_NOACTION) {
+ if (env->opts & RELAYD_OPT_NOACTION) {
fprintf(stderr, "configuration OK\n");
exit(0);
}
if (debug)
- env->opts |= HOSTSTATED_OPT_LOGUPDATE;
+ env->opts |= RELAYD_OPT_LOGUPDATE;
if (geteuid())
errx(1, "need root privileges");
- if (getpwnam(HOSTSTATED_USER) == NULL)
- errx(1, "unknown user %s", HOSTSTATED_USER);
+ if (getpwnam(RELAYD_USER) == NULL)
+ errx(1, "unknown user %s", RELAYD_USER);
log_init(debug);
@@ -289,7 +289,7 @@ main(int argc, char *argv[])
}
void
-main_shutdown(struct hoststated *env)
+main_shutdown(struct relayd *env)
{
pid_t pid;
@@ -335,7 +335,7 @@ check_child(pid_t pid, const char *pname)
}
int
-send_all(struct hoststated *env, enum imsg_type type, void *buf, u_int16_t len)
+send_all(struct relayd *env, enum imsg_type type, void *buf, u_int16_t len)
{
int i;
@@ -352,7 +352,7 @@ send_all(struct hoststated *env, enum imsg_type type, void *buf, u_int16_t len)
}
void
-merge_config(struct hoststated *env, struct hoststated *new_env)
+merge_config(struct relayd *env, struct relayd *new_env)
{
env->opts = new_env->opts;
env->flags = new_env->flags;
@@ -382,8 +382,8 @@ merge_config(struct hoststated *env, struct hoststated *new_env)
void
reconfigure(void)
{
- struct hoststated *env = hoststated_env;
- struct hoststated *new_env;
+ struct relayd *env = relayd_env;
+ struct relayd *new_env;
struct service *service;
struct address *virt;
struct table *table;
@@ -438,7 +438,7 @@ reconfigure(void)
}
void
-purge_config(struct hoststated *env, u_int8_t what)
+purge_config(struct relayd *env, u_int8_t what)
{
struct table *table;
struct host *host;
@@ -619,9 +619,9 @@ main_dispatch_hce(int fd, short event, void * ptr)
struct imsg imsg;
ssize_t n;
struct ctl_script scr;
- struct hoststated *env;
+ struct relayd *env;
- env = hoststated_env;
+ env = relayd_env;
ibuf = ptr;
switch (event) {
case EV_READ:
@@ -716,7 +716,7 @@ main_dispatch_relay(int fd, short event, void * ptr)
}
struct host *
-host_find(struct hoststated *env, objid_t id)
+host_find(struct relayd *env, objid_t id)
{
struct table *table;
struct host *host;
@@ -729,7 +729,7 @@ host_find(struct hoststated *env, objid_t id)
}
struct table *
-table_find(struct hoststated *env, objid_t id)
+table_find(struct relayd *env, objid_t id)
{
struct table *table;
@@ -740,7 +740,7 @@ table_find(struct hoststated *env, objid_t id)
}
struct service *
-service_find(struct hoststated *env, objid_t id)
+service_find(struct relayd *env, objid_t id)
{
struct service *service;
@@ -751,7 +751,7 @@ service_find(struct hoststated *env, objid_t id)
}
struct relay *
-relay_find(struct hoststated *env, objid_t id)
+relay_find(struct relayd *env, objid_t id)
{
struct relay *rlay;
@@ -762,7 +762,7 @@ relay_find(struct hoststated *env, objid_t id)
}
struct session *
-session_find(struct hoststated *env, objid_t id)
+session_find(struct relayd *env, objid_t id)
{
struct relay *rlay;
struct session *con;
@@ -775,7 +775,7 @@ session_find(struct hoststated *env, objid_t id)
}
struct host *
-host_findbyname(struct hoststated *env, const char *name)
+host_findbyname(struct relayd *env, const char *name)
{
struct table *table;
struct host *host;
@@ -788,7 +788,7 @@ host_findbyname(struct hoststated *env, const char *name)
}
struct table *
-table_findbyname(struct hoststated *env, const char *name)
+table_findbyname(struct relayd *env, const char *name)
{
struct table *table;
@@ -799,7 +799,7 @@ table_findbyname(struct hoststated *env, const char *name)
}
struct service *
-service_findbyname(struct hoststated *env, const char *name)
+service_findbyname(struct relayd *env, const char *name)
{
struct service *service;
@@ -810,7 +810,7 @@ service_findbyname(struct hoststated *env, const char *name)
}
struct relay *
-relay_findbyname(struct hoststated *env, const char *name)
+relay_findbyname(struct relayd *env, const char *name)
{
struct relay *rlay;
diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h
index 1c7e3700c9b..d52970db906 100644
--- a/usr.sbin/relayd/relayd.h
+++ b/usr.sbin/relayd/relayd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.h,v 1.86 2007/11/26 09:38:25 reyk Exp $ */
+/* $OpenBSD: relayd.h,v 1.87 2007/12/07 17:17:01 reyk Exp $ */
/*
* Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -20,12 +20,12 @@
#include <sys/tree.h>
-#define CONF_FILE "/etc/hoststated.conf"
-#define HOSTSTATED_SOCKET "/var/run/hoststated.sock"
+#define CONF_FILE "/etc/relayd.conf"
+#define RELAYD_SOCKET "/var/run/relayd.sock"
#define PF_SOCKET "/dev/pf"
-#define HOSTSTATED_USER "_hoststated"
-#define HOSTSTATED_ANCHOR "hoststated"
-#define HOSTSTATED_SERVERNAME "OpenBSD hoststated"
+#define RELAYD_USER "_relayd"
+#define RELAYD_ANCHOR "relayd"
+#define RELAYD_SERVERNAME "OpenBSD relayd"
#define CHECK_TIMEOUT 200
#define CHECK_INTERVAL 10
#define EMPTY_TABLE UINT_MAX
@@ -100,7 +100,7 @@ struct imsgbuf {
enum imsg_type {
IMSG_NONE,
- IMSG_CTL_OK, /* answer to hoststatectl requests */
+ IMSG_CTL_OK, /* answer to relayctl requests */
IMSG_CTL_FAIL,
IMSG_CTL_END,
IMSG_CTL_SERVICE,
@@ -111,7 +111,7 @@ enum imsg_type {
IMSG_CTL_TABLE_CHANGED,
IMSG_CTL_PULL_RULESET,
IMSG_CTL_PUSH_RULESET,
- IMSG_CTL_SHOW_SUM, /* hoststatectl requests */
+ IMSG_CTL_SHOW_SUM, /* relayctl requests */
IMSG_CTL_SERVICE_ENABLE,
IMSG_CTL_SERVICE_DISABLE,
IMSG_CTL_TABLE_ENABLE,
@@ -187,7 +187,7 @@ struct ctl_demote {
};
struct ctl_icmp_event {
- struct hoststated *env;
+ struct relayd *env;
int s;
int af;
int last_up;
@@ -593,9 +593,9 @@ enum {
PROC_PFE,
PROC_HCE,
PROC_RELAY
-} hoststated_process;
+} relayd_process;
-struct hoststated {
+struct relayd {
u_int8_t opts;
u_int32_t flags;
const char *confpath;
@@ -628,11 +628,11 @@ struct hoststated {
struct ctl_icmp_event icmp6_recv;
};
-#define HOSTSTATED_OPT_VERBOSE 0x01
-#define HOSTSTATED_OPT_NOACTION 0x04
-#define HOSTSTATED_OPT_LOGUPDATE 0x08
-#define HOSTSTATED_OPT_LOGNOTIFY 0x10
-#define HOSTSTATED_OPT_LOGALL 0x18
+#define RELAYD_OPT_VERBOSE 0x01
+#define RELAYD_OPT_NOACTION 0x04
+#define RELAYD_OPT_LOGUPDATE 0x08
+#define RELAYD_OPT_LOGNOTIFY 0x10
+#define RELAYD_OPT_LOGALL 0x18
/* initially control.h */
struct {
@@ -656,7 +656,7 @@ TAILQ_HEAD(ctl_connlist, ctl_conn);
/* control.c */
int control_init(void);
-int control_listen(struct hoststated *, struct imsgbuf *, struct imsgbuf *);
+int control_listen(struct relayd *, struct imsgbuf *, struct imsgbuf *);
void control_accept(int, short, void *);
void control_dispatch_imsg(int, short, void *);
void control_imsg_forward(struct imsg *);
@@ -667,8 +667,8 @@ void session_socket_blockmode(int, enum blockmodes);
extern struct ctl_connlist ctl_conns;
/* parse.y */
-struct hoststated *parse_config(const char *, int);
-int cmdline_symset(char *);
+struct relayd *parse_config(const char *, int);
+int cmdline_symset(char *);
/* log.c */
void log_init(int);
@@ -711,7 +711,7 @@ void imsg_event_add(struct imsgbuf *); /* needs to be provided externally */
int imsg_get_fd(struct imsgbuf *);
/* pfe.c */
-pid_t pfe(struct hoststated *, int [2], int [2], int [RELAY_MAXPROC][2],
+pid_t pfe(struct relayd *, int [2], int [2], int [RELAY_MAXPROC][2],
int [2], int [RELAY_MAXPROC][2]);
void show(struct ctl_conn *);
void show_sessions(struct ctl_conn *);
@@ -723,21 +723,21 @@ int disable_table(struct ctl_conn *, struct ctl_id *);
int disable_host(struct ctl_conn *, struct ctl_id *);
/* pfe_filter.c */
-void init_filter(struct hoststated *);
-void init_tables(struct hoststated *);
-void flush_table(struct hoststated *, struct service *);
-void sync_table(struct hoststated *, struct service *, struct table *);
-void sync_ruleset(struct hoststated *, struct service *, int);
-void flush_rulesets(struct hoststated *);
-int natlook(struct hoststated *, struct ctl_natlook *);
+void init_filter(struct relayd *);
+void init_tables(struct relayd *);
+void flush_table(struct relayd *, struct service *);
+void sync_table(struct relayd *, struct service *, struct table *);
+void sync_ruleset(struct relayd *, struct service *, int);
+void flush_rulesets(struct relayd *);
+int natlook(struct relayd *, struct ctl_natlook *);
/* hce.c */
-pid_t hce(struct hoststated *, int [2], int [2], int [RELAY_MAXPROC][2],
+pid_t hce(struct relayd *, int [2], int [2], int [RELAY_MAXPROC][2],
int [2], int [RELAY_MAXPROC][2]);
void hce_notify_done(struct host *, const char *);
/* relay.c */
-pid_t relay(struct hoststated *, int [2], int [2], int [RELAY_MAXPROC][2],
+pid_t relay(struct relayd *, int [2], int [2], int [RELAY_MAXPROC][2],
int [2], int [RELAY_MAXPROC][2]);
void relay_notify_done(struct host *, const char *);
int relay_session_cmp(struct session *, struct session *);
@@ -747,51 +747,51 @@ RB_PROTOTYPE(proto_tree, protonode, nodes, relay_proto_cmp);
SPLAY_PROTOTYPE(session_tree, session, nodes, relay_session_cmp);
/* relay_udp.c */
-void relay_udp_privinit(struct hoststated *, struct relay *);
+void relay_udp_privinit(struct relayd *, struct relay *);
int relay_udp_bind(struct sockaddr_storage *, in_port_t,
struct protocol *);
void relay_udp_server(int, short, void *);
/* check_icmp.c */
-void icmp_init(struct hoststated *);
-void schedule_icmp(struct hoststated *, struct host *);
-void check_icmp(struct hoststated *, struct timeval *);
+void icmp_init(struct relayd *);
+void schedule_icmp(struct relayd *, struct host *);
+void check_icmp(struct relayd *, struct timeval *);
/* check_tcp.c */
void check_tcp(struct ctl_tcp_event *);
/* check_script.c */
void check_script(struct host *);
-void script_done(struct hoststated *, struct ctl_script *);
-int script_exec(struct hoststated *, struct ctl_script *);
+void script_done(struct relayd *, struct ctl_script *);
+int script_exec(struct relayd *, struct ctl_script *);
/* ssl.c */
-void ssl_init(struct hoststated *);
+void ssl_init(struct relayd *);
void ssl_transaction(struct ctl_tcp_event *);
-SSL_CTX *ssl_ctx_create(struct hoststated *);
+SSL_CTX *ssl_ctx_create(struct relayd *);
void ssl_error(const char *, const char *);
/* ssl_privsep.c */
int ssl_ctx_use_private_key(SSL_CTX *, char *, off_t);
int ssl_ctx_use_certificate_chain(SSL_CTX *, char *, off_t);
-/* hoststated.c */
-struct host *host_find(struct hoststated *, objid_t);
-struct table *table_find(struct hoststated *, objid_t);
-struct service *service_find(struct hoststated *, objid_t);
-struct host *host_findbyname(struct hoststated *, const char *);
-struct table *table_findbyname(struct hoststated *, const char *);
-struct service *service_findbyname(struct hoststated *, const char *);
+/* relayd.c */
+struct host *host_find(struct relayd *, objid_t);
+struct table *table_find(struct relayd *, objid_t);
+struct service *service_find(struct relayd *, objid_t);
+struct host *host_findbyname(struct relayd *, const char *);
+struct table *table_findbyname(struct relayd *, const char *);
+struct service *service_findbyname(struct relayd *, const char *);
void event_again(struct event *, int, short,
void (*)(int, short, void *),
struct timeval *, struct timeval *, void *);
-struct relay *relay_find(struct hoststated *, objid_t);
-struct session *session_find(struct hoststated *, objid_t);
-struct relay *relay_findbyname(struct hoststated *, const char *);
+struct relay *relay_find(struct relayd *, objid_t);
+struct session *session_find(struct relayd *, objid_t);
+struct relay *relay_findbyname(struct relayd *, const char *);
int expand_string(char *, size_t, const char *, const char *);
void translate_string(char *);
-void purge_config(struct hoststated *, u_int8_t);
-void merge_config(struct hoststated *, struct hoststated *);
+void purge_config(struct relayd *, u_int8_t);
+void merge_config(struct relayd *, struct relayd *);
char *digeststr(enum digest_type, const u_int8_t *, size_t, char *);
const char *canonicalize_host(const char *, char *, size_t);
diff --git a/usr.sbin/relayd/ssl.c b/usr.sbin/relayd/ssl.c
index 3d572bd5bbc..93e9d1fbd7b 100644
--- a/usr.sbin/relayd/ssl.c
+++ b/usr.sbin/relayd/ssl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl.c,v 1.12 2007/12/05 23:02:05 reyk Exp $ */
+/* $OpenBSD: ssl.c,v 1.13 2007/12/07 17:17:01 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -35,7 +35,7 @@
#include <openssl/err.h>
#include <openssl/engine.h>
-#include "hoststated.h"
+#include "relayd.h"
void ssl_read(int, short, void *);
void ssl_write(int, short, void *);
@@ -249,7 +249,7 @@ ssl_error(const char *where, const char *what)
}
void
-ssl_init(struct hoststated *env)
+ssl_init(struct relayd *env)
{
SSL_library_init();
SSL_load_error_strings();
@@ -283,7 +283,7 @@ ssl_transaction(struct ctl_tcp_event *cte)
}
SSL_CTX *
-ssl_ctx_create(struct hoststated *env)
+ssl_ctx_create(struct relayd *env)
{
SSL_CTX *ctx;