From: Willy Tarreau Date: Wed, 26 Aug 2020 08:21:06 +0000 (+0200) Subject: MINOR: tcp: don't try to set/clear v6only on inherited sockets X-Git-Tag: v2.3-dev4~77 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bbb284d6752c94817e37be9a26b5aea92e506612;p=thirdparty%2Fhaproxy.git MINOR: tcp: don't try to set/clear v6only on inherited sockets If a socket was already bound (inherited from a parent or retrieved from a previous process), there's no point trying to change its IPV6_V6ONLY state since it will fail. This is visible in strace as an EINVAL during a reload when passing FDs. --- diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 091772d40a..eb0e6689f7 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -974,9 +974,9 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen) } #endif #if defined(IPV6_V6ONLY) - if (listener->options & LI_O_V6ONLY) + if (!ext && listener->options & LI_O_V6ONLY) setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(one)); - else if (listener->options & LI_O_V4V6) + else if (!ext && listener->options & LI_O_V4V6) setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &zero, sizeof(zero)); #endif