]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Enable the load-balance-sockets configuration
authorOndřej Surý <ondrej@isc.org>
Mon, 4 Apr 2022 23:20:13 +0000 (01:20 +0200)
committerOndřej Surý <ondrej@isc.org>
Mon, 4 Apr 2022 23:30:58 +0000 (01:30 +0200)
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
bin/named/server.c
lib/isc/include/isc/netmgr.h
lib/isc/netmgr/netmgr-int.h
lib/isc/netmgr/netmgr.c

index b165b421038f781697fdd19bf8512fd9bf38c6c1..e5599bc89c69de7122759d1e6998d6c81cffabae 100644 (file)
@@ -20,6 +20,7 @@
 #include <isc/buffer.h>
 #include <isc/log.h>
 #include <isc/mem.h>
+#include <isc/netmgr.h>
 #include <isc/parseint.h>
 #include <isc/region.h>
 #include <isc/result.h>
index db46a0b305bc5a8d548aaa8e8a057ffcfdc952bc..949460e9dface713db6f1ff8e1110934b55489e1 100644 (file)
@@ -39,6 +39,7 @@
 #include <isc/httpd.h>
 #include <isc/lex.h>
 #include <isc/meminfo.h>
+#include <isc/netmgr.h>
 #include <isc/nonce.h>
 #include <isc/parseint.h>
 #include <isc/portset.h>
index 3f0e080b0f6a53face7d692e75c78850c7886b65..0ae582a0b5b032114f88fe26efdaa4f2a72325d2 100644 (file)
 
 #pragma once
 
+#include <unistd.h>
+
 #include <isc/mem.h>
 #include <isc/region.h>
 #include <isc/result.h>
 #include <isc/tls.h>
 #include <isc/types.h>
 
+#include <sys/socket.h>
+#include <sys/types.h>
+
+#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.
  */
index ccc1bc3fddde5d2f1e8dbbc3b715bcdeec11aa7c..5ff067a425b4f14e9d6d87679ad03f6079d7ad40 100644 (file)
@@ -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,
index 07cf5864229959bcb59a1df75bcbe087e5fdde29..c52094350f01e230db3a33df91d8d654ae243d97 100644 (file)
@@ -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));