]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: listener: always fill the source address for accepted socketpairs
authorWilly Tarreau <w@1wt.eu>
Sun, 27 Jan 2019 17:34:12 +0000 (18:34 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 27 Jan 2019 20:48:29 +0000 (21:48 +0100)
The source address was not set but passed down the chain to the upper
layer's accept() calls. Let's initialize it like other UNIX sockets in
this case. At the moment it should not have any impact since socketpairs
are only usable for the master CLI.

This should be backported to 1.9.

src/listener.c

index 9a79e6aba3848c53e85098888ed8a0b6502e5ec0..553607af7621e7d7bd5a3d3ef3ce2541e45b8f03 100644 (file)
@@ -545,6 +545,9 @@ void listener_accept(int fd)
                if (unlikely(l->addr.ss_family == AF_CUST_SOCKPAIR)) {
                        if ((cfd = recv_fd_uxst(fd)) != -1)
                                fcntl(cfd, F_SETFL, O_NONBLOCK);
+                       /* just like with UNIX sockets, only the family is filled */
+                       addr.ss_family = AF_UNIX;
+                       laddr = sizeof(addr.ss_family);
                } else
 
 #ifdef USE_ACCEPT4