From root@fh-karlsruhe.de  Tue Jun 14 14:13:39 2005
Return-Path: <root@fh-karlsruhe.de>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 1FA0816A41C
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 14 Jun 2005 14:13:39 +0000 (GMT)
	(envelope-from root@fh-karlsruhe.de)
Received: from rz06.fh-karlsruhe.de (rz06.FH-Karlsruhe.DE [193.196.64.6])
	by mx1.FreeBSD.org (Postfix) with ESMTP id C103E43D4C
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 14 Jun 2005 14:13:36 +0000 (GMT)
	(envelope-from root@fh-karlsruhe.de)
Received: from rz-tp600e.fh-karlsruhe.de ([193.196.65.252] helo=localhost)
	by rz06.fh-karlsruhe.de with esmtp (Exim 4.50)
	id 1DiCAY-0007yw-Vk; Tue, 14 Jun 2005 16:13:35 +0200
Received: from root by localhost with local (Exim 4.51 (FreeBSD))
	id 1DiCAY-0000EL-Nt; Tue, 14 Jun 2005 16:13:34 +0200
Message-Id: <E1DiCAY-0000EL-Nt@localhost>
Date: Tue, 14 Jun 2005 16:13:34 +0200
From: Ralf Wenk <RZ-FreeBSD0605@fh-karlsruhe.de>
Reply-To: Ralf Wenk <RZ-FreeBSD0605@fh-karlsruhe.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc: Ralf Wenk <RZ-FreeBSD0605@fh-karlsruhe.de>
Subject: order parsed ntpdate_hosts in /etc/rc.d/ntpdate
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         82228
>Category:       conf
>Synopsis:       [patch] order parsed ntpdate_hosts in /etc/rc.d/ntpdate
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    roberto
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 14 14:20:17 GMT 2005
>Closed-Date:    
>Last-Modified:  Mon Jun 27 16:52:23 GMT 2005
>Originator:     Ralf Wenk
>Release:        FreeBSD 6.0-CURRENT i386
>Organization:
FH Karlsruhe, University of Applied Sciences
>Environment:
System: FreeBSD RZ-TP600E 6.0-CURRENT FreeBSD 6.0-CURRENT #0: Wed Jun 1 14:27:13 CEST 2005 root@:/usr/obj/usr/src/sys/tp600e i386


	
>Description:
/etc/rc.d/ntpdate uses awk to parse /etc/ntp.conf for hosts. It just uses
peer and server statements. This patch also uses multicastclient and
broadcastclient statements and also groups the returned hosts by type.

	
>How-To-Repeat:
Have a look at the script source.
	

>Fix:
Apply the following patch:
	

--- rc.d-ntpdate.udiff begins here ---
--- ntpdate.ori	Wed May 25 08:51:53 2005
+++ ntpdate	Tue Jun 14 15:46:33 2005
@@ -20,9 +20,13 @@
 {
 	if [ -z "$ntpdate_hosts" -a -f /etc/ntp.conf ]; then
 		ntpdate_hosts=`awk '
-			/^server[ \t]*127.127/      {next}
-			/^(server|peer)/            {print $2}
-		' </etc/ntp.conf`
+			$1 == "peer"                        {p = p $2 " "}
+			$1 == "server" && $2 !~ /^127.127/  {s = s $2 " "}
+			# The syntax could be violated by adding a host to the
+			# broadcastclient statement. In case this is true here
+			$1 == "broadcastclient" && NF == 2  {b = $2}
+			$1 == "multicastclient" && NF == 1  {m = "224.0.1.1" }
+			END {print s p b m}' /etc/ntp.conf`
 	fi
 	if [ -n "$ntpdate_hosts" -o -n "$rc_flags" ]; then
 		echo "Setting date via ntp."
--- rc.d-ntpdate.udiff ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->roberto 
Responsible-Changed-By: matteo 
Responsible-Changed-When: Mon Jun 27 16:51:49 GMT 2005 
Responsible-Changed-Why:  
Assign this to roberto@ as he takes care of the ntp stuff 

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