Date: Sun, 7 Feb 2010 10:33:20 GMT From: Erik Norgaard <norgaard@locolomo.org> To: freebsd-gnats-submit@FreeBSD.org Subject: conf/143637: ntpdate support for ntp-servers supplied by dhcp [PATCH] Message-ID: <201002071033.o17AXKUa022076@www.freebsd.org> Resent-Message-ID: <201002071040.o17Ae1rk087266@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002071033.o17AXKUa022076>