summaryrefslogtreecommitdiffstats
path: root/src/resolve
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-10-16 19:32:26 +0200
committerLennart Poettering <lennart@poettering.net>2018-10-18 09:43:04 +0200
commit9fcdab9c8747ab092ac120b58de2ee7b1be9d7db (patch)
tree09194125c0f34923eeae03966dbbe052a7a28364 /src/resolve
parentMerge pull request #10438 from poettering/path-is-valid (diff)
downloadsystemd-9fcdab9c8747ab092ac120b58de2ee7b1be9d7db.tar.xz
systemd-9fcdab9c8747ab092ac120b58de2ee7b1be9d7db.zip
resolve: set IP_RECVERR
Closes #10345.
Diffstat (limited to 'src/resolve')
-rw-r--r--src/resolve/resolved-dns-scope.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c
index 57af95c41f..0c96332c75 100644
--- a/src/resolve/resolved-dns-scope.c
+++ b/src/resolve/resolved-dns-scope.c
@@ -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 {