From nobody@FreeBSD.org  Tue May 17 07:22:11 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EABB1106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 17 May 2011 07:22:11 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id BF50A8FC14
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 17 May 2011 07:22:11 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p4H7MBX0040743
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 17 May 2011 07:22:11 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p4H7MBLi040742;
	Tue, 17 May 2011 07:22:11 GMT
	(envelope-from nobody)
Message-Id: <201105170722.p4H7MBLi040742@red.freebsd.org>
Date: Tue, 17 May 2011 07:22:11 GMT
From: Daniel Fahlgren <fahlgren@tutus.se>
To: freebsd-gnats-submit@FreeBSD.org
Subject: NTPD with -DDISABLE_IPV6 gives a lot of error messages, patch attached
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         157104
>Category:       bin
>Synopsis:       [patch] ntpd(8) with -DDISABLE_IPV6 gives a lot of error messages
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 17 07:30:09 UTC 2011
>Closed-Date:    
>Last-Modified:  Sat May 21 22:13:32 UTC 2011
>Originator:     Daniel Fahlgren
>Release:        8.2
>Organization:
Tutus Data
>Environment:
>Description:
If you build NTPD without IPv6 by adding the flag -DDISABLE_IPV6 to the makefile will you get a lot of errors during run time. The errors is that it failes to bind 0.0.0.0#123, and that message was repeated for all interfaces.
>How-To-Repeat:
Add -DDISABLE_IPV6 to the CFLAGS and rebuild ntpd. Run it on a machine with IPv6 enabled.
>Fix:
I didn't trace it down to exactly where that was done. But I found that line 1218 -> 1233 in:

http://svnweb.freebsd.org/base/release/8.2.0/contrib/ntp/ntpd/ntp_io.c?view=markup

looks suspicious. The call to isc_net_probeipv6 is done regardless if we should have IPv6 or not. If ISC_PLATFORM_HAVEIPV6 is defined will also INCLUDE_IPV6_SUPPORT be defined according to line 60 so removing the second block seems like a correct solution. That solved my problem at least, Patch attached that applies to 8.2.0 cleanly. Patching head failed due to space changes after the if statements, but the same problem exists in the same place.

Patch attached with submission follows:

Index: ntp_io.c
===================================================================
--- ntp_io.c	(revision 222004)
+++ ntp_io.c	(working copy)
@@ -1217,27 +1217,20 @@
 
 #ifdef INCLUDE_IPV6_SUPPORT
 	if (isc_net_probeipv6() == ISC_R_SUCCESS)
 		scan_ipv6 = ISC_TRUE;
 #if defined(DEBUG)
 	else
 		if(debug)
 			netsyslog(LOG_ERR, "no IPv6 interfaces found");
 #endif
 #endif
-	if (isc_net_probeipv6() == ISC_R_SUCCESS)
-		scan_ipv6 = ISC_TRUE;
-#if defined(ISC_PLATFORM_HAVEIPV6) && defined(DEBUG)
-	else
-		if(debug)
-			netsyslog(LOG_ERR, "no IPv6 interfaces found");
-#endif
 
 	if (isc_net_probeipv4() == ISC_R_SUCCESS)
 		scan_ipv4 = ISC_TRUE;
 #ifdef DEBUG
 	else
 		if(debug)
 			netsyslog(LOG_ERR, "no IPv4 interfaces found");
 #endif
 	/*
 	 * phase one - scan interfaces


>Release-Note:
>Audit-Trail:
>Unformatted:
