From: Ondřej Surý Date: Mon, 27 Apr 2020 16:57:07 +0000 (+0200) Subject: Use UV_UDP_RECVMMSG to enable mmsg support in libuv if available X-Git-Tag: v9.17.2~109^2~2 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=d5356a40ff17aca187312ac462da1b4e6a3c2feb;p=thirdparty%2Fbind9.git Use UV_UDP_RECVMMSG to enable mmsg support in libuv if available --- diff --git a/lib/isc/netmgr/udp.c b/lib/isc/netmgr/udp.c index 80ff77ee23a..48e7328648a 100644 --- a/lib/isc/netmgr/udp.c +++ b/lib/isc/netmgr/udp.c @@ -118,14 +118,18 @@ void isc__nm_async_udplisten(isc__networker_t *worker, isc__netievent_t *ev0) { isc__netievent_udplisten_t *ievent = (isc__netievent_udplisten_t *)ev0; isc_nmsocket_t *sock = ievent->sock; - int r, flags = 0; + int r, uv_bind_flags = 0; + int uv_init_flags = 0; REQUIRE(sock->type == isc_nm_udpsocket); REQUIRE(sock->iface != NULL); REQUIRE(sock->parent != NULL); REQUIRE(sock->tid == isc_nm_tid()); - uv_udp_init(&worker->loop, &sock->uv_handle.udp); +#ifdef UV_UDP_RECVMMSG + uv_init_flags |= UV_UDP_RECVMMSG; +#endif + uv_udp_init_ex(&worker->loop, &sock->uv_handle.udp, uv_init_flags); uv_handle_set_data(&sock->uv_handle.handle, NULL); isc_nmsocket_attach(sock, (isc_nmsocket_t **)&sock->uv_handle.udp.data); @@ -137,11 +141,11 @@ isc__nm_async_udplisten(isc__networker_t *worker, isc__netievent_t *ev0) { } if (sock->iface->addr.type.sa.sa_family == AF_INET6) { - flags = UV_UDP_IPV6ONLY; + uv_bind_flags |= UV_UDP_IPV6ONLY; } r = uv_udp_bind(&sock->uv_handle.udp, - &sock->parent->iface->addr.type.sa, flags); + &sock->parent->iface->addr.type.sa, uv_bind_flags); if (r < 0) { isc__nm_incstats(sock->mgr, sock->statsindex[STATID_BINDFAIL]); }