diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2009-04-17 09:47:07 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2009-04-17 09:47:07 +0000 |
commit | 0e6da7e0fe2efb9f3f3cd1483f7a65e6649dc98f (patch) | |
tree | 5aff6fef95469bfcb7de3f03036fb35c08054dc3 /usr.sbin/relayd | |
parent | 687e2e4ca736036c4cc5f86b7d3df7e11e6ffb89 (diff) |
keep the parent relations of hosts after reloading the configuration.
From Camiel Dobbelaar, closes PR 6066
Diffstat (limited to 'usr.sbin/relayd')
-rw-r--r-- | usr.sbin/relayd/hce.c | 10 | ||||
-rw-r--r-- | usr.sbin/relayd/pfe.c | 9 |
2 files changed, 14 insertions, 5 deletions
diff --git a/usr.sbin/relayd/hce.c b/usr.sbin/relayd/hce.c index 2f2dca574c6..d02134ac9a9 100644 --- a/usr.sbin/relayd/hce.c +++ b/usr.sbin/relayd/hce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hce.c,v 1.46 2008/12/05 16:37:55 reyk Exp $ */ +/* $OpenBSD: hce.c,v 1.47 2009/04/17 09:47:06 reyk Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -452,9 +452,8 @@ hce_dispatch_parent(int fd, short event, void * ptr) struct ctl_script scr; ssize_t n; size_t len; - static struct table *table = NULL; - struct host *host; + struct host *host, *parent; ibuf = ptr; switch (event) { @@ -525,6 +524,11 @@ hce_dispatch_parent(int fd, short event, void * ptr) memcpy(&host->conf, imsg.data, sizeof(host->conf)); host->tablename = table->conf.name; TAILQ_INSERT_TAIL(&table->hosts, host, entry); + if (host->conf.parentid) { + parent = host_find(env, host->conf.parentid); + SLIST_INSERT_HEAD(&parent->children, + host, child); + } break; case IMSG_RECONF_END: log_warnx("hce: configuration reloaded"); diff --git a/usr.sbin/relayd/pfe.c b/usr.sbin/relayd/pfe.c index ea290bdd07a..0d1c45831f1 100644 --- a/usr.sbin/relayd/pfe.c +++ b/usr.sbin/relayd/pfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfe.c,v 1.54 2009/04/01 15:05:06 reyk Exp $ */ +/* $OpenBSD: pfe.c,v 1.55 2009/04/17 09:47:06 reyk Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -334,7 +334,7 @@ pfe_dispatch_parent(int fd, short event, void * ptr) static struct rdr *rdr = NULL; static struct table *table = NULL; - struct host *host; + struct host *host, *parent; struct address *virt; ibuf = ptr; @@ -400,6 +400,11 @@ pfe_dispatch_parent(int fd, short event, void * ptr) memcpy(&host->conf, imsg.data, sizeof(host->conf)); host->tablename = table->conf.name; TAILQ_INSERT_TAIL(&table->hosts, host, entry); + if (host->conf.parentid) { + parent = host_find(env, host->conf.parentid); + SLIST_INSERT_HEAD(&parent->children, + host, child); + } break; case IMSG_RECONF_RDR: if ((rdr = calloc(1, sizeof(*rdr))) == NULL) |