]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolve: set IP_RECVERR
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 16 Oct 2018 17:32:26 +0000 (02:32 +0900)
committerLennart Poettering <lennart@poettering.net>
Thu, 18 Oct 2018 07:43:04 +0000 (09:43 +0200)
Closes #10345.

src/resolve/resolved-dns-scope.c

index 57af95c41f868eb23b7a55cd7f17201315478d16..0c96332c75d075547dc3487d0df57b0617eaab6a 100644 (file)
@@ -411,6 +411,13 @@ static int dns_scope_socket(
                 }
         }
 
+        if (type == SOCK_DGRAM) {
+                /* Set IP_RECVERR or IPV6_RECVERR to get ICMP error feedback. See discussion in #10345. */
+                r = setsockopt(fd, SOL_IP, sa.sa.sa_family == AF_INET ? IP_RECVERR : IPV6_RECVERR, &const_int_one, sizeof(const_int_one));
+                if (r < 0)
+                        return -errno;
+        }
+
         if (ret_socket_address)
                 *ret_socket_address = sa;
         else {