conf/82228: order parsed ntpdate_hosts in /etc/rc.d/ntpdate
Ralf Wenk
RZ-FreeBSD0605 at fh-karlsruhe.de
Tue Jun 14 14:20:19 GMT 2005
>Number: 82228
>Category: conf
>Synopsis: order parsed ntpdate_hosts in /etc/rc.d/ntpdate
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>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:
>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:
>Unformatted:
More information about the freebsd-bugs
mailing list