mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 06:55:30 +00:00
Abort when libuv at runtime mismatches libuv at compile time
When we compile with libuv that has some capabilities via flags passed to f.e. uv_udp_listen() or uv_udp_bind(), the call with such flags would fail with invalid arguments when older libuv version is linked at the runtime that doesn't understand the flag that was available at the compile time. Enforce minimal libuv version when flags have been available at the compile time, but are not available at the runtime. This check is less strict than enforcing the runtime libuv version to be same or higher than compile time libuv version.
This commit is contained in:
@@ -207,6 +207,18 @@ isc__nm_threadpool_initialize(uint32_t workers) {
|
||||
}
|
||||
}
|
||||
|
||||
#if HAVE_DECL_UV_UDP_LINUX_RECVERR
|
||||
#define MINIMAL_UV_VERSION UV_VERSION(1, 42, 0)
|
||||
#elif HAVE_DECL_UV_UDP_MMSG_FREE
|
||||
#define MINIMAL_UV_VERSION UV_VERSION(1, 40, 0)
|
||||
#elif HAVE_DECL_UV_UDP_RECVMMSG
|
||||
#define MINIMAL_UV_VERSION UV_VERSION(1, 37, 0)
|
||||
#elif HAVE_DECL_UV_UDP_MMSG_CHUNK
|
||||
#define MINIMAL_UV_VERSION UV_VERSION(1, 35, 0)
|
||||
#else
|
||||
#define MINIMAL_UV_VERSION UV_VERSION(1, 0, 0)
|
||||
#endif
|
||||
|
||||
void
|
||||
isc__netmgr_create(isc_mem_t *mctx, uint32_t workers, isc_nm_t **netmgrp) {
|
||||
isc_nm_t *mgr = NULL;
|
||||
@@ -214,6 +226,14 @@ isc__netmgr_create(isc_mem_t *mctx, uint32_t workers, isc_nm_t **netmgrp) {
|
||||
|
||||
REQUIRE(workers > 0);
|
||||
|
||||
if (uv_version() < MINIMAL_UV_VERSION) {
|
||||
isc_error_fatal(__FILE__, __LINE__,
|
||||
"libuv version too old: running with libuv %s "
|
||||
"when compiled with libuv %s will lead to "
|
||||
"libuv failures because of unknown flags",
|
||||
uv_version_string(), UV_VERSION_STRING);
|
||||
}
|
||||
|
||||
isc__nm_threadpool_initialize(workers);
|
||||
|
||||
mgr = isc_mem_get(mctx, sizeof(*mgr));
|
||||
|
Reference in New Issue
Block a user