Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > e8c0b673ea1b7e162bcac8e349d03cea > files > 20

ntp-4.2.2p1-15.el5_7.1.src.rpm

diff -up ntp-4.2.2p1/ntpd/ntp_io.c.multicast ntp-4.2.2p1/ntpd/ntp_io.c
--- ntp-4.2.2p1/ntpd/ntp_io.c.multicast	2008-05-06 16:29:08.000000000 +0200
+++ ntp-4.2.2p1/ntpd/ntp_io.c	2008-05-06 17:13:39.000000000 +0200
@@ -2668,9 +2668,24 @@ findlocalcastinterface(
 {
 	int i;
 	int nif = -1;
-
 #ifdef INCLUDE_IPV6_MULTICAST_SUPPORT
 	isc_boolean_t want_linklocal = ISC_FALSE; 
+#endif
+
+	/*
+	 * see how kernel maps the mcast address
+	 */
+        nif = findlocalinterface(addr);
+
+	if (nif >= 0) {
+#ifdef DEBUG
+		if (debug>2)
+			printf("findlocalcastinterface: kernel recommends interface #%d %s\n", nif, inter_list[nif].name);
+#endif
+		return nif;
+	}
+
+#ifdef INCLUDE_IPV6_MULTICAST_SUPPORT
 	if (addr_ismulticast(addr) && flags == INT_MULTICAST)
 	{
 		if (IN6_IS_ADDR_MC_LINKLOCAL(&((struct sockaddr_in6*)addr)->sin6_addr))
@@ -2746,22 +2761,16 @@ findbcastinter(
 		   stoa(addr));
 #endif
 
-	i = find_flagged_addr_in_list(addr, INT_BCASTOPEN|INT_MCASTOPEN);
+	i = findlocalinterface(addr);
+	if (i >= nwilds && !(inter_list[i].flags & INT_LOOPBACK))
+	{
 #ifdef DEBUG
-	if (debug > 1)
-		printf("Found bcastinter index %d\n", i);
+		if (debug > 1)
+			printf("Found bcastinter index %d\n", i);
 #endif
-		/*
-		 * Do nothing right now
-		 * Eventually we will find the interface this
-		 * way, but until it works properly we just see
-		 * which one we got
-		 */
-/*	if(i >= 0)
-	{
 		return (&inter_list[i]);
 	}
-*/
+
 	for (i = nwilds; i < ninterfaces; i++) {
 		/* Don't bother with ignored interfaces */
 		if (inter_list[i].ignore_packets == ISC_TRUE)