]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
restore reuseport to yes by default on supported platforms
authorColin Vidal <colin@isc.org>
Thu, 30 Oct 2025 14:02:10 +0000 (15:02 +0100)
committerColin Vidal <colin@isc.org>
Fri, 31 Oct 2025 14:11:08 +0000 (15:11 +0100)
Changes introduced by 72862c2abc0bc6e87de08918bf21a7fc8fc4b1f7 moved the
default configuration from within `bin/named` to a central place
`bin/includes`.

The default configuration is conditioned by several compile-time macro.
While for most of them it's fine because they are defined in the global
`config.h` file included by default to all binaries (by meson), one
specific is not defined here. `HAVE_SO_REUSEPORT_LB` was defined in
`lib/isc/include/isc/netmgr.h` which is of course not included in
`bin/includes/defaultconfig.h`.

As a result, reuseport was disabled for all platform by default, even
the supported ones. This fixes the problem by checking if reuseport is
available on the platform from meson `config.h` generation directly,
which makes `HAVE_SO_REUSEPORT_LB` available everywhere.

lib/isc/include/isc/netmgr.h
meson.build

index fcb75873cec659831dbf0277d94c47e9d54bd494..c62231b6dd574ad89ed24699e18725119c6b29f9 100644 (file)
 
 /* Add -DISC_NETMGR_TRACE=1 to CFLAGS for detailed reference tracing */
 
-#if defined(SO_REUSEPORT_LB) || (defined(SO_REUSEPORT) && defined(__linux__))
-#define HAVE_SO_REUSEPORT_LB 1
-#endif
-
 /*
  * Convenience macros to specify on how many threads should socket listen
  */
index d618d074763941c38f0349fe8027a40c46c21567..259064397e7beefa531d4d4b3886a19b755a4c1e 100644 (file)
@@ -657,6 +657,13 @@ else
     message('likely non-glibc on linux, disabling recvmmsg')
 endif
 
+## detect reuseport
+if cc.has_header_symbol('sys/socket.h', 'SO_REUSEPORT') and host_machine.system() == 'linux'
+    config.set('HAVE_SO_REUSEPORT_LB', 1)
+elif cc.has_header_symbol('sys/socket.h', 'SO_REUSEPORT_LB')
+    config.set('HAVE_SO_REUSEPORT_LB', 1)
+endif
+
 ## userspace-rcu
 urcu_dep = [dependency('liburcu-cds', version: '>=0.10.0')]
 if rcu_flavor == 'membarrier'