Blame SOURCES/ntp-4.2.6p5-mcastjoin.patch

6e16f6
diff -up ntp-4.2.6p5/ntpd/ntp_io.c.mcastjoin ntp-4.2.6p5/ntpd/ntp_io.c
6e16f6
--- ntp-4.2.6p5/ntpd/ntp_io.c.mcastjoin	2015-04-13 14:41:59.108323479 +0200
6e16f6
+++ ntp-4.2.6p5/ntpd/ntp_io.c	2015-04-13 14:43:46.468637433 +0200
6e16f6
@@ -2038,6 +2038,32 @@ update_interfaces(
6e16f6
 	if (sys_bclient)
6e16f6
 		io_setbclient();
6e16f6
 
6e16f6
+	/*
6e16f6
+	 * Check multicast interfaces and try to join multicast groups if
6e16f6
+	 * not joined yet.
6e16f6
+	 */
6e16f6
+	for (ep = ep_list; ep != NULL; ep = ep->elink) {
6e16f6
+		remaddr_t *entry;
6e16f6
+
6e16f6
+		if (!(INT_MCASTIF & ep->flags) || (INT_MCASTOPEN & ep->flags))
6e16f6
+			continue;
6e16f6
+
6e16f6
+		/* Find remote address that was linked to this interface */
6e16f6
+		for (entry = remoteaddr_list;
6e16f6
+		     entry != NULL;
6e16f6
+		     entry = entry->link) {
6e16f6
+			if (entry->ep == ep) {
6e16f6
+				if (socket_multicast_enable(ep, &entry->addr)) {
6e16f6
+					msyslog(LOG_INFO,
6e16f6
+						"Joined %s socket to multicast group %s",
6e16f6
+						stoa(&ep->sin),
6e16f6
+						stoa(&entry->addr));
6e16f6
+				}
6e16f6
+				break;
6e16f6
+			}
6e16f6
+		}
6e16f6
+	}
6e16f6
+
6e16f6
 	return new_interface_found;
6e16f6
 }
6e16f6
 
6e16f6
@@ -2467,12 +2493,12 @@ socket_multicast_enable(
6e16f6
 			       IP_ADD_MEMBERSHIP,
6e16f6
 			       (char *)&mreq, 
6e16f6
 			       sizeof(mreq))) {
6e16f6
-			msyslog(LOG_ERR,
6e16f6
+			DPRINTF(2, (
6e16f6
 				"setsockopt IP_ADD_MEMBERSHIP failed: %m on socket %d, addr %s for %x / %x (%s)",
6e16f6
 				iface->fd, stoa(&iface->sin),
6e16f6
 				mreq.imr_multiaddr.s_addr,
6e16f6
 				mreq.imr_interface.s_addr,
6e16f6
-				stoa(maddr));
6e16f6
+				stoa(maddr)));
6e16f6
 			return ISC_FALSE;
6e16f6
 		}
6e16f6
 		DPRINTF(4, ("Added IPv4 multicast membership on socket %d, addr %s for %x / %x (%s)\n",
6e16f6
@@ -2497,10 +2523,10 @@ socket_multicast_enable(
6e16f6
 		if (setsockopt(iface->fd, IPPROTO_IPV6,
6e16f6
 			       IPV6_JOIN_GROUP, (char *)&mreq6, 
6e16f6
 			       sizeof(mreq6))) {
6e16f6
-			msyslog(LOG_ERR,
6e16f6
+			DPRINTF(2, (
6e16f6
 				"setsockopt IPV6_JOIN_GROUP failed: %m on socket %d, addr %s for interface %u (%s)",
6e16f6
 				iface->fd, stoa(&iface->sin),
6e16f6
-				mreq6.ipv6mr_interface, stoa(maddr));
6e16f6
+				mreq6.ipv6mr_interface, stoa(maddr)));
6e16f6
 			return ISC_FALSE;
6e16f6
 		}
6e16f6
 		DPRINTF(4, ("Added IPv6 multicast group on socket %d, addr %s for interface %u (%s)\n",
6e16f6
@@ -2793,11 +2819,6 @@ io_multicast_add(
6e16f6
 				"Joined %s socket to multicast group %s",
6e16f6
 				stoa(&ep->sin),
6e16f6
 				stoa(addr));
6e16f6
-		else
6e16f6
-			msyslog(LOG_ERR,
6e16f6
-				"Failed to join %s socket to multicast group %s",
6e16f6
-				stoa(&ep->sin),
6e16f6
-				stoa(addr));
6e16f6
 	}
6e16f6
 
6e16f6
 	add_addr_to_list(addr, one_ep);