summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-scope.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-08-01 19:48:02 +0200
committerLennart Poettering <lennart@poettering.net>2014-08-01 20:27:27 +0200
commit7b4c2ee75faf08b7a415337b46efc670f986128a (patch)
treeecf7889f28ecd369c8c155223b73f937b3e71712 /src/resolve/resolved-dns-scope.c
parent747c0ff5648b707abb601f58eefcfd92a7d41695 (diff)
resolved: always drop multicast membership before adding one
This is apparently necessary on some devices, such as veth.
Diffstat (limited to 'src/resolve/resolved-dns-scope.c')
-rw-r--r--src/resolve/resolved-dns-scope.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c
index 291d0356be..8d03049c10 100644
--- a/src/resolve/resolved-dns-scope.c
+++ b/src/resolve/resolved-dns-scope.c
@@ -353,6 +353,12 @@ int dns_scope_llmnr_membership(DnsScope *s, bool b) {
if (fd < 0)
return fd;
+ /* Always first try to drop membership before we add
+ * one. This is necessary on some devices, such as
+ * veth. */
+ if (b)
+ setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreqn, sizeof(mreqn));
+
if (setsockopt(fd, IPPROTO_IP, b ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP, &mreqn, sizeof(mreqn)) < 0)
return -errno;
@@ -366,6 +372,9 @@ int dns_scope_llmnr_membership(DnsScope *s, bool b) {
if (fd < 0)
return fd;
+ if (b)
+ setsockopt(fd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, &mreq, sizeof(mreq));
+
if (setsockopt(fd, IPPROTO_IPV6, b ? IPV6_ADD_MEMBERSHIP : IPV6_DROP_MEMBERSHIP, &mreq, sizeof(mreq)) < 0)
return -errno;
} else