From owner-freebsd-bugs@FreeBSD.ORG Sun Feb 7 10:40:01 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 542C11065672 for ; Sun, 7 Feb 2010 10:40:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 34A268FC16 for ; Sun, 7 Feb 2010 10:40:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id o17Ae18j087267 for ; Sun, 7 Feb 2010 10:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id o17Ae1rk087266; Sun, 7 Feb 2010 10:40:01 GMT (envelope-from gnats) Resent-Date: Sun, 7 Feb 2010 10:40:01 GMT Resent-Message-Id: <201002071040.o17Ae1rk087266@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Erik Norgaard Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70B161065670 for ; Sun, 7 Feb 2010 10:33:21 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 634148FC0C for ; Sun, 7 Feb 2010 10:33:21 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o17AXKHr022077 for ; Sun, 7 Feb 2010 10:33:20 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o17AXKUa022076; Sun, 7 Feb 2010 10:33:20 GMT (envelope-from nobody) Message-Id: <201002071033.o17AXKUa022076@www.freebsd.org> Date: Sun, 7 Feb 2010 10:33:20 GMT From: Erik Norgaard To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: conf/143637: ntpdate support for ntp-servers supplied by dhcp [PATCH] X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Feb 2010 10:40:01 -0000 >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: