From: Baptiste Assmann Date: Thu, 2 Feb 2017 22:14:51 +0000 (+0100) Subject: BUG/MAJOR: dns: restart sockets after fork() X-Git-Tag: v1.8-dev1~144 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26c6eb8;p=thirdparty%2Fhaproxy.git BUG/MAJOR: dns: restart sockets after fork() UDP sockets used to send DNS queries are created before fork happens and this is a big problem because all the processes (in case of a configuration starting multiple processes) share the same socket. Some processes may consume responses dedicated to an other one, some servers may be disabled, some IPs changed, etc... As a workaround, this patch close the existing socket and create a new one after the fork() has happened. [wt: backport this to 1.7] --- diff --git a/src/haproxy.c b/src/haproxy.c index 6a8b5c2450..41be9cdfa3 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1950,6 +1950,10 @@ int main(int argc, char **argv) fork_poller(); } + /* initialize structures for name resolution */ + if (!dns_init_resolvers(1)) + exit(1); + protocol_enable_all(); /* * That's it : the central polling loop. Run until we stop.