From owner-svn-src-all@FreeBSD.ORG Tue Dec 15 15:01:52 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B10B7106566B; Tue, 15 Dec 2009 15:01:52 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 85E9E8FC28; Tue, 15 Dec 2009 15:01:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBFF1qB9066854; Tue, 15 Dec 2009 15:01:52 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBFF1qhX066852; Tue, 15 Dec 2009 15:01:52 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200912151501.nBFF1qhX066852@svn.freebsd.org> From: Hajimu UMEMOTO Date: Tue, 15 Dec 2009 15:01:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200578 - stable/8/contrib/ntp/ntpd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2009 15:01:52 -0000 Author: ume Date: Tue Dec 15 15:01:52 2009 New Revision: 200578 URL: http://svn.freebsd.org/changeset/base/200578 Log: MFC r199995: Don't try to bind to an anycast address. The KAME IPv6 stack doesn't allow bind to an anycast address. It does away with an annoying message. Modified: stable/8/contrib/ntp/ntpd/ntp_io.c Directory Properties: stable/8/contrib/ntp/ (props changed) Modified: stable/8/contrib/ntp/ntpd/ntp_io.c ============================================================================== --- stable/8/contrib/ntp/ntpd/ntp_io.c Tue Dec 15 14:59:58 2009 (r200577) +++ stable/8/contrib/ntp/ntpd/ntp_io.c Tue Dec 15 15:01:52 2009 (r200578) @@ -65,6 +65,12 @@ #endif /* IPV6 Multicast Support */ #endif /* IPv6 Support */ +#ifdef INCLUDE_IPV6_SUPPORT +#include +#include +#include +#endif /* !INCLUDE_IPV6_SUPPORT */ + extern int listen_to_virtual_ips; extern const char *specific_interface; @@ -1137,6 +1143,36 @@ set_wildcard_reuse(int family, int on) } #endif /* OS_NEEDS_REUSEADDR_FOR_IFADDRBIND */ +#ifdef INCLUDE_IPV6_SUPPORT +static isc_boolean_t +is_anycast(struct sockaddr *sa, char *name) +{ +#if defined(SIOCGIFAFLAG_IN6) && defined(IN6_IFF_ANYCAST) + struct in6_ifreq ifr6; + int fd; + u_int32_t flags6; + + if (sa->sa_family != AF_INET6) + return ISC_FALSE; + if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) + return ISC_FALSE; + memset(&ifr6, 0, sizeof(ifr6)); + memcpy(&ifr6.ifr_addr, (struct sockaddr_in6 *)sa, + sizeof(struct sockaddr_in6)); + strlcpy(ifr6.ifr_name, name, IF_NAMESIZE); + if (ioctl(fd, SIOCGIFAFLAG_IN6, &ifr6) < 0) { + close(fd); + return ISC_FALSE; + } + close(fd); + flags6 = ifr6.ifr_ifru.ifru_flags6; + if ((flags6 & IN6_IFF_ANYCAST) != 0) + return ISC_TRUE; +#endif /* !SIOCGIFAFLAG_IN6 || !IN6_IFF_ANYCAST */ + return ISC_FALSE; +} +#endif /* !INCLUDE_IPV6_SUPPORT */ + /* * update_interface strategy * @@ -1276,6 +1312,11 @@ update_interfaces( if (is_wildcard_addr(&interface.sin)) continue; +#ifdef INCLUDE_IPV6_SUPPORT + if (is_anycast((struct sockaddr *)&interface.sin, isc_if.name)) + continue; +#endif /* !INCLUDE_IPV6_SUPPORT */ + /* * map to local *address* in order * to map all duplicate interfaces to an interface structure