diff options
author | Omar Polo <op@omarpolo.com> | 2023-06-24 09:14:35 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2023-06-24 09:14:35 +0000 |
commit | a0a42860d214974f2706d2a47203af9bc884f512 (patch) | |
tree | 74152b852ad2e5f9f4b1fd20ff015b4f51d47a95 /config.c | |
parent | 9fda962861db6c2322384e64fc737f25d4314d66 (diff) |
send host addresses to the server process
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -307,6 +307,7 @@ config_send(struct conf *conf) TAILQ_FOREACH(h, &conf->hosts, vhosts) { struct vhost vcopy; + struct address *addr, acopy; memcpy(&vcopy, h, sizeof(vcopy)); vcopy.cert_path = NULL; @@ -329,6 +330,21 @@ config_send(struct conf *conf) return -1; } + TAILQ_FOREACH(addr, &h->addrs, addrs) { + memcpy(&acopy, addr, sizeof(acopy)); + memset(&acopy.addrs, 0, sizeof(acopy.addrs)); + + if (proc_compose(ps, PROC_SERVER, + IMSG_RECONF_HOST_ADDR, &acopy, sizeof(acopy)) + == -1) + return -1; + } + + if (proc_flush_imsg(ps, PROC_SERVER, -1) == -1) { + log_warn("%s: proc_fush_imsg", __func__); + return -1; + } + TAILQ_FOREACH(l, &h->locations, locations) { struct location lcopy; int fd = -1; @@ -598,6 +614,16 @@ config_recv(struct conf *conf, struct imsg *imsg) h->domain); break; + case IMSG_RECONF_HOST_ADDR: + log_debug("receiving host addr"); + if (h == NULL) + fatalx("recv'd host address withouth host"); + IMSG_SIZE_CHECK(imsg, addr); + addr = xcalloc(1, sizeof(*addr)); + memcpy(addr, imsg->data, datalen); + TAILQ_INSERT_TAIL(&h->addrs, addr, addrs); + break; + case IMSG_RECONF_LOC: if (h == NULL) fatalx("recv'd location without host"); |