]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Set IP(V6)_RECVERR on connect UDP sockets (via libuv)
authorOndřej Surý <ondrej@isc.org>
Mon, 25 Apr 2022 12:09:44 +0000 (14:09 +0200)
committerOndřej Surý <ondrej@isc.org>
Tue, 26 Apr 2022 10:22:18 +0000 (12:22 +0200)
The connect()ed UDP socket provides feedback on a variety of ICMP
errors (eg port unreachable) which bind can then use to decide what to
do with errors (report them to the client, try again with a different
nameserver etc).  However, Linux's implementation does not report what
it considers "transient" conditions, which is defined as Destination
host Unreachable, Destination network unreachable, Source Route Failed
and Message Too Big.

Explicitly enable IP_RECVERR / IPV6_RECVERR (via libuv uv_udp_bind()
flag) to learn about ICMP destination network/host unreachable.

configure.ac
lib/isc/netmgr/udp.c

index 072f535a84dd07561b7f3b1ade5cddeba3c9d8fe..9b29cb4901d2b232b86a2a5dd85b4a0f76024ef0 100644 (file)
@@ -562,6 +562,9 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/socket.h>],
                  [AC_MSG_RESULT([no])
                   AC_CHECK_DECLS([UV_UDP_RECVMMSG], [], [], [[#include <uv.h>]])])
 
+# libuv recverr support
+AC_CHECK_DECLS([UV_UDP_LINUX_RECVERR], [], [], [[#include <uv.h>]])
+
 # [pairwise: --enable-doh --with-libnghttp2=auto, --enable-doh --with-libnghttp2=yes, --disable-doh]
 AC_ARG_ENABLE([doh],
              [AS_HELP_STRING([--disable-doh], [enable DNS over HTTPS, requires libnghttp2 (default=yes)])],
index 4c0848fdeaa10171b0da4a13694fec042373d7f7..29a603a0dd2c8b8c8273dacc5788591e673dfb5c 100644 (file)
@@ -882,6 +882,10 @@ udp_connect_direct(isc_nmsocket_t *sock, isc__nm_uvreq_t *req) {
                uv_bind_flags |= UV_UDP_IPV6ONLY;
        }
 
+#if HAVE_DECL_UV_UDP_LINUX_RECVERR
+       uv_bind_flags |= UV_UDP_LINUX_RECVERR;
+#endif
+
        r = uv_udp_bind(&sock->uv_handle.udp, &sock->iface.type.sa,
                        uv_bind_flags);
        if (r != 0) {