From: Willy Tarreau Date: Fri, 9 Aug 2024 19:02:24 +0000 (+0200) Subject: MINOR: socket: don't ban all custom families from reuseport X-Git-Tag: v3.1-dev6~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=034974106fc3e15a9eaf243dfbb7c94fd86caa83;p=thirdparty%2Fhaproxy.git MINOR: socket: don't ban all custom families from reuseport 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. --- diff --git a/src/sock.c b/src/sock.c index 867a0ed76e..c857820df3 100644 --- a/src/sock.c +++ b/src/sock.c @@ -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;