Bug#387665: [pkg-ntp-maintainers] Bug#387665: ntp: mismatching ifdefs for IPv6 + POSIXness issue => FTBFS on Hurd

Kurt Roeckx kurt at roeckx.be
Sat Sep 16 09:34:41 UTC 2006


On Fri, Sep 15, 2006 at 03:53:28PM +0200, Marc Dequènes wrote:
> 
> On "some" architectures where IPv6 is not working, some mismatching
> ifdefs leads to FTBFS. A patch is attached.
> 
> MAXHOSTNAMELEN is used unconditionnaly, while setting this constant is
> NOT a MUST in POSIX and an absolutly unnecessary limit on Hurd and cause
> an FTBFS on this architecture. A patch is attached.
> 
> Both patches apply cleanly when appended in debian/series.
> 
> Regards.
> 

> --- orig/libisc/net.c	2006-06-06 20:16:24.000000000 +0000
> +++ new/libisc/net.c	2006-09-13 18:17:29.000000000 +0000
> @@ -201,6 +201,7 @@
>  #endif /* IPV6_V6ONLY */
>  }
>  
> +#ifndef IPV6_V6ONLY
>  static void
>  initialize_ipv6only(void) {
>  	RUNTIME_CHECK(isc_once_do(&once_ipv6only,

I think that #ifndef IPV6_V6ONLY is wrong (and so is the comment at the
end of function).  I think you want you just want to remove the
#endif at the end of the function.

> @@ -257,6 +258,7 @@
>  				  try_ipv6pktinfo) == ISC_R_SUCCESS);
>  }
>  #endif /* WANT_IPV6 */
> +#endif /* ISC_PLATFORM_HAVEIPV6 */
>  
>  isc_result_t
>  isc_net_probe_ipv6only(void) {

That looks good.

> --- orig/ntpd/ntp_intres.c	2006-09-14 16:24:11.000000000 +0000
> +++ new/ntpd/ntp_intres.c	2006-09-14 16:24:16.000000000 +0000
> @@ -41,7 +41,7 @@
>  #include <arpa/inet.h>
>  /**/
>  #ifdef HAVE_SYS_PARAM_H
> -# include <sys/param.h>		/* MAXHOSTNAMELEN (often) */
> +# include <sys/param.h>		/* NI_MAXHOST (often) */
>  #endif
>  
>  #include <isc/net.h>

Note that for NI_MAXHOST you need <netdb.h>, which you should get
because we include ntp_stdlib.h, which includes ntp_rfc2553.h.

> @@ -524,10 +524,10 @@
>  			msyslog(LOG_INFO, "findhostaddr: Resolving %s>",
>  				stoa(&entry->peer_store));
>  #endif
> -		entry->ce_name = emalloc(MAXHOSTNAMELEN);
> +		entry->ce_name = emalloc(NI_MAXHOST);
>  		error = getnameinfo((const struct sockaddr *)&entry->peer_store,
>  				   SOCKLEN(&entry->peer_store),
> -				   (char *)&entry->ce_name, MAXHOSTNAMELEN,
> +				   (char *)&entry->ce_name, NI_MAXHOST,
>  				   NULL, 0, 0);
>  	}
>  #ifdef DEBUG

NI_MAXHOST really is a better thing to use there, so this looks good.


kurt





More information about the pkg-ntp-maintainers mailing list