]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: dns: Broken kqueue events handling (BSD systems).
authorFrédéric Lécaille <flecaille@haproxy.com>
Fri, 12 May 2017 07:57:15 +0000 (09:57 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 12 May 2017 13:49:05 +0000 (15:49 +0200)
Some DNS related network sockets were closed without unregistering their file
descriptors from their underlying kqueue event sets. This patch replaces calls to
close() by fd_delete() calls to that to delete such events attached to DNS
network sockets from the kqueue before closing the sockets.

The bug was introduced by commit 26c6eb8 ("BUG/MAJOR: dns: restart sockets
after fork()") which was backported in 1.7 so this fix has to be backported
there as well.

Thanks to Jim Pingle who reported it and indicated the faulty commit, and
to Lukas Tribus for the trace showing the bad file descriptor.

src/dns.c

index a118598f9382b17cf80e283ae6045255f224b256..cb0a9a95d5c9f3a506b4d3ac5e03d6a964e42644 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -1004,7 +1004,7 @@ int dns_init_resolvers(int close_socket)
 
                        if (close_socket == 1) {
                                if (curnameserver->dgram) {
-                                       close(curnameserver->dgram->t.sock.fd);
+                                       fd_delete(curnameserver->dgram->t.sock.fd);
                                        memset(curnameserver->dgram, '\0', sizeof(*dgram));
                                        dgram = curnameserver->dgram;
                                }