]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: socket: don't ban all custom families from reuseport
authorWilly Tarreau <w@1wt.eu>
Fri, 9 Aug 2024 19:02:24 +0000 (21:02 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 21 Aug 2024 15:37:46 +0000 (17:37 +0200)
The test on ss_family >= AF_MAX is too strict if we want to support new
custom families, let's apply this to the real_family instead so that we
check that the underlying socket supports reuseport.

src/sock.c

index 867a0ed76e7d499bc0820158de8ba94cb6299b17..c857820df3bb61279978fe7ad2c8901914b088f7 100644 (file)
@@ -1150,7 +1150,7 @@ int _sock_supports_reuseport(const struct proto_fam *fam, int type, int protocol
        fd1 = fd2 = -1;
 
        /* ignore custom sockets */
-       if (!fam || fam->sock_family >= AF_MAX)
+       if (!fam || real_family(fam->sock_family) >= AF_MAX)
                goto leave;
 
        fd1 = socket(fam->sock_domain, type, protocol);
@@ -1162,7 +1162,7 @@ int _sock_supports_reuseport(const struct proto_fam *fam, int type, int protocol
 
        /* bind to any address assigned by the kernel, we'll then try to do it twice */
        memset(&ss, 0, sizeof(ss));
-       ss.ss_family = fam->sock_family;
+       ss.ss_family = real_family(fam->sock_family);
        if (bind(fd1, (struct sockaddr *)&ss, fam->sock_addrlen) < 0)
                goto leave;