mirror of
https://github.com/systemd/systemd.git
synced 2024-11-05 06:52:22 +03:00
resolved: always drop multicast membership before adding one
This is apparently necessary on some devices, such as veth.
This commit is contained in:
parent
747c0ff564
commit
7b4c2ee75f
@ -353,6 +353,12 @@ int dns_scope_llmnr_membership(DnsScope *s, bool b) {
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return fd;
|
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)
|
if (setsockopt(fd, IPPROTO_IP, b ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP, &mreqn, sizeof(mreqn)) < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
@ -366,6 +372,9 @@ int dns_scope_llmnr_membership(DnsScope *s, bool b) {
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return fd;
|
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)
|
if (setsockopt(fd, IPPROTO_IPV6, b ? IPV6_ADD_MEMBERSHIP : IPV6_DROP_MEMBERSHIP, &mreq, sizeof(mreq)) < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
} else
|
} else
|
||||||
|
Loading…
Reference in New Issue
Block a user