From nobody@FreeBSD.org  Sun Apr  9 18:24:51 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 10DA016A405
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  9 Apr 2006 18:24:51 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 0548243D67
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  9 Apr 2006 18:24:50 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k39IOnxL090914
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 9 Apr 2006 18:24:49 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k39IOnxO090913;
	Sun, 9 Apr 2006 18:24:49 GMT
	(envelope-from nobody)
Message-Id: <200604091824.k39IOnxO090913@www.freebsd.org>
Date: Sun, 9 Apr 2006 18:24:49 GMT
From: "Ricky Y. Sun" <sunyuxi@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: NTPD/ntpdate complain about IPv6 interface not found
X-Send-Pr-Version: www-2.3

>Number:         95550
>Category:       bin
>Synopsis:       [patch] ntpd(8): NTPD/ntpdate complain about IPv6 interface not found
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 09 18:30:19 GMT 2006
>Closed-Date:    Fri Jun 15 11:43:17 GMT 2007
>Last-Modified:  Fri Jun 15 11:43:17 GMT 2007
>Originator:     Ricky Y. Sun
>Release:        FreeBSD6.x
>Organization:
>Environment:
FreeBSD 945gd.pewr.com 6.1-PRERELEASE FreeBSD 6.1-PRERELEASE #1: Fri Mar 17 08:59:43 PST 2006     root@945gd.pewr.com:/usr/obj/usr/src/sys/PEWR6_P4  i386
>Description:


ntpdate (or ntpd -q) will complain that IPv6 interface not found, if INET6 is disabled during kernel rebuilding.


This turns out to be the deficiency in contrib/ntp/ntpd/ntp_io.c source code:


The following code patch should be, or strongly recommended to be, checked in accordingly:


--- contrib/ntp/ntpd/ntp_io.c.orig    
+++ contrib/ntp/ntpd/ntp_io.c   
@@ -429,15 +429,23 @@
/*--------------------- BEGIN of PATCH ------------------------ */
        if (isc_net_probeipv6() == ISC_R_SUCCESS)
                scan_ipv6 = ISC_TRUE;
-#ifdef HAVE_IPV6
+#if defined(HAVE_IPV6) && defined(DEBUG)
        else
-               netsyslog(LOG_ERR, "no IPv6 interfaces found");
+       {
+               if (debug)
+                       netsyslog(LOG_ERR, "no IPv6 interfaces found");
+       }
 #endif

        if (isc_net_probeipv4() == ISC_R_SUCCESS)
                scan_ipv4 = ISC_TRUE;
+#ifdef DEBUG
        else
-               netsyslog(LOG_ERR, "no IPv4 interfaces found");
+       {
+               if (debug)
+                       netsyslog(LOG_ERR, "no IPv4 interfaces found");
+       }
+#endif

        nwilds = create_wildcards(port);
        idx = nwilds; 
/*--------------------- END of PATCH ------------------------ */




>How-To-Repeat:

If your FreeBSD 5.x/6.x kernel has no IPv6 (a.k.a. INET6) option built-in,

either you start ntpd via /etc/rc.conf or invoke it from CLI...

it complains about: " IPv6 interface not found .... ", similar complain if you have only IPv6 interface built in ;-)
>Fix:
Manually Patched: /usr/src/contrib/ntp/ntpd/ntp_io.c
ntp_io.c.orig is the original file which isn't changed ever since 7/20/2004

--- contrib/ntp/ntpd/ntp_io.c.orig    
+++ contrib/ntp/ntpd/ntp_io.c   
@@ -429,15 +429,23 @@
/*--------------------- BEGIN of PATCH ------------------------ */
        if (isc_net_probeipv6() == ISC_R_SUCCESS)
                scan_ipv6 = ISC_TRUE;
-#ifdef HAVE_IPV6
+#if defined(HAVE_IPV6) && defined(DEBUG)
        else
-               netsyslog(LOG_ERR, "no IPv6 interfaces found");
+       {
+               if (debug)
+                       netsyslog(LOG_ERR, "no IPv6 interfaces found");
+       }
 #endif

        if (isc_net_probeipv4() == ISC_R_SUCCESS)
                scan_ipv4 = ISC_TRUE;
+#ifdef DEBUG
        else
-               netsyslog(LOG_ERR, "no IPv4 interfaces found");
+       {
+               if (debug)
+                       netsyslog(LOG_ERR, "no IPv4 interfaces found");
+       }
+#endif

        nwilds = create_wildcards(port);
        idx = nwilds; 
/*--------------------- END of PATCH ------------------------ */




>Release-Note:
>Audit-Trail:

From: keve@Safe-mail.net
To: bug-followup@freebsd.org, sunyuxi@yahoo.com
Cc:  
Subject: Re: bin/95550: [patch] ntpd(8): NTPD/ntpdate complain about IPv6 interface not f
Date: Fri, 1 Jun 2007 12:47:58 -0400

 I re-discovered this issue this week on FreeBSD/i386 6.2-RELEASE-p4. Before submitting a new PR my search found that this problem has been reported already multiple times. PRs bin/78728 and bin/95550 appear to be duplicates of each other. It has been over a year now and even though the solution patches were provided and the fix can already be found in NetBSD code, no improvement was done here.
 This is a shame!
 I see no point in filing another PR. Could somebody please give this a kick!
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Fri Jun 15 11:42:13 UTC 2007 
State-Changed-Why:  
Appears to be a duplicate of bin/78728. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=95550 
>Unformatted:
