]> git.meshlink.io Git - catta/commitdiff
add membership hack for IPv6, too
authorLennart Poettering <lennart@poettering.net>
Fri, 10 Feb 2006 01:45:09 +0000 (01:45 +0000)
committerLennart Poettering <lennart@poettering.net>
Fri, 10 Feb 2006 01:45:09 +0000 (01:45 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1132 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-core/socket.c

index 444be6e5f81e91449b6219b3c57916faf17fa31c..82622d3bd0ffed5f6c7a64000af6908459b92386 100644 (file)
@@ -125,8 +125,11 @@ int avahi_mdns_mcast_join_ipv4(int fd, const AvahiIPv4Address *a, int idx, int j
     mdns_mcast_group_ipv4(&sa);
     mreq.imr_multiaddr = sa.sin_addr;
 
+    /* Some network drivers have issues with dropping membership of
+     * mcast groups when the iface is down, but don't allow rejoining
+     * when it comes back up. This is an ugly workaround */
     if (join)
-      setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq));
+        setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq));
 
     if (setsockopt(fd, IPPROTO_IP, join ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) {
         avahi_log_warn("%s failed: %s", join ? "IP_ADD_MEMBERSHIP" : "IP_DROP_MEMBERSHIP", strerror(errno));
@@ -149,6 +152,9 @@ int avahi_mdns_mcast_join_ipv6(int fd, const AvahiIPv6Address *a, int idx, int j
     mreq6.ipv6mr_multiaddr = sa6.sin6_addr;
     mreq6.ipv6mr_interface = idx;
 
+    if (join)
+        setsockopt(fd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, &mreq6, sizeof(mreq6));
+    
     if (setsockopt(fd, IPPROTO_IPV6, join ? IPV6_ADD_MEMBERSHIP : IPV6_DROP_MEMBERSHIP, &mreq6, sizeof(mreq6)) < 0) {
         avahi_log_warn("%s failed: %s", join ? "IPV6_ADD_MEMBERSHIP" : "IPV6_DROP_MEMBERSHIP", strerror(errno));
         return -1;