18526836 ntpd complains about invalid argument for IPv6 interface
authorBrian Utterback <brian.utterback@oracle.com>
Tue, 15 Jul 2014 07:20:42 -0700
changeset 2001 94f18110af7b
parent 2000 a55999d4dec9
child 2002 5d0b96773c16
18526836 ntpd complains about invalid argument for IPv6 interface
components/ntp/patches/80-ipv6-einval.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ntp/patches/80-ipv6-einval.patch	Tue Jul 15 07:20:42 2014 -0700
@@ -0,0 +1,71 @@
+This patch inserts if_nametoindex calls in each of the internal ISC
+routines that lookup the interface attributes. Neither getifaddrs or
+the existing ioctl calls lookup the index for the interface.
+
+This has been submitted as a patch for NTP bug 1960, and it can be
+removed when NTP is upgraded to version that includes a fix for 
+1960.
+
+--- lib/isc/unix/ifiter_getifaddrs.c
++++ lib/isc/unix/ifiter_getifaddrs.c
+@@ -204,6 +204,9 @@ internal_current(isc_interfaceiter_t *it
+ 		get_addr(family, &iter->current.broadcast, ifa->ifa_broadaddr,
+ 			 ifa->ifa_name);
+ 
++#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
++	iter->current.ifindex = if_nametoindex(iter->current.name);
++#endif
+ 	return (ISC_R_SUCCESS);
+ }
+ 
+--- lib/isc/unix/ifiter_ioctl.c
++++ lib/isc/unix/ifiter_ioctl.c
+@@ -588,6 +588,9 @@ internal_current4(isc_interfaceiter_t *i
+ 		}
+ 		iter->current.netmask.type.in6.s6_addr[i] = (~0 << bits) & 0xff;
+ 	}
++#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
++	iter->current.ifindex = if_nametoindex(iter->current.name);
++#endif
+ 	return (ISC_R_SUCCESS);
+ 
+  inet:
+@@ -664,6 +667,9 @@ internal_current4(isc_interfaceiter_t *i
+ 	}
+ 	get_addr(family, &iter->current.netmask,
+ 		 (struct sockaddr *)&ifreq.ifr_addr, ifreq.ifr_name);
++#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
++	iter->current.ifindex = if_nametoindex(iter->current.name);
++#endif
+ 	return (ISC_R_SUCCESS);
+ }
+ 
+@@ -704,7 +710,6 @@ internal_current6(isc_interfaceiter_t *i
+ 	get_addr(family, &iter->current.address,
+ 		 (struct sockaddr *)&lifreq.lifr_addr, lifreq.lifr_name);
+ 
+-	iter->current.ifindex = lifreq.lifr_index;
+ 	if (isc_netaddr_islinklocal(&iter->current.address))
+ 		isc_netaddr_setzone(&iter->current.address, 
+ 				    (isc_uint32_t)lifreq.lifr_index);
+@@ -844,7 +849,9 @@ internal_current6(isc_interfaceiter_t *i
+ 			iter->current.netmask.type.in6.s6_addr[i / 8] =
+ 				(~0 << bits) & 0xff;
+ 		}
+-
++#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
++		iter->current.ifindex = if_nametoindex(iter->current.name);
++#endif
+ 		return (ISC_R_SUCCESS);
+ 	}
+ #endif
+@@ -867,6 +874,9 @@ internal_current6(isc_interfaceiter_t *i
+ 	get_addr(family, &iter->current.netmask,
+ 		 (struct sockaddr *)&lifreq.lifr_addr, lifreq.lifr_name);
+ 
++#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
++	iter->current.ifindex = if_nametoindex(iter->current.name);
++#endif
+ 	return (ISC_R_SUCCESS);
+ }
+ #endif