summaryrefslogtreecommitdiff
path: root/recipes/openntpd/files
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/openntpd/files')
-rw-r--r--recipes/openntpd/files/adjtimex-3.7p1.patch172
-rw-r--r--recipes/openntpd/files/adjtimex-3.9p1.patch183
-rw-r--r--recipes/openntpd/files/autofoo.patch52
-rw-r--r--recipes/openntpd/files/init37
-rw-r--r--recipes/openntpd/files/makefile-install.patch29
5 files changed, 473 insertions, 0 deletions
diff --git a/recipes/openntpd/files/adjtimex-3.7p1.patch b/recipes/openntpd/files/adjtimex-3.7p1.patch
new file mode 100644
index 0000000000..12a4184443
--- /dev/null
+++ b/recipes/openntpd/files/adjtimex-3.7p1.patch
@@ -0,0 +1,172 @@
+diff -u -p -r1.46 client.c
+--- openntpd-3.7p1/client.c 13 Mar 2005 12:36:43 -0000 1.46
++++ openntpd-3.7p1/client.c 26 Jun 2005 03:15:54 -0000
+@@ -306,7 +306,7 @@ client_update(struct ntp_peer *p)
+ priv_adjtime();
+
+ for (i = 0; i < OFFSET_ARRAY_SIZE; i++)
+- if (p->reply[i].rcvd <= p->reply[best].rcvd)
++ /* if (p->reply[i].rcvd <= p->reply[best].rcvd) */
+ p->reply[i].good = 0;
+
+ return (0);
+--- openntpd-3.7p1/configure.ac 23 May 2005 11:10:34 -0000 1.62
++++ openntpd-3.7p1/configure.ac 26 Jun 2005 03:15:54 -0000
+@@ -466,6 +466,11 @@ AC_ARG_WITH(builtin-arc4random,
+ [ builtin_arc4random=$withval ]
+ )
+
++AC_ARG_WITH(adjtimex,
++ [ --with-adjtimex Use adjtimex to adjust kernel skew],
++ [ AC_DEFINE(USE_ADJTIMEX, [], [Use adjust skew with adjtimex (experimental)]) ]
++)
++
+ # Search for OpenSSL if required.
+ if test "$ac_cv_func_arc4random" != "yes" && test "x$builtin_arc4random" != "xyes"; then
+ saved_CPPFLAGS="$CPPFLAGS"
+--- openntpd-3.7p1/defines.h 23 May 2005 00:16:15 -0000 1.23
++++ openntpd-3.7p1/defines.h 26 Jun 2005 03:15:54 -0000
+@@ -20,6 +20,10 @@
+ # define setproctitle(x)
+ #endif
+
++#ifdef USE_ADJTIMEX
++# define adjtime(a,b) (_compat_adjtime((a),(b)))
++#endif
++
+ #if !defined(SA_LEN)
+ # if defined(HAVE_STRUCT_SOCKADDR_SA_LEN)
+ # define SA_LEN(x) ((x)->sa_len)
+--- openntpd-3.7p1/openbsd-compat/Makefile.in 19 Dec 2004 23:41:28 -0000 1.10
++++ openntpd-3.7p1/openbsd-compat/Makefile.in 26 Jun 2005 03:17:15 -0000
+@@ -9,7 +9,7 @@ all: libopenbsd-compat.a
+ OPENBSD= asprintf.o daemon.o inet_pton.o strlcpy.o
+ COMPAT= atomicio.o bsd-arc4random.o bsd-misc.o bsd-poll.o \
+ bsd-snprintf.o fake-rfc2553.o uidswap.o
+-PORT= port-qnx.o
++PORT= port-linux.o port-qnx.o
+
+ VPATH=@srcdir@
+ CC=@CC@
+--- openntpd-3.7p1/openbsd-compat/openbsd-compat.h 19 Dec 2004 03:04:22 -0000 1.15
++++ openntpd-3.7p1/openbsd-compat/openbsd-compat.h 26 Jun 2005 03:15:54 -0000
+@@ -44,6 +44,11 @@ int asprintf(char **, const char *,
+ __attribute__((__format__ (printf, 2, 3)));
+ #endif
+
++#ifdef USE_ADJTIMEX
++# include <sys/time.h>
++int _compat_adjtime(const struct timeval *, struct timeval *);
++#endif
++
+ #ifndef HAVE_INET_PTON
+ int inet_pton(int, const char *, void *);
+ #endif
+--- /dev/null 1 Jan 1970 00:00:00 -0000
++++ openntpd-3.7p1/openbsd-compat/port-linux.c 10 Dec 2004 01:10:30 -0000
+@@ -0,0 +1,105 @@
++/* $Id$ */
++
++/*
++ * Copyright (c) 2004 Darren Tucker <dtucker at zip com au>
++ *
++ * Permission to use, copy, modify, and distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#include "includes.h"
++
++#ifdef USE_ADJTIMEX
++#include <sys/timex.h>
++#include <errno.h>
++#ifdef adjtime
++# undef adjtime
++#endif
++
++#include "ntpd.h"
++
++/* scale factor used by adjtimex freq param. 1 ppm = 65536 */
++#define ADJTIMEX_FREQ_SCALE 65536
++
++/* maximum change to skew per adjustment, in PPM */
++#define MAX_SKEW_DELTA 5.0
++
++int
++_compat_adjtime(const struct timeval *delta, struct timeval *olddelta)
++{
++ static struct timeval tlast = {0,0};
++ static double tskew = 0;
++ static int synced = -1;
++ struct timeval tnow, tdelta;
++ double skew = 0, newskew, deltaskew, adjust, interval = 0;
++ struct timex tmx;
++ int result, saved_errno;
++
++ gettimeofday(&tnow, NULL);
++ adjust = (double)delta->tv_sec;
++ adjust += (double)delta->tv_usec / 1000000;
++
++ /* Even if the caller doesn't care about the olddelta, we do */
++ if (olddelta == NULL)
++ olddelta = &tdelta;
++
++ result = adjtime(delta, olddelta);
++ saved_errno = errno;
++
++ if (olddelta->tv_sec == 0 && olddelta->tv_usec == 0 &&
++ synced != INT_MAX)
++ synced++;
++ else
++ synced = 0;
++
++ /*
++ * do skew calculations if we have synced
++ */
++ if (synced == 0 ) {
++ tmx.modes = 0;
++ if (adjtimex(&tmx) == -1)
++ log_warn("adjtimex get failed");
++ else
++ tskew = (double)tmx.freq / ADJTIMEX_FREQ_SCALE;
++ } else if (synced >= 1) {
++ interval = (double)(tnow.tv_sec - tlast.tv_sec);
++ interval += (double)(tnow.tv_usec - tlast.tv_usec) / 1000000;
++
++ skew = (adjust * 1000000) / interval;
++ newskew = ((tskew * synced) + skew) / synced;
++ deltaskew = newskew - tskew;
++
++ if (deltaskew > MAX_SKEW_DELTA) {
++ log_info("skew change %0.3lf exceeds limit", deltaskew);
++ tskew += MAX_SKEW_DELTA;
++ } else if (deltaskew < -MAX_SKEW_DELTA) {
++ log_info("skew change %0.3lf exceeds limit", deltaskew);
++ tskew -= MAX_SKEW_DELTA;
++ } else {
++ tskew = newskew;
++ }
++
++ /* Adjust the kernel skew. */
++ tmx.freq = (long)(tskew * ADJTIMEX_FREQ_SCALE);
++ tmx.modes = ADJ_FREQUENCY;
++ if (adjtimex(&tmx) == -1)
++ log_warn("adjtimex set freq failed");
++ }
++
++ log_debug("interval %0.3lf skew %0.3lf total skew %0.3lf", interval,
++ skew, tskew);
++
++ tlast = tnow;
++ errno = saved_errno;
++ return result;
++}
++#endif
diff --git a/recipes/openntpd/files/adjtimex-3.9p1.patch b/recipes/openntpd/files/adjtimex-3.9p1.patch
new file mode 100644
index 0000000000..b741f9894f
--- /dev/null
+++ b/recipes/openntpd/files/adjtimex-3.9p1.patch
@@ -0,0 +1,183 @@
+Index: openntpd-3.9p1/client.c
+===================================================================
+--- openntpd-3.9p1.orig/client.c 2006-05-14 07:29:21.000000000 +0200
++++ openntpd-3.9p1/client.c 2006-09-11 10:12:20.000000000 +0200
+@@ -321,7 +321,7 @@
+ priv_adjtime();
+
+ for (i = 0; i < OFFSET_ARRAY_SIZE; i++)
+- if (p->reply[i].rcvd <= p->reply[best].rcvd)
++ /* if (p->reply[i].rcvd <= p->reply[best].rcvd) */
+ p->reply[i].good = 0;
+
+ return (0);
+Index: openntpd-3.9p1/configure.ac
+===================================================================
+--- openntpd-3.9p1.orig/configure.ac 2006-05-14 07:29:23.000000000 +0200
++++ openntpd-3.9p1/configure.ac 2006-09-11 10:12:20.000000000 +0200
+@@ -617,6 +617,11 @@
+ fi
+ AC_SUBST(mansubdir)
+
++AC_ARG_WITH(adjtimex,
++ [ --with-adjtimex Use adjtimex to adjust kernel skew],
++ [ AC_DEFINE(USE_ADJTIMEX, [], [Use adjust skew with adjtimex (experimental)]) ]
++)
++
+ # Search for OpenSSL if required.
+ if test "$ac_cv_func_arc4random" != "yes" && test "x$builtin_arc4random" != "xyes"; then
+ saved_CPPFLAGS="$CPPFLAGS"
+Index: openntpd-3.9p1/defines.h
+===================================================================
+--- openntpd-3.9p1.orig/defines.h 2006-05-14 07:29:21.000000000 +0200
++++ openntpd-3.9p1/defines.h 2006-09-11 10:12:20.000000000 +0200
+@@ -20,6 +20,10 @@
+ # define setproctitle(x)
+ #endif
+
++#ifdef USE_ADJTIMEX
++# define adjtime(a,b) (_compat_adjtime((a),(b)))
++#endif
++
+ #if !defined(SA_LEN)
+ # if defined(HAVE_STRUCT_SOCKADDR_SA_LEN)
+ # define SA_LEN(x) ((x)->sa_len)
+Index: openntpd-3.9p1/openbsd-compat/Makefile.in
+===================================================================
+--- openntpd-3.9p1.orig/openbsd-compat/Makefile.in 2006-05-14 07:29:19.000000000 +0200
++++ openntpd-3.9p1/openbsd-compat/Makefile.in 2006-09-11 10:12:56.000000000 +0200
+@@ -9,7 +9,7 @@
+ COMPAT= atomicio.o bsd-arc4random.o bsd-misc.o bsd-poll.o \
+ bsd-snprintf.o bsd-getifaddrs.o bsd-setresuid.o \
+ bsd-setresgid.o fake-rfc2553.o
+-PORT= port-qnx.o
++PORT= port-linux.o port-qnx.o
+
+ VPATH=@srcdir@
+ CC=@CC@
+Index: openntpd-3.9p1/openbsd-compat/openbsd-compat.h
+===================================================================
+--- openntpd-3.9p1.orig/openbsd-compat/openbsd-compat.h 2006-05-14 07:29:19.000000000 +0200
++++ openntpd-3.9p1/openbsd-compat/openbsd-compat.h 2006-09-11 10:12:20.000000000 +0200
+@@ -46,6 +46,11 @@
+ __attribute__((__format__ (printf, 2, 3)));
+ #endif
+
++#ifdef USE_ADJTIMEX
++# include <sys/time.h>
++int _compat_adjtime(const struct timeval *, struct timeval *);
++#endif
++
+ #ifndef HAVE_INET_PTON
+ int inet_pton(int, const char *, void *);
+ #endif
+Index: openntpd-3.9p1/openbsd-compat/port-linux.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ openntpd-3.9p1/openbsd-compat/port-linux.c 2006-09-11 10:12:20.000000000 +0200
+@@ -0,0 +1,105 @@
++/* $Id$ */
++
++/*
++ * Copyright (c) 2004 Darren Tucker <dtucker at zip com au>
++ *
++ * Permission to use, copy, modify, and distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#include "includes.h"
++
++#ifdef USE_ADJTIMEX
++#include <sys/timex.h>
++#include <errno.h>
++#ifdef adjtime
++# undef adjtime
++#endif
++
++#include "ntpd.h"
++
++/* scale factor used by adjtimex freq param. 1 ppm = 65536 */
++#define ADJTIMEX_FREQ_SCALE 65536
++
++/* maximum change to skew per adjustment, in PPM */
++#define MAX_SKEW_DELTA 5.0
++
++int
++_compat_adjtime(const struct timeval *delta, struct timeval *olddelta)
++{
++ static struct timeval tlast = {0,0};
++ static double tskew = 0;
++ static int synced = -1;
++ struct timeval tnow, tdelta;
++ double skew = 0, newskew, deltaskew, adjust, interval = 0;
++ struct timex tmx;
++ int result, saved_errno;
++
++ gettimeofday(&tnow, NULL);
++ adjust = (double)delta->tv_sec;
++ adjust += (double)delta->tv_usec / 1000000;
++
++ /* Even if the caller doesn't care about the olddelta, we do */
++ if (olddelta == NULL)
++ olddelta = &tdelta;
++
++ result = adjtime(delta, olddelta);
++ saved_errno = errno;
++
++ if (olddelta->tv_sec == 0 && olddelta->tv_usec == 0 &&
++ synced != INT_MAX)
++ synced++;
++ else
++ synced = 0;
++
++ /*
++ * do skew calculations if we have synced
++ */
++ if (synced == 0 ) {
++ tmx.modes = 0;
++ if (adjtimex(&tmx) == -1)
++ log_warn("adjtimex get failed");
++ else
++ tskew = (double)tmx.freq / ADJTIMEX_FREQ_SCALE;
++ } else if (synced >= 1) {
++ interval = (double)(tnow.tv_sec - tlast.tv_sec);
++ interval += (double)(tnow.tv_usec - tlast.tv_usec) / 1000000;
++
++ skew = (adjust * 1000000) / interval;
++ newskew = ((tskew * synced) + skew) / synced;
++ deltaskew = newskew - tskew;
++
++ if (deltaskew > MAX_SKEW_DELTA) {
++ log_info("skew change %0.3lf exceeds limit", deltaskew);
++ tskew += MAX_SKEW_DELTA;
++ } else if (deltaskew < -MAX_SKEW_DELTA) {
++ log_info("skew change %0.3lf exceeds limit", deltaskew);
++ tskew -= MAX_SKEW_DELTA;
++ } else {
++ tskew = newskew;
++ }
++
++ /* Adjust the kernel skew. */
++ tmx.freq = (long)(tskew * ADJTIMEX_FREQ_SCALE);
++ tmx.modes = ADJ_FREQUENCY;
++ if (adjtimex(&tmx) == -1)
++ log_warn("adjtimex set freq failed");
++ }
++
++ log_debug("interval %0.3lf skew %0.3lf total skew %0.3lf", interval,
++ skew, tskew);
++
++ tlast = tnow;
++ errno = saved_errno;
++ return result;
++}
++#endif
diff --git a/recipes/openntpd/files/autofoo.patch b/recipes/openntpd/files/autofoo.patch
new file mode 100644
index 0000000000..605558e6fd
--- /dev/null
+++ b/recipes/openntpd/files/autofoo.patch
@@ -0,0 +1,52 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- openntpd-3.6.1p1/configure.ac~autofoo
++++ openntpd-3.6.1p1/configure.ac
+@@ -500,8 +500,11 @@
+ [
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR(OpenSSL version header not found.)
+- ]
+-)
++ ],[
++ AC_MSG_RESULT(unknown)
++ AC_MSG_WARN(Skipping OpenSSL header version check due to crosscompilation.)
++
++])
+
+ # Determine OpenSSL library version
+ AC_MSG_CHECKING([OpenSSL library version])
+@@ -533,6 +536,9 @@
+ [
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR(OpenSSL library not found.)
++ ],[
++ AC_MSG_RESULT(unknown)
++ AC_MSG_WARN(Skipping OpenSSL library version check due to crosscompilation.)
+ ]
+ )
+
+@@ -552,6 +558,9 @@
+ AC_MSG_ERROR([Your OpenSSL headers do not match your library.
+ Check config.log for details.
+ Also see contrib/findssl.sh for help identifying header/library mismatches.])
++ ],[
++ AC_MSG_RESULT(unknown)
++ AC_MSG_WARN(Skipping OpenSSL version comparison due to crosscompilation.)
+ ]
+ )
+
+@@ -572,6 +581,10 @@
+ [
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(OpenNTPd requires a self-seeding OpenSSL)
++ ],
++ [
++ AC_MSG_RESULT(cross, assuming yes)
++ OPENSSL_SEEDS_ITSELF=yes
+ ]
+ )
+ fi
diff --git a/recipes/openntpd/files/init b/recipes/openntpd/files/init
new file mode 100644
index 0000000000..745f1701aa
--- /dev/null
+++ b/recipes/openntpd/files/init
@@ -0,0 +1,37 @@
+#! /bin/sh
+#
+# This is an init script for openembedded
+# Copy it to /etc/init.d/samba and type
+# > update-rc.d init defaults 61
+#
+
+ntpd=/usr/sbin/ntpd
+test -x "$ntpd" || exit 0
+[ ! -d /var/shared/empty ] && mkdir -p /var/shared/empty
+
+case "$1" in
+ start)
+ echo "Starting openntpd"
+ start-stop-daemon --start --quiet --exec $ntpd -- -s
+ ;;
+ stop)
+ echo "Stopping openntpd"
+ start-stop-daemon --stop --quiet --exec $ntpd
+ ;;
+ reload|force-reload)
+ echo "Reloading openntpd"
+ start-stop-daemon --stop --quiet --signal 1 --exec $ntpd
+ ;;
+ restart)
+ echo "Stopping openntpd"
+ start-stop-daemon --stop --quiet --exec $ntpd
+ sleep 1
+ echo "Starting openntpd"
+ start-stop-daemon --start --quiet --exec $ntpd -- -s
+ ;;
+ *)
+ echo "Usage: /etc/init.d/openntpd {start|stop|reload|restart|force-reload}"
+ exit 1
+esac
+
+exit 0
diff --git a/recipes/openntpd/files/makefile-install.patch b/recipes/openntpd/files/makefile-install.patch
new file mode 100644
index 0000000000..b11c1aedd3
--- /dev/null
+++ b/recipes/openntpd/files/makefile-install.patch
@@ -0,0 +1,29 @@
+--- openntpd-3.7p1/Makefile.in.original 2005-07-02 06:08:47.795870784 +0200
++++ openntpd-3.7p1/Makefile.in 2005-07-02 06:15:34.768001616 +0200
+@@ -78,26 +78,6 @@
+ else \
+ echo "$(DESTDIR)$(sysconfdir)/ntpd.conf already exists, install will not overwrite"; \
+ fi
+- @if [ ! -d $(DESTDIR)$(PRIVSEP_PATH) ]; then \
+- mkdir -p $(DESTDIR)$(PRIVSEP_PATH) ;\
+- chown 0 $(DESTDIR)$(PRIVSEP_PATH) ; \
+- chgrp 0 $(DESTDIR)$(PRIVSEP_PATH) ; \
+- chmod 0755 $(DESTDIR)$(PRIVSEP_PATH) ; \
+- fi
+- @if grep "$(PRIVSEP_USER):" /etc/group >/dev/null; then \
+- : ;\
+- else \
+- echo "Please create a dedicated group for ntpd." ;\
+- echo "This is system-dependant, possibly:" ;\
+- echo "# groupadd $(PRIVSEP_USER)" ;\
+- fi
+- @if grep "$(PRIVSEP_USER):" /etc/passwd >/dev/null; then \
+- : ;\
+- else \
+- echo "Please create a dedicated user for ntpd and ensure it can" ;\
+- echo "not be used to log in. This is system-dependant, possibly:" ;\
+- echo "# useradd -g $(PRIVSEP_USER) -s /sbin/nologin -d $(PRIVSEP_PATH) -c 'OpenNTP daemon' $(PRIVSEP_USER)" ;\
+- fi
+
+ diff:
+ -diff -x CVS -x Makefile -ru /usr/src/usr.sbin/ntpd ./ | \