From 142c63dda8ada1214ea8f308a0d28fcff2d94cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 5 Apr 2022 01:20:13 +0200 Subject: [PATCH] Enable the load-balance-sockets configuration Previously, HAVE_SO_REUSEPORT_LB has been defined only in the private netmgr-int.h header file, making the configuration of load balanced sockets inoperable. Move the missing HAVE_SO_REUSEPORT_LB define the isc/netmgr.h and add missing isc_nm_getloadbalancesockets() implementation. --- bin/named/config.c | 1 + bin/named/server.c | 1 + lib/isc/include/isc/netmgr.h | 9 +++++++++ lib/isc/netmgr/netmgr-int.h | 4 ---- lib/isc/netmgr/netmgr.c | 7 +++++++ 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/bin/named/config.c b/bin/named/config.c index b165b42103..e5599bc89c 100644 --- a/bin/named/config.c +++ b/bin/named/config.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/bin/named/server.c b/bin/named/server.c index db46a0b305..949460e9df 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/isc/include/isc/netmgr.h b/lib/isc/include/isc/netmgr.h index 3f0e080b0f..0ae582a0b5 100644 --- a/lib/isc/include/isc/netmgr.h +++ b/lib/isc/include/isc/netmgr.h @@ -13,12 +13,21 @@ #pragma once +#include + #include #include #include #include #include +#include +#include + +#if defined(SO_REUSEPORT_LB) || (defined(SO_REUSEPORT) && defined(__linux__)) +#define HAVE_SO_REUSEPORT_LB 1 +#endif + /* * Replacement for isc_sockettype_t provided by socket.h. */ diff --git a/lib/isc/netmgr/netmgr-int.h b/lib/isc/netmgr/netmgr-int.h index ccc1bc3fdd..5ff067a425 100644 --- a/lib/isc/netmgr/netmgr-int.h +++ b/lib/isc/netmgr/netmgr-int.h @@ -111,10 +111,6 @@ STATIC_ASSERT(ISC_NETMGR_TCP_RECVBUF_SIZE <= ISC_NETMGR_RECVBUF_SIZE, */ #define NM_MAXSEG (1280 - 20 - 40) -#if defined(SO_REUSEPORT_LB) || (defined(SO_REUSEPORT) && defined(__linux__)) -#define HAVE_SO_REUSEPORT_LB 1 -#endif - /* * Define NETMGR_TRACE to activate tracing of handles and sockets. * This will impair performance but enables us to quickly determine, diff --git a/lib/isc/netmgr/netmgr.c b/lib/isc/netmgr/netmgr.c index 07cf586422..c52094350f 100644 --- a/lib/isc/netmgr/netmgr.c +++ b/lib/isc/netmgr/netmgr.c @@ -578,6 +578,13 @@ isc_nm_setnetbuffers(isc_nm_t *mgr, int32_t recv_tcp, int32_t send_tcp, atomic_store(&mgr->send_udp_buffer_size, send_udp); } +bool +isc_nm_getloadbalancesockets(isc_nm_t *mgr) { + REQUIRE(VALID_NM(mgr)); + + return (mgr->load_balance_sockets); +} + void isc_nm_setloadbalancesockets(isc_nm_t *mgr, bool enabled) { REQUIRE(VALID_NM(mgr));