Commit Diff


commit - 66e471783d6a2b9eed53ca611c5cde2ede91d4bf
commit + 6d0767ae5060ef5776c15fb1b7f05403ccfeba9c
blob - 4c2d3010aafb81c7347b292accea24d362c6f71b
blob + 8e8b92798271aa64f88ef83314c9c7bf52fd0f3d
--- Makefile
+++ 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}
blob - 5b3cba8e544da1b82d6f0408c8677802bd41b6e2
blob + 81f4b58d86af735f0a560542e5d8f328373ac66e
--- buffer.c
+++ 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 *);
blob - 4288b01b513e5df13face35dc233b79e13568ba2
blob + 25312497d5d6492db7a2fa48904c3e3f40c8fc04
--- carp.c
+++ 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;
blob - 25dc21f2117d19daa07aea2d7e90932ade3cbd49
blob + e0dc68b7a90d01d2a6de3de7a6483ff5ae7f4881
--- check_icmp.c
+++ 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_eve
 }
 
 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, 
 }
 
 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);
blob - 2f09c2543a3b4082952039857f10d3b139cd0d0f
blob + cf08bc117a443534c5f0183351476ca1af483ff4
--- check_script.c
+++ 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 
 		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(\"/\")");
blob - d039a1d1335c00f7a45e644c9b1d733f951903bc
blob + cf83dcec3ac934efa272a2d8e36101f898e206ab
--- check_tcp.c
+++ 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 *);
blob - 97597dd84895b41fca10b46a3d823fb040bc9254
blob + e8214b4e72db53503dab51d5b0b1824b71b558e0
--- control.c
+++ 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 
 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.
 			 */
blob - cb3240f52daefcb192982139b395277438688fc0
blob + fee3867998f0dafeb07957ee49d8aa8d37f63893
--- hce.c
+++ 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], 
 	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], 
 #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)
blob - bac50e2007ad22ec221c54e257a4856f7d6fe989
blob + b3c751405db30706a02d9edbb022aee84dd9f4fc
--- imsg.c
+++ 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 *))
blob - b013a1280e1dc9e73dc8962156d61519aa290b5a
blob + c90c1fdf3156761e8e8427613684598930ad39af
--- log.c
+++ 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;
 
blob - 8b9e4a781b987212be931a9865025e2c5f0cc96a
blob + fb8f1054b0cce222756241866e93af230c9f4c43
--- name2id.c
+++ 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
 
blob - dc21d748b277acd4a020142c131c7fbd6612b3a1
blob + f729fb4d1eb756356930190616616a0528ec2b3d
--- parse.y
+++ 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) {
blob - 32f8c84df18bad84b97d5dd26edbaaa585286eaa
blob + b8b3b7ccc7c3a046f676e817f40275b86b48412a
--- pfe.c
+++ 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], 
 	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], 
 #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.
 			 */
blob - e8721c4b5ccf2a9c1018f98f8952a9b9ace7c3e1
blob + d8e4b6a55d309ef7407cc9107e25a85a4a80836a
--- pfe_filter.c
+++ 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 *ser
 	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 *ser
 }
 
 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 *se
 }
 
 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 *a
 }
 
 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 *s
 	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 *s
 }
 
 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;
blob - 8039aec31ab4ca8a55c39bf162999cb612190630
blob + 98a74dcbd9028b48a6b68f6915b6980548ab94d1
--- relay.c
+++ 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 evbuf
 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]
 	/* 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]
 #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, cons
 	    "<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));
blob - fce5779c3d4cf31aef2d3ff2dd93760aa17034ef
blob + d5fbb4078e367cd58d651a41ccaecb7639ce7c1b
--- relay_udp.c
+++ 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 *,
 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 *
 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;
 
blob - cebc5659189a489d39e10e650595347b759086bd
blob + 938cf767a975b7ca48dc2576a5e49e52957f3977
--- relayd.c
+++ 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
-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
 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 *na
 }
 
 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 *n
 }
 
 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 
 }
 
 struct relay *
-relay_findbyname(struct hoststated *env, const char *name)
+relay_findbyname(struct relayd *env, const char *name)
 {
 	struct relay	*rlay;
 
blob - 1c7e3700c9bbf9cd13557c7e32f811d7d82853c8
blob + d52970db906d744c704af8e4eead2bee41726058
--- relayd.h
+++ 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
 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
 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);
 
blob - 3d572bd5bbccf6d69ad085e2dfa9c2080407b282
blob + 93e9d1fbd7b5c4310acc443f9f50b00da2752853
--- ssl.c
+++ 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;