conf/143637: ntpdate support for ntp-servers supplied by dhcp
[PATCH]
Erik Norgaard
norgaard at locolomo.org
Sun Feb 7 10:40:01 UTC 2010
>Number: 143637
>Category: conf
>Synopsis: ntpdate support for ntp-servers supplied by dhcp [PATCH]
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Sun Feb 07 10:40:00 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Erik Norgaard
>Release: FreeBSD 8.0-STABLE
>Organization:
none
>Environment:
FreeBSD alpha.locolomo.org 8.0-STABLE FreeBSD 8.0-STABLE #0: Mon Feb 1 09:30:59 CET 2010 norgaard at alpha.locolomo.org:/usr/local/obj/usr/local/src/sys/GENERIC i386
>Description:
The rc script, /etc/rc.d/ntpdate does not support configuring ntp servers with the dhcp option ntp-servers. When the option ntp-servers is configured in dhcpd.conf, this is supplied to the client and stored in the kernel environment, dhcp.ntp-servers.
The patch set ntpdate_hosts if not set in rc.conf or ntp.conf using the dhcp option.
>How-To-Repeat:
>Fix:
Apply the supplied patch
Patch attached with submission follows:
--- /etc/rc.d/ntpdate.old 2010-02-07 10:37:55.000000000 +0100
+++ /etc/rc.d/ntpdate 2010-02-07 11:27:06.000000000 +0100
@@ -22,8 +22,12 @@
/^(server|peer)/ {print $2}
' < ${ntpdate_config}`
fi
+ if [ -z "$ntpdate_hosts" -a \
+ -n "`/bin/kenv dhcp.ntp-servers 2> /dev/null`" ]; then
+ ntpdate_hosts=`/bin/kenv dhcp.ntp-servers | sed 's/,/ /g'`
+ fi
if [ -n "$ntpdate_hosts" -o -n "$rc_flags" ]; then
- echo "Setting date via ntp."
+ echo "Setting date via ntp: $ntpdate_hosts"
${ntpdate_program:-ntpdate} $rc_flags $ntpdate_hosts
fi
}
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list