]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use UV_UDP_RECVMMSG to enable mmsg support in libuv if available
authorOndřej Surý <ondrej@isc.org>
Mon, 27 Apr 2020 16:57:07 +0000 (18:57 +0200)
committerWitold Kręcicki <wpk@isc.org>
Thu, 30 Apr 2020 15:30:37 +0000 (17:30 +0200)
lib/isc/netmgr/udp.c

index 80ff77ee23a98473b0a96e16673532058a488d05..48e7328648a1864d1f7070da692796f0f6f5147a 100644 (file)
@@ -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]);
        }