summaryrefslogtreecommitdiff
path: root/usr.sbin/hoststated
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/hoststated')
-rw-r--r--usr.sbin/hoststated/hoststated.c4
-rw-r--r--usr.sbin/hoststated/parse.y13
-rw-r--r--usr.sbin/hoststated/pfe.c9
3 files changed, 16 insertions, 10 deletions
diff --git a/usr.sbin/hoststated/hoststated.c b/usr.sbin/hoststated/hoststated.c
index 12a3a5c32c0..523c404f9fe 100644
--- a/usr.sbin/hoststated/hoststated.c
+++ b/usr.sbin/hoststated/hoststated.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hoststated.c,v 1.50 2007/11/14 11:01:52 pyr Exp $ */
+/* $OpenBSD: hoststated.c,v 1.51 2007/11/15 17:02:01 pyr Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -498,8 +498,6 @@ purge_config(struct hoststated *env, u_int8_t what)
if (what & PURGE_PROTOS && env->protos != NULL) {
while ((proto = TAILQ_FIRST(env->protos)) != NULL) {
TAILQ_REMOVE(env->protos, proto, entry);
- if (strcmp(proto->name, "default") == 0)
- continue;
while ((pnode = RB_ROOT(&proto->request_tree))
!= NULL) {
RB_REMOVE(proto_tree, &proto->request_tree,
diff --git a/usr.sbin/hoststated/parse.y b/usr.sbin/hoststated/parse.y
index e2b1652ffad..d32f2c0e868 100644
--- a/usr.sbin/hoststated/parse.y
+++ b/usr.sbin/hoststated/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.79 2007/11/14 15:58:04 pyr Exp $ */
+/* $OpenBSD: parse.y,v 1.80 2007/11/15 17:02:01 pyr Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -583,9 +583,13 @@ tableoptsl : host {
proto : PROTO STRING {
struct protocol *p;
- TAILQ_FOREACH(p, conf->protos, entry)
- if (!strcmp(p->name, $2))
- break;
+ if (strcmp($2, "default") == 0) {
+ p = &conf->proto_default;
+ } else {
+ TAILQ_FOREACH(p, conf->protos, entry)
+ if (!strcmp(p->name, $2))
+ break;
+ }
if (p != NULL) {
yyerror("protocol %s defined twice", $2);
free($2);
@@ -1623,7 +1627,6 @@ parse_config(const char *filename, int opts)
sizeof(conf->proto_default.name));
RB_INIT(&conf->proto_default.request_tree);
RB_INIT(&conf->proto_default.response_tree);
- TAILQ_INSERT_TAIL(conf->protos, &conf->proto_default, entry);
conf->timeout.tv_sec = CHECK_TIMEOUT / 1000;
conf->timeout.tv_usec = (CHECK_TIMEOUT % 1000) * 1000;
diff --git a/usr.sbin/hoststated/pfe.c b/usr.sbin/hoststated/pfe.c
index 522607d9971..465763103da 100644
--- a/usr.sbin/hoststated/pfe.c
+++ b/usr.sbin/hoststated/pfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfe.c,v 1.40 2007/11/14 15:25:26 pyr Exp $ */
+/* $OpenBSD: pfe.c,v 1.41 2007/11/15 17:02:01 pyr Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -361,8 +361,13 @@ pfe_dispatch_parent(int fd, short event, void * ptr)
sizeof(struct hoststated) + IMSG_HEADER_SIZE)
fatalx("corrupted reload data");
pfe_disable_events();
- purge_config(env, PURGE_EVERYTHING);
+ purge_config(env, PURGE_SERVICES|PURGE_TABLES);
merge_config(env, (struct hoststated *)imsg.data);
+ /*
+ * no relays when reconfiguring yet.
+ */
+ env->relays = NULL;
+ env->protos = NULL;
env->tables = calloc(1, sizeof(*env->tables));
env->services = calloc(1, sizeof(*env->services));