[pkg-ntp-maintainers] Bug#584927: ntp does not send to ipv6 multicast

Joerg Dorchain joerg at dorchain.net
Mon Jun 7 15:53:56 UTC 2010


Package: ntp
Version: 1:4.2.6+dfsg-1
Tags: ipv6, upstream, patch

Hello,

playing with ntp ipv6 multicast, I discovered that ntp just
doesn't detect multicast capabilities for ipv6 interfaces,
reverting the the unspecified (::) address for sending packets,
which the kernel does not allow (it does not make sense anyway).

The following patch is basically a rewrite of
https://support.ntp.org/bugs/attachment.cgi?id=296, belonging to
https://support.ntp.org/bugs/show_bug.cgi?format=multiple&id=715
supposed to be fixed in 2006. (Deja-vu-Bug)

Management Summary:
Makes ntp.conf line broadcast ff05::101 work.

Please consider adding.

Bye,

Joerg


--- lib/isc/unix/interfaceiter.c.orig	2010-06-07 17:12:55.000000000 +0200
+++ lib/isc/unix/interfaceiter.c	2010-06-07 17:28:48.000000000 +0200
@@ -185,8 +185,10 @@
 linux_if_inet6_current(isc_interfaceiter_t *iter) {
 	char address[33];
 	char name[IF_NAMESIZE+1];
+	char strbuf[ISC_STRERRORSIZE];
 	struct in6_addr addr6;
-	int ifindex, prefix, flag3, flag4;
+	int ifindex, prefix, scope, flags;
+	struct ifreq ifreq;
 	int res;
 	unsigned int i;
 
@@ -200,7 +202,7 @@
 	}
 
 	res = sscanf(iter->entry, "%32[a-f0-9] %x %x %x %x %16s\n",
-		     address, &ifindex, &prefix, &flag3, &flag4, name);
+		     address, &ifindex, &prefix, &scope, &flags, name);
 	if (res != 6) {
 		isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
 			      ISC_LOGMODULE_INTERFACE, ISC_LOG_ERROR,
@@ -222,7 +224,34 @@
 		addr6.s6_addr[i] = byte;
 	}
 	iter->current.af = AF_INET6;
-	iter->current.flags = INTERFACE_F_UP;
+	iter->current.flags = 0;
+	memset(&ifreq, 0, sizeof(ifreq));
+	INSIST(sizeof(ifreq.ifr_name) <= sizeof(iter->current.name));
+	strncpy(ifreq.ifr_name, name, sizeof(ifreq.ifr_name));
+
+	if (ioctl(iter->socket, SIOCGIFFLAGS, (char *) &ifreq) < 0) {
+		isc__strerror(errno, strbuf, sizeof(strbuf));
+		UNEXPECTED_ERROR(__FILE__, __LINE__,
+				"%s: getting interface flags: %s",
+				ifreq.ifr_name, strbuf);
+		return (ISC_R_IGNORE);
+	}
+
+	if ((ifreq.ifr_flags & IFF_UP) != 0)
+		iter->current.flags |= INTERFACE_F_UP;
+#ifdef IFF_POINTOPOINT
+	if ((ifreq.ifr_flags & IFF_POINTOPOINT) != 0)
+		iter->current.flags |= INTERFACE_F_POINTTOPOINT;
+#endif
+	if ((ifreq.ifr_flags & IFF_LOOPBACK) != 0)
+		iter->current.flags |= INTERFACE_F_LOOPBACK;
+	if ((ifreq.ifr_flags & IFF_BROADCAST) != 0)
+		iter->current.flags |= INTERFACE_F_BROADCAST;
+#ifdef IFF_MULTICAST
+	if ((ifreq.ifr_flags & IFF_MULTICAST) != 0)
+		iter->current.flags |= INTERFACE_F_MULTICAST;
+#endif
+
 	isc_netaddr_fromin6(&iter->current.address, &addr6);
 	if (isc_netaddr_islinklocal(&iter->current.address)) {
 		isc_netaddr_setzone(&iter->current.address,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 267 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-ntp-maintainers/attachments/20100607/9f4e49ee/attachment.pgp>


More information about the pkg-ntp-maintainers mailing list