Date: Sat, 16 Mar 2013 17:58:59 +0900 From: Hajimu UMEMOTO <ume@FreeBSD.org> To: "M. Schulte" <m-freebsd@fuglos.org> Cc: freebsd-net@freebsd.org Subject: Re: ntpd bind() failure: Can't assign requested address Message-ID: <yge8v5nzpnw.wl%ume@mahoroba.org> In-Reply-To: <alpine.BSF.2.00.1303152246340.80143@m.fuglos.org> References: <alpine.BSF.2.00.1303122241080.77297@m.fuglos.org> <CAN6yY1ve7FDc=W%2BFKV=OFER7n7nrY_BT2VNHtU76%2Bo%2B%2BjuZP%2Bw@mail.gmail.com> <alpine.BSF.2.00.1303152246340.80143@m.fuglos.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--Multipart_Sat_Mar_16_17:58:59_2013-1 Content-Type: text/plain; charset=US-ASCII Hi, >>>>> On Fri, 15 Mar 2013 22:54:42 +0100 (CET) >>>>> "M. Schulte" <m-freebsd@fuglos.org> said: m-freebsd> I fear I cannot answer all of these questions. I don't have any IPv6 m-freebsd> addresses configured in rc.conf. Also, I am not using dhcp. Basically m-freebsd> I only have IPv4 networking configured with static addresses -- m-freebsd> neither have I actively _disabled_ IPv6. m-freebsd> This is my ifconfig output: m-freebsd> re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 m-freebsd> options=8009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LINKSTATE> m-freebsd> ether 00:16:36:74:20:76 m-freebsd> inet XXX.XXX.XXX.XXX netmask 0xfffffff0 broadcast XXX.XXX.XXX.XXX m-freebsd> inet6 fe80::216:36ff:fe74:2076%re0 prefixlen 64 scopeid 0x2 m-freebsd> nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> m-freebsd> media: Ethernet autoselect (100baseTX <full-duplex>) m-freebsd> status: active It seems IPv6 is disabled by IFDISABLED nd6 option. Please try the attached patch to ignore it. Sincerely, --Multipart_Sat_Mar_16_17:58:59_2013-1 Content-Type: text/x-patch; type=patch; charset=US-ASCII Content-Disposition: attachment; filename="ntpd-ifdisabled.diff" Content-Transfer-Encoding: 7bit Index: contrib/ntp/ntpd/ntp_io.c diff -u -p contrib/ntp/ntpd/ntp_io.c.orig contrib/ntp/ntpd/ntp_io.c --- contrib/ntp/ntpd/ntp_io.c.orig 2012-10-01 02:28:37.157635135 +0900 +++ contrib/ntp/ntpd/ntp_io.c 2013-03-16 17:30:51.384215167 +0900 @@ -69,6 +69,7 @@ #include <netinet/in.h> #include <net/if_var.h> #include <netinet/in_var.h> +#include <netinet6/nd6.h> #endif /* !INCLUDE_IPV6_SUPPORT */ extern int listen_to_virtual_ips; @@ -1202,6 +1203,28 @@ is_anycast(struct sockaddr *sa, char *na #endif /* !SIOCGIFAFLAG_IN6 || !IN6_IFF_ANYCAST */ return ISC_FALSE; } + +static isc_boolean_t +is_ifdisabled(char *name) +{ +#if defined(SIOCGIFINFO_IN6) && defined(ND6_IFF_IFDISABLED) + struct in6_ndireq nd; + int fd; + + if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) + return ISC_FALSE; + memset(&nd, 0, sizeof(nd)); + strlcpy(nd.ifname, name, sizeof(nd.ifname)); + if (ioctl(fd, SIOCGIFINFO_IN6, &nd) < 0) { + close(fd); + return ISC_FALSE; + } + close(fd); + if ((nd.ndi.flags & ND6_IFF_IFDISABLED) != 0) + return ISC_TRUE; +#endif /* !SIOCGIFAFLAG_IN6 || !IN6_IFF_ANYCAST */ + return ISC_FALSE; +} #endif /* !INCLUDE_IPV6_SUPPORT */ /* @@ -1335,6 +1358,16 @@ update_interfaces( continue; } +#ifdef INCLUDE_IPV6_SUPPORT + if (interface.sin.ss_family == AF_INET6 && + is_ifdisabled(interface.name)) { + DPRINTF(4, + ("skipping interface %s (%s) - IFDISABLED\n", + interface.name, stoa(&interface.sin))); + continue; + } +#endif /* !INCLUDE_IPV6_SUPPORT */ + /* * skip any interfaces UP and bound to a wildcard * address - some dhcp clients produce that in the -- Hajimu UMEMOTO ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.mahoroba.org/~ume/ --Multipart_Sat_Mar_16_17:58:59_2013-1--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?yge8v5nzpnw.wl%ume>