From 5caf33feda92617e18514633cadaae60e934101f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 4 Dec 2020 13:19:44 +0100 Subject: [PATCH] Fix HAVE_SO_REUSEPORT_LB macro name definition A typo in macro definition caused the load-balanced sockets to be disabled even on platforms with existing support for load-balanced sockets. --- lib/isc/netmgr/netmgr-int.h | 2 +- lib/isc/netmgr/tcp.c | 2 ++ lib/isc/netmgr/tcpdns.c | 2 ++ lib/isc/netmgr/udp.c | 4 +++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/isc/netmgr/netmgr-int.h b/lib/isc/netmgr/netmgr-int.h index f54f590f89..c6a0da0a72 100644 --- a/lib/isc/netmgr/netmgr-int.h +++ b/lib/isc/netmgr/netmgr-int.h @@ -53,7 +53,7 @@ #endif #if defined(SO_REUSEPORT_LB) || (defined(SO_REUSEPORT) && defined(__linux__)) -#define HAVE_REUSEPORT_LB 1 +#define HAVE_SO_REUSEPORT_LB 1 #endif /* diff --git a/lib/isc/netmgr/tcp.c b/lib/isc/netmgr/tcp.c index 5dc121f655..24f43c9856 100644 --- a/lib/isc/netmgr/tcp.c +++ b/lib/isc/netmgr/tcp.c @@ -406,7 +406,9 @@ isc_nm_listentcp(isc_nm_t *mgr, isc_nmiface_t *iface, isc_nmsocket_t *sock = NULL; sa_family_t sa_family = iface->addr.type.sa.sa_family; size_t children_size = 0; +#if !HAVE_SO_REUSEPORT_LB && !defined(WIN32) uv_os_sock_t fd = -1; +#endif REQUIRE(VALID_NM(mgr)); diff --git a/lib/isc/netmgr/tcpdns.c b/lib/isc/netmgr/tcpdns.c index f52cbca3e9..1372b63573 100644 --- a/lib/isc/netmgr/tcpdns.c +++ b/lib/isc/netmgr/tcpdns.c @@ -450,7 +450,9 @@ isc_nm_listentcpdns(isc_nm_t *mgr, isc_nmiface_t *iface, isc_nmsocket_t *sock = NULL; sa_family_t sa_family = iface->addr.type.sa.sa_family; size_t children_size = 0; +#if !HAVE_SO_REUSEPORT_LB && !defined(WIN32) uv_os_sock_t fd = -1; +#endif REQUIRE(VALID_NM(mgr)); diff --git a/lib/isc/netmgr/udp.c b/lib/isc/netmgr/udp.c index f69f6feb19..411b8deacf 100644 --- a/lib/isc/netmgr/udp.c +++ b/lib/isc/netmgr/udp.c @@ -106,7 +106,9 @@ isc_nm_listenudp(isc_nm_t *mgr, isc_nmiface_t *iface, isc_nm_recv_cb_t cb, isc_nmsocket_t *sock = NULL; sa_family_t sa_family = iface->addr.type.sa.sa_family; size_t children_size = 0; +#if !HAVE_SO_REUSEPORT_LB && !defined(WIN32) uv_os_sock_t fd = -1; +#endif REQUIRE(VALID_NM(mgr)); @@ -269,7 +271,7 @@ isc__nm_async_udplisten(isc__networker_t *worker, isc__netievent_t *ev0) { uv_bind_flags |= UV_UDP_IPV6ONLY; } -#if HAVE_SO_REUSEPORT_LB || WIN32 +#if HAVE_SO_REUSEPORT_LB || defined(WIN32) r = isc_uv_udp_freebind(&sock->uv_handle.udp, &sock->parent->iface->addr.type.sa, uv_bind_flags);