From patchwork Tue Jun 10 12:58:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Compagnucci X-Patchwork-Id: 357909 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id E76F31400E2 for ; Tue, 10 Jun 2014 22:59:19 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id CD1E031617; Tue, 10 Jun 2014 12:59:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HZ-1KpveJQu3; Tue, 10 Jun 2014 12:59:16 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id AB564269BF; Tue, 10 Jun 2014 12:59:16 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id D1B1E1BF855 for ; Tue, 10 Jun 2014 12:59:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D043587773 for ; Tue, 10 Jun 2014 12:59:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id APVAxlQ6mF2v for ; Tue, 10 Jun 2014 12:59:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by fraxinus.osuosl.org (Postfix) with ESMTPS id E63BF873B8 for ; Tue, 10 Jun 2014 12:59:14 +0000 (UTC) Received: by mail-wi0-f180.google.com with SMTP id hi2so3845754wib.13 for ; Tue, 10 Jun 2014 05:59:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=9j+A0qPkNXOPfLYRSQ2BU9S8wOfAk11CGp2TRanxLEs=; b=Eb1FXUd0OJNDSIUIZSbdNOjI9RNTxPFE5p9hP+CKhjf8cNRmFlVgBb5I1NTKXBo1Fh m7YylYL1zBiiv4BxAxKVbhUbcfAds1/MVRw78Pg/bwOM8nyiTy44almWb1ffIDOUmGnf J2W7iGDr2Dz/yZwZhNqth1D/LNOXEWTgoYaJpgEx3czP53UThqEepZrPt9DEaKPddRkt VKGkiWVvIIzBZZs2Ex5xxAMFB5AcFt3tvYhVgLBLlf61VFLUwGQ8tX+cFKKZSTFrnXtt 09KcsX9s/6vTzfTqlWbeJlzdZFqpp1ofM+H2KfF8HX3TMOohyJll0EnJgKczmRgr30yx V8NQ== X-Received: by 10.180.90.51 with SMTP id bt19mr38370923wib.22.1402405151961; Tue, 10 Jun 2014 05:59:11 -0700 (PDT) Received: from localhost.localdomain ([89.202.204.147]) by mx.google.com with ESMTPSA id i8sm20714170wiw.22.2014.06.10.05.59.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Jun 2014 05:59:10 -0700 (PDT) From: Angelo Compagnucci To: buildroot@uclibc.org Date: Tue, 10 Jun 2014 14:58:40 +0200 Message-Id: <1402405120-3695-1-git-send-email-angelo.compagnucci@gmail.com> X-Mailer: git-send-email 2.0.0 Subject: [Buildroot] [PATCH] Fixing ntpd time syncing problem X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Add ntp.conf file to make ntpd syncing. Starting ntpd daemon with -g to sync time also with big offsets. Removes the use of deprecated ntpdate command for initial time sync. Signed-off-by: Angelo Compagnucci Acked-by: Gustavo Zacarias Tested-by: Gustavo Zacarias --- package/ntp/S49ntp | 8 +------- package/ntp/ntp.mk | 1 + package/ntp/ntpd.etc.conf | 8 ++++++++ package/ntp/ntpd.etc.default | 7 ------- 4 files changed, 10 insertions(+), 14 deletions(-) create mode 100644 package/ntp/ntpd.etc.conf diff --git a/package/ntp/S49ntp b/package/ntp/S49ntp index 7b929e9..05cb1ff 100755 --- a/package/ntp/S49ntp +++ b/package/ntp/S49ntp @@ -20,14 +20,8 @@ fi case "$1" in start) - if [ -x $NTPDATE_BIN ] ; then - echo -n "Getting initial time via ntp" - $NTPDATE_BIN $NTPDATE_OPTS $NTPSERVERS > /dev/null 2>&1 - echo "." - fi - echo -n "Starting $DESC: $NAME" - start-stop-daemon -S -q -x $DAEMON + start-stop-daemon -S -q -x $DAEMON -- -g echo "." ;; stop) echo -n "Stopping $DESC: $NAME" diff --git a/package/ntp/ntp.mk b/package/ntp/ntp.mk index fe6b04b..b60e623 100644 --- a/package/ntp/ntp.mk +++ b/package/ntp/ntp.mk @@ -52,6 +52,7 @@ NTP_INSTALL_FILES_$(BR2_PACKAGE_NTP_TICKADJ) += util/tickadj define NTP_INSTALL_TARGET_CMDS $(if $(BR2_PACKAGE_NTP_NTPD), install -m 755 $(@D)/ntpd/ntpd $(TARGET_DIR)/usr/sbin/ntpd) test -z "$(NTP_INSTALL_FILES_y)" || install -m 755 $(addprefix $(@D)/,$(NTP_INSTALL_FILES_y)) $(TARGET_DIR)/usr/bin/ + $(INSTALL) -m 644 package/ntp/ntpd.etc.conf $(TARGET_DIR)/etc/ntp.conf @if [ ! -f $(TARGET_DIR)/etc/default/ntpd ]; then \ $(INSTALL) -m 755 -d $(TARGET_DIR)/etc/default ; \ $(INSTALL) -m 644 package/ntp/ntpd.etc.default $(TARGET_DIR)/etc/default/ntpd ; \ diff --git a/package/ntp/ntpd.etc.conf b/package/ntp/ntpd.etc.conf new file mode 100644 index 0000000..6a2b88c --- /dev/null +++ b/package/ntp/ntpd.etc.conf @@ -0,0 +1,8 @@ +server 0.pool.ntp.org iburst +server 1.pool.ntp.org iburst + +restrict default kod nomodify notrap nopeer noquery +restrict -6 default kod nomodify notrap nopeer noquery + +restrict 127.0.0.1 +restrict -6 ::1 diff --git a/package/ntp/ntpd.etc.default b/package/ntp/ntpd.etc.default index d329228..94e2bc2 100644 --- a/package/ntp/ntpd.etc.default +++ b/package/ntp/ntpd.etc.default @@ -1,9 +1,2 @@ -# NTP Servers to use for ntpdate -NTPSERVERS="pool.ntp.org" - -# Get initial time via ntpdate? -NTPDATE=no -NTPDATE_OPTS="-t 5" - # Start the ntp daemon? NTPD=yes