aboutsummaryrefslogtreecommitdiff
path: root/contrib/ntp
diff options
context:
space:
mode:
authorHiren Panchasara <hiren@FreeBSD.org>2015-01-14 23:34:00 +0000
committerHiren Panchasara <hiren@FreeBSD.org>2015-01-14 23:34:00 +0000
commita2b8f1cbb71282634311d2abec4b1a16234b2d98 (patch)
tree64ad2255975f9636db22fc451f124e1a4a82ea48 /contrib/ntp
parent3a5ae4edcf1c9319beb28b12aa1e9a94cae6c55a (diff)
downloadsrc-a2b8f1cbb71282634311d2abec4b1a16234b2d98.tar.gz
src-a2b8f1cbb71282634311d2abec4b1a16234b2d98.zip
ntpd tries to bind to IPv6 interfaces in 'tentative' state and fails as IPv6 is
actually disabled. Fix it by making ntpd ignore such interfaces. Submitted by: ume Reviewed by: bz, gnn MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D1527
Notes
Notes: svn path=/head/; revision=277202
Diffstat (limited to 'contrib/ntp')
-rw-r--r--contrib/ntp/ntpd/ntp_io.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/contrib/ntp/ntpd/ntp_io.c b/contrib/ntp/ntpd/ntp_io.c
index c53c68654e11..44e7f806bf82 100644
--- a/contrib/ntp/ntpd/ntp_io.c
+++ b/contrib/ntp/ntpd/ntp_io.c
@@ -1176,12 +1176,13 @@ set_wildcard_reuse(int family, int on)
#ifdef INCLUDE_IPV6_SUPPORT
static isc_boolean_t
-is_anycast(struct sockaddr *sa, char *name)
+is_not_bindable(struct sockaddr *sa, char *name)
{
-#if defined(SIOCGIFAFLAG_IN6) && defined(IN6_IFF_ANYCAST)
+#if defined(SIOCGIFAFLAG_IN6) && \
+ (defined(IN6_IFF_ANYCAST) || defined(IN6_IFF_NOTREADY))
struct in6_ifreq ifr6;
int fd;
- u_int32_t flags6;
+ u_int32_t flags6, exclude = 0;
if (sa->sa_family != AF_INET6)
return ISC_FALSE;
@@ -1197,9 +1198,15 @@ is_anycast(struct sockaddr *sa, char *name)
}
close(fd);
flags6 = ifr6.ifr_ifru.ifru_flags6;
- if ((flags6 & IN6_IFF_ANYCAST) != 0)
+#if defined(IN6_IFF_ANYCAST)
+ exclude |= IN6_IFF_ANYCAST;
+#endif /* !IN6_IFF_ANYCAST */
+#if defined(IN6_IFF_NOTREADY)
+ exclude |= IN6_IFF_NOTREADY;
+#endif /* !IN6_IFF_NOTREADY */
+ if ((flags6 & exclude) != 0)
return ISC_TRUE;
-#endif /* !SIOCGIFAFLAG_IN6 || !IN6_IFF_ANYCAST */
+#endif /* !SIOCGIFAFLAG_IN6 || !(IN6_IFF_ANYCAST && IN6_IFF_NOTREADY) */
return ISC_FALSE;
}
#endif /* !INCLUDE_IPV6_SUPPORT */
@@ -1344,7 +1351,7 @@ update_interfaces(
continue;
#ifdef INCLUDE_IPV6_SUPPORT
- if (is_anycast((struct sockaddr *)&interface.sin, isc_if.name))
+ if (is_not_bindable((struct sockaddr *)&interface.sin, isc_if.name))
continue;
#endif /* !INCLUDE_IPV6_SUPPORT */