Initial Commit
- initial default booting image
This commit is contained in:
27
package/ntp/0001-ntp-syscalls-fallback.patch
Normal file
27
package/ntp/0001-ntp-syscalls-fallback.patch
Normal file
@@ -0,0 +1,27 @@
|
||||
inline ntp syscalls fallback
|
||||
|
||||
Upstream: https://bugs.ntp.org/show_bug.cgi?id=769
|
||||
|
||||
Signed-off-by: James Knight <james.knight@rockwellcollins.com>
|
||||
---
|
||||
configure.ac | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: ntp-4.2.8p17/configure.ac
|
||||
===================================================================
|
||||
--- ntp-4.2.8p17.orig/configure.ac
|
||||
+++ ntp-4.2.8p17/configure.ac
|
||||
@@ -1472,11 +1472,11 @@ AC_CACHE_CHECK(
|
||||
[ntp_cv_var_ntp_syscalls],
|
||||
[
|
||||
ntp_cv_var_ntp_syscalls=no
|
||||
- case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex" in
|
||||
+ case "$ac_cv_func_ntp_adjtime$ac_cv_func_ntp_gettime$ac_cv_func___adjtimex$ac_cv_func_adjtimex" in
|
||||
yesyes*)
|
||||
ntp_cv_var_ntp_syscalls=libc
|
||||
;;
|
||||
- *yes)
|
||||
+ *yesyes | *yesno | *noyes)
|
||||
ntp_cv_var_ntp_syscalls=inline
|
||||
;;
|
||||
*)
|
||||
26
package/ntp/0002-fix-pthread-detach-check.patch
Normal file
26
package/ntp/0002-fix-pthread-detach-check.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
fix pthread_detach check
|
||||
|
||||
Upstream: https://bugs.ntp.org/show_bug.cgi?id=3926
|
||||
|
||||
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
|
||||
---
|
||||
sntp/m4/openldap-thread-check.m4 | 6 ++----
|
||||
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
Index: ntp-4.2.8p17/sntp/m4/openldap-thread-check.m4
|
||||
===================================================================
|
||||
--- ntp-4.2.8p17.orig/sntp/m4/openldap-thread-check.m4
|
||||
+++ ntp-4.2.8p17/sntp/m4/openldap-thread-check.m4
|
||||
@@ -262,10 +262,8 @@ pthread_rwlock_t rwlock;
|
||||
dnl save the flags
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <pthread.h>
|
||||
-#ifndef NULL
|
||||
-#define NULL (void*)0
|
||||
-#endif
|
||||
-]], [[pthread_detach(NULL);]])],[ol_cv_func_pthread_detach=yes],[ol_cv_func_pthread_detach=no])
|
||||
+pthread_t thread;
|
||||
+]], [[pthread_detach(thread);]])],[ol_cv_func_pthread_detach=yes],[ol_cv_func_pthread_detach=no])
|
||||
])
|
||||
|
||||
if test $ol_cv_func_pthread_detach = no ; then
|
||||
209
package/ntp/0003-fix-md5update.patch
Normal file
209
package/ntp/0003-fix-md5update.patch
Normal file
@@ -0,0 +1,209 @@
|
||||
Fix build with -Wincompatible-pointer-types -Werror
|
||||
|
||||
Upstream: https://people.nwtime.org/hart/ntp-stable-3928-29.tar.gz
|
||||
|
||||
Ported fix from updated tarball provided by upstream:
|
||||
https://bugs.ntp.org/show_bug.cgi?id=3929#c9
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
|
||||
diff -uNr ntp-4.2.8p18.orig/include/ntp_md5.h ntp-4.2.8p18/include/ntp_md5.h
|
||||
--- ntp-4.2.8p18.orig/include/ntp_md5.h 2024-05-07 13:21:16.000000000 +0200
|
||||
+++ ntp-4.2.8p18/include/ntp_md5.h 2024-07-24 01:26:46.000000000 +0200
|
||||
@@ -1,56 +1,73 @@
|
||||
/*
|
||||
* ntp_md5.h: deal with md5.h headers
|
||||
*
|
||||
- * Use the system MD5 if available, otherwise libisc's.
|
||||
+ * Use the system MD5 if available, otherwise use libisc's.
|
||||
+ * Yes, MD5 has been deprecated. Nevertheless, ntpd IPv6 refid
|
||||
+ * calculation uses MD5 to derive a 32-bit refid from a 128-bit
|
||||
+ * IPv6 address. This use is retained to avoid breaking loop
|
||||
+ * detection that would be triggered by such change, and because
|
||||
+ * we are not depending on cryptographic strength for such use.
|
||||
*/
|
||||
#ifndef NTP_MD5_H
|
||||
#define NTP_MD5_H
|
||||
|
||||
/* Use the system MD5 or fall back on libisc's */
|
||||
-# if defined HAVE_MD5_H && defined HAVE_MD5INIT
|
||||
-# include <md5.h>
|
||||
-# else
|
||||
-# include "isc/md5.h"
|
||||
- typedef isc_md5_t MD5_CTX;
|
||||
-# define MD5_DIGEST_LENGTH ISC_MD5_DIGESTLENGTH
|
||||
-# define MD5Init(c) isc_md5_init(c)
|
||||
-# define MD5Update(c, p, s) isc_md5_update(c, (const void *)p, s)
|
||||
-# define MD5Final(d, c) isc_md5_final((c), (d)) /* swapped */
|
||||
-# endif
|
||||
-
|
||||
-# define KEY_TYPE_MD5 NID_md5
|
||||
+#if defined HAVE_MD5_H && defined HAVE_MD5INIT
|
||||
+# include <md5.h>
|
||||
+# define ntp_md5_init(c) MD5Init(c)
|
||||
+# define ntp_md5_update(c, p, s) MD5Update(c, (const void *)(p), s)
|
||||
+# define ntp_md5_final(d, c) MD5Final(d, c)
|
||||
+#else
|
||||
+# include "isc/md5.h"
|
||||
+typedef isc_md5_t MD5_CTX;
|
||||
+# define MD5_DIGEST_LENGTH ISC_MD5_DIGESTLENGTH
|
||||
+# define ntp_md5_init(c) isc_md5_init(c)
|
||||
+# define ntp_md5_update(c, p, s) isc_md5_update(c, (const void *)(p), s)
|
||||
+# define ntp_md5_final(d, c) isc_md5_final((c), (d)) /* swapped */
|
||||
+#endif
|
||||
|
||||
#ifdef OPENSSL
|
||||
# include <openssl/evp.h>
|
||||
# include "libssl_compat.h"
|
||||
# ifdef HAVE_OPENSSL_CMAC_H
|
||||
# include <openssl/cmac.h>
|
||||
-# define CMAC "AES128CMAC"
|
||||
-# define AES_128_KEY_SIZE 16
|
||||
-# endif /*HAVE_OPENSSL_CMAC_H*/
|
||||
+# define CMAC "AES128CMAC"
|
||||
+# define AES_128_KEY_SIZE 16
|
||||
+# endif
|
||||
#else /* !OPENSSL follows */
|
||||
/*
|
||||
- * Provide OpenSSL-alike MD5 API if we're not using OpenSSL
|
||||
+ * Provide OpenSSL-alike MD5 API if we're not using OpenSSL. Most of this
|
||||
+ * is used only by sntp when building it --without-crypto.
|
||||
*/
|
||||
|
||||
- typedef MD5_CTX EVP_MD_CTX;
|
||||
+typedef MD5_CTX EVP_MD_CTX;
|
||||
|
||||
# define NID_md5 4 /* from openssl/objects.h */
|
||||
# define EVP_MAX_MD_SIZE MD5_DIGEST_LENGTH
|
||||
+
|
||||
+/*
|
||||
+ * The following is used only by sntp configured --without-crypto as ntpd
|
||||
+ * now uses explicit MD5 functions for MD5 uses which remain even where MD5
|
||||
+ * is unavailable in OpenSSL, such as FIPS OpenSSL. Note that FIPS may be
|
||||
+ * available in the build environment but not at runtime, as is the case
|
||||
+ * with packaged NTP binaries.
|
||||
+ * The remaining uses of MD5 are IPv6 refids and mode 6 nonces. ntpd does
|
||||
+ * go through OpenSSL when using MD5 for symmetric authentication.
|
||||
+ */
|
||||
# define EVP_MD_CTX_free(c) free(c)
|
||||
# define EVP_MD_CTX_new() calloc(1, sizeof(MD5_CTX))
|
||||
# define EVP_get_digestbynid(t) NULL
|
||||
# define EVP_md5() NULL
|
||||
# define EVP_MD_CTX_init(c)
|
||||
# define EVP_MD_CTX_set_flags(c, f)
|
||||
-# define EVP_DigestInit(c, dt) (MD5Init(c), 1)
|
||||
-# define EVP_DigestInit_ex(c, dt, i) (MD5Init(c), 1)
|
||||
-# define EVP_DigestUpdate(c, p, s) MD5Update(c, (const void *)(p), \
|
||||
- s)
|
||||
-# define EVP_DigestFinal(c, d, pdl) \
|
||||
- do { \
|
||||
- MD5Final((d), (c)); \
|
||||
- *(pdl) = MD5_LENGTH; \
|
||||
- } while (0)
|
||||
-# endif /* !OPENSSL */
|
||||
+# define EVP_DigestInit(c, dt) (ntp_md5_init(c), 1)
|
||||
+# define EVP_DigestUpdate(c, p, s) ntp_md5_update(c, p, s)
|
||||
+# define EVP_DigestFinal(c, d, pdl) \
|
||||
+ do { \
|
||||
+ ntp_md5_final((d), (c)); \
|
||||
+ *(pdl) = MD5_LENGTH; \
|
||||
+ } while (FALSE)
|
||||
+
|
||||
+#endif /* OPENSSL */
|
||||
+
|
||||
#endif /* NTP_MD5_H */
|
||||
diff -uNr ntp-4.2.8p18.orig/libntp/a_md5encrypt.c ntp-4.2.8p18/libntp/a_md5encrypt.c
|
||||
--- ntp-4.2.8p18.orig/libntp/a_md5encrypt.c 2024-05-07 13:21:31.000000000 +0200
|
||||
+++ ntp-4.2.8p18/libntp/a_md5encrypt.c 2024-07-24 01:26:46.000000000 +0200
|
||||
@@ -56,7 +56,7 @@
|
||||
static MD5_CTX md5_ctx;
|
||||
|
||||
DEBUG_INSIST(NID_md5 == nid);
|
||||
- MD5Init(&md5_ctx);
|
||||
+ ntp_md5_init(&md5_ctx);
|
||||
|
||||
return &md5_ctx;
|
||||
#else
|
||||
@@ -171,10 +171,10 @@
|
||||
if (digest->len < MD5_LENGTH) {
|
||||
msyslog(LOG_ERR, "%s", "MAC encrypt: MAC md5 buf too small.");
|
||||
} else {
|
||||
- MD5Init(ctx);
|
||||
- MD5Update(ctx, (const void *)key->buf, key->len);
|
||||
- MD5Update(ctx, (const void *)msg->buf, msg->len);
|
||||
- MD5Final(digest->buf, ctx);
|
||||
+ ntp_md5_init(ctx);
|
||||
+ ntp_md5_update(ctx, key->buf, key->len);
|
||||
+ ntp_md5_update(ctx, msg->buf, msg->len);
|
||||
+ ntp_md5_final(digest->buf, ctx);
|
||||
retlen = MD5_LENGTH;
|
||||
}
|
||||
} else {
|
||||
@@ -279,9 +279,9 @@
|
||||
return (NSRCADR(addr));
|
||||
}
|
||||
/* MD5 is not used for authentication here. */
|
||||
- MD5Init(&md5_ctx);
|
||||
- MD5Update(&md5_ctx, (void *)&SOCK_ADDR6(addr), sizeof(SOCK_ADDR6(addr)));
|
||||
- MD5Final(u.digest, &md5_ctx);
|
||||
+ ntp_md5_init(&md5_ctx);
|
||||
+ ntp_md5_update(&md5_ctx, &SOCK_ADDR6(addr), sizeof(SOCK_ADDR6(addr)));
|
||||
+ ntp_md5_final(u.digest, &md5_ctx);
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
u.addr_refid = BYTESWAP32(u.addr_refid);
|
||||
#endif
|
||||
diff -uNr ntp-4.2.8p18.orig/libntp/authreadkeys.c ntp-4.2.8p18/libntp/authreadkeys.c
|
||||
--- ntp-4.2.8p18.orig/libntp/authreadkeys.c 2024-05-07 13:21:20.000000000 +0200
|
||||
+++ ntp-4.2.8p18/libntp/authreadkeys.c 2024-07-24 01:26:46.000000000 +0200
|
||||
@@ -240,7 +240,7 @@
|
||||
keyno);
|
||||
keytype = 0;
|
||||
} else {
|
||||
- keytype = KEY_TYPE_MD5;
|
||||
+ keytype = NID_md5;
|
||||
}
|
||||
#endif /* !OPENSSL */
|
||||
|
||||
diff -uNr ntp-4.2.8p18.orig/ntpd/ntp_control.c ntp-4.2.8p18/ntpd/ntp_control.c
|
||||
--- ntp-4.2.8p18.orig/ntpd/ntp_control.c 2024-05-07 13:21:15.000000000 +0200
|
||||
+++ ntp-4.2.8p18/ntpd/ntp_control.c 2024-07-24 01:26:46.000000000 +0200
|
||||
@@ -3663,18 +3663,18 @@
|
||||
last_salt_update = current_time;
|
||||
}
|
||||
|
||||
- MD5Init(&ctx);
|
||||
- MD5Update(&ctx, salt, sizeof(salt));
|
||||
- MD5Update(&ctx, &ts_i, sizeof(ts_i));
|
||||
- MD5Update(&ctx, &ts_f, sizeof(ts_f));
|
||||
+ ntp_md5_init(&ctx);
|
||||
+ ntp_md5_update(&ctx, salt, sizeof(salt));
|
||||
+ ntp_md5_update(&ctx, &ts_i, sizeof(ts_i));
|
||||
+ ntp_md5_update(&ctx, &ts_f, sizeof(ts_f));
|
||||
if (IS_IPV4(addr)) {
|
||||
- MD5Update(&ctx, &SOCK_ADDR4(addr), sizeof(SOCK_ADDR4(addr)));
|
||||
+ ntp_md5_update(&ctx, &SOCK_ADDR4(addr), sizeof(SOCK_ADDR4(addr)));
|
||||
} else {
|
||||
- MD5Update(&ctx, &SOCK_ADDR6(addr), sizeof(SOCK_ADDR6(addr)));
|
||||
+ ntp_md5_update(&ctx, &SOCK_ADDR6(addr), sizeof(SOCK_ADDR6(addr)));
|
||||
}
|
||||
- MD5Update(&ctx, &NSRCPORT(addr), sizeof(NSRCPORT(addr)));
|
||||
- MD5Update(&ctx, salt, sizeof(salt));
|
||||
- MD5Final(d.digest, &ctx);
|
||||
+ ntp_md5_update(&ctx, &NSRCPORT(addr), sizeof(NSRCPORT(addr)));
|
||||
+ ntp_md5_update(&ctx, salt, sizeof(salt));
|
||||
+ ntp_md5_final(d.digest, &ctx);
|
||||
|
||||
return d.extract;
|
||||
}
|
||||
diff -uNr ntp-4.2.8p18.orig/ntpd/ntp_crypto.c ntp-4.2.8p18/ntpd/ntp_crypto.c
|
||||
--- ntp-4.2.8p18.orig/ntpd/ntp_crypto.c 2024-05-07 13:21:32.000000000 +0200
|
||||
+++ ntp-4.2.8p18/ntpd/ntp_crypto.c 2024-07-24 01:26:46.000000000 +0200
|
||||
@@ -150,7 +150,7 @@
|
||||
* Global cryptodata in host byte order
|
||||
*/
|
||||
u_int32 crypto_flags = 0x0; /* status word */
|
||||
-int crypto_nid = KEY_TYPE_MD5; /* digest nid */
|
||||
+int crypto_nid = NID_md5; /* digest nid */
|
||||
char *sys_hostname = NULL;
|
||||
char *sys_groupname = NULL;
|
||||
static char *host_filename = NULL; /* host file name */
|
||||
38
package/ntp/0004-Fix-crash-when-binding-IPv6-address.patch
Normal file
38
package/ntp/0004-Fix-crash-when-binding-IPv6-address.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
Fix crash when binding IPv6 address
|
||||
|
||||
Reference:
|
||||
https://bugs.ntp.org/show_bug.cgi?id=3928
|
||||
|
||||
Upstream: https://people.nwtime.org/hart/ntp-stable-3928-29.tar.gz
|
||||
|
||||
Ported fix from updated tarball provided by upstream:
|
||||
https://bugs.ntp.org/show_bug.cgi?id=3928#c14
|
||||
|
||||
Signed-off-by: TIAN Yuanhao <tianyuanhao3@163.com>
|
||||
---
|
||||
ntpd/ntp_io.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: ntp-4.2.8p18/ntpd/ntp_io.c
|
||||
===================================================================
|
||||
--- ntp-4.2.8p18.orig/ntpd/ntp_io.c
|
||||
+++ ntp-4.2.8p18/ntpd/ntp_io.c
|
||||
@@ -1917,15 +1917,15 @@ update_interfaces(
|
||||
}
|
||||
new_interface_found = TRUE;
|
||||
DPRINT_INTERFACE(3,
|
||||
- (ep, "updating ", " new - created\n"));
|
||||
+ (ep2, "updating ", " new - created\n"));
|
||||
}
|
||||
else {
|
||||
DPRINT_INTERFACE(3,
|
||||
- (ep, "updating ", " new - FAILED"));
|
||||
+ (ep2, "updating ", " new - FAILED"));
|
||||
|
||||
msyslog(LOG_ERR,
|
||||
"cannot bind address %s",
|
||||
- stoa(&ep->sin));
|
||||
+ stoa(&ep2->sin));
|
||||
}
|
||||
free(ep2);
|
||||
}
|
||||
18
package/ntp/0005-fix-openssl-configure.patch
Normal file
18
package/ntp/0005-fix-openssl-configure.patch
Normal file
@@ -0,0 +1,18 @@
|
||||
Fix OpenSSL detection
|
||||
|
||||
Upstream: https://bugs.ntp.org/show_bug.cgi?id=3985
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
|
||||
diff -uNr ntp-4.2.8p18.orig/sntp/m4/ntp_openssl.m4 ntp-4.2.8p18/sntp/m4/ntp_openssl.m4
|
||||
--- ntp-4.2.8p18.orig/sntp/m4/ntp_openssl.m4 2024-05-07 13:21:14.000000000 +0200
|
||||
+++ ntp-4.2.8p18/sntp/m4/ntp_openssl.m4 2025-07-06 08:37:14.140657598 +0200
|
||||
@@ -326,7 +326,7 @@
|
||||
not_found) ;;
|
||||
*)
|
||||
AC_MSG_NOTICE([Searching for libcrypto in $i])
|
||||
- LIBS="-L$i $NTPSSL_SAVED_LIBS"
|
||||
+ LIBS="-L$i $ntp_ssl_libs_l $NTPSSL_SAVED_LIBS"
|
||||
AC_CHECK_LIB(
|
||||
[crypto],
|
||||
[EVP_MD_CTX_new],
|
||||
21
package/ntp/0006-stime.patch
Normal file
21
package/ntp/0006-stime.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
Fix stime build error with gcc-14:
|
||||
|
||||
machines.c: In function 'ntp_set_tod':
|
||||
machines.c:484:28: error: passing argument 1 of 'stime' from incompatible pointer type [-Wincompatible-pointer-types]
|
||||
484 | rc = stime(&tp); /* lie as bad as SysVR4 */
|
||||
|
||||
Upstream: https://bugs.ntp.org/show_bug.cgi?id=3981#c2
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
|
||||
--- a/libntp/machines.c 2025-05-26 18:21:43 +0000
|
||||
+++ a/libntp/machines.c 2025-05-26 18:21:43 +0000
|
||||
@@ -478,7 +478,7 @@
|
||||
#endif /* HAVE_SETTIMEOFDAY */
|
||||
#ifdef HAVE_STIME
|
||||
if (rc && (SET_TOD_STIME == tod || !tod)) {
|
||||
- long tp = tvp->tv_sec;
|
||||
+ time_t tp = tvp->tv_sec;
|
||||
|
||||
errno = 0;
|
||||
rc = stime(&tp); /* lie as bad as SysVR4 */
|
||||
42
package/ntp/0007-memchr.patch
Normal file
42
package/ntp/0007-memchr.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
Fix build with glibc 2.43
|
||||
|
||||
sntp/crypto.c includes sntp/config.h, then sntp/crypto.h which includes
|
||||
ntp_stdlib.h which in turn includes l_stdlib.h that contains
|
||||
|
||||
#ifndef HAVE_MEMCHR
|
||||
extern void *memchr(const void *s, int c, size_t n);
|
||||
#endif
|
||||
|
||||
and breaks the build with glibc 2.43:
|
||||
|
||||
./../include/l_stdlib.h:225:14: error: expected identifier or '(' before '_Generic'
|
||||
225 | extern void *memchr(const void *s, int c, size_t n);
|
||||
|
||||
sntp/config.h does not contain any information about memchr() while the
|
||||
top-level config.h does but this top-level config.h is not included
|
||||
because sntp/Makefile lacks -I$(top_builddir) so sntp/config.h gets
|
||||
included which does not define HAVE_MEMCHR although glibc does provide
|
||||
memchr() but sntp/configure lacks a check for memchr().
|
||||
|
||||
This was not a problem with previous glibc versions but due to recent
|
||||
C23 changes in glibc the ntp build is now broken.
|
||||
|
||||
To fix the problem we add a configure check for memchr() to
|
||||
sntp/configure so HAVE_MEMCHR gets defined in sntp/config.h.
|
||||
|
||||
Upstream: https://bugs.ntp.org/show_bug.cgi?id=4015
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
|
||||
diff -uNr ntp-4.2.8p18/sntp/m4/ntp_libntp.m4 ntp-4.2.8p18/sntp/m4/ntp_libntp.m4
|
||||
--- ntp-4.2.8p18/sntp/m4/ntp_libntp.m4 2024-05-07 13:21:13.000000000 +0200
|
||||
+++ ntp-4.2.8p18/sntp/m4/ntp_libntp.m4 2026-02-19 21:50:37.291724180 +0100
|
||||
@@ -77,7 +77,7 @@
|
||||
;;
|
||||
esac
|
||||
|
||||
-AC_CHECK_FUNCS([getclock stime timegm strlcpy strlcat])
|
||||
+AC_CHECK_FUNCS([getclock memchr stime timegm strlcpy strlcat])
|
||||
|
||||
# Bug 2713
|
||||
LDADD_LIBUTIL=
|
||||
102
package/ntp/Config.in
Normal file
102
package/ntp/Config.in
Normal file
@@ -0,0 +1,102 @@
|
||||
config BR2_PACKAGE_NTP
|
||||
bool "ntp"
|
||||
depends on BR2_USE_MMU || BR2_TOOLCHAIN_HAS_THREADS
|
||||
select BR2_PACKAGE_LIBEVENT
|
||||
help
|
||||
Network Time Protocol suite/programs.
|
||||
Provides things like ntpd, ntpdate, ntpq, etc...
|
||||
|
||||
http://www.ntp.org/
|
||||
|
||||
if BR2_PACKAGE_NTP
|
||||
|
||||
config BR2_PACKAGE_NTP_SNTP
|
||||
bool "sntp"
|
||||
help
|
||||
Simple network time protocol program (a replacement
|
||||
for the ntpdate tool)
|
||||
|
||||
A script is installed as S48sntp which will retrieve and
|
||||
step the time if there is a large difference before ntpd
|
||||
takes over the necessary slew adjustments in S49ntp.
|
||||
|
||||
config BR2_PACKAGE_NTP_NTP_KEYGEN
|
||||
bool "ntp-keygen"
|
||||
help
|
||||
Create a NTP host key
|
||||
|
||||
config BR2_PACKAGE_NTP_NTP_SHM_CLK
|
||||
bool "SHM clock support"
|
||||
help
|
||||
Compile ntp with support for a SHM clock attached through
|
||||
shared memory.
|
||||
|
||||
config BR2_PACKAGE_NTP_NTP_WAIT
|
||||
bool "ntp-wait"
|
||||
depends on BR2_PACKAGE_PERL
|
||||
help
|
||||
ntp-wait waits until the locally running ntpd is in state 4
|
||||
(synchronized). This could be useful at boot time, to delay
|
||||
the boot sequence until after "ntpd -g" has set the time.
|
||||
|
||||
config BR2_PACKAGE_NTP_NTPD
|
||||
bool "ntpd"
|
||||
default y
|
||||
help
|
||||
ntpd is the time synchronization daemon keeping your local
|
||||
system date and time in sync and optionally serving time and
|
||||
date information on the network via the NTP protocol.
|
||||
|
||||
config BR2_PACKAGE_NTP_NTPD_ATOM_PPS
|
||||
bool "PPS support"
|
||||
depends on BR2_PACKAGE_NTP_NTPD
|
||||
select BR2_PACKAGE_PPS_TOOLS
|
||||
help
|
||||
Compile ntpd with the ability to use an ATOM PPS source.
|
||||
|
||||
config BR2_PACKAGE_NTP_NTPDATE
|
||||
bool "ntpdate"
|
||||
help
|
||||
The ntpdate utility program is used to set the local date
|
||||
and time from an NTP server given as an argument.
|
||||
|
||||
config BR2_PACKAGE_NTP_NTPDC
|
||||
bool "ntpdc"
|
||||
help
|
||||
The ntpdc utility program is used to query an NTP daemon about
|
||||
its current state and to request changes in that state.
|
||||
|
||||
config BR2_PACKAGE_NTP_NTPQ
|
||||
bool "ntpq"
|
||||
help
|
||||
The ntpq utility program is used to query NTP servers
|
||||
requesting information about current state and/or changes in
|
||||
that state.
|
||||
|
||||
config BR2_PACKAGE_NTP_NTPSNMPD
|
||||
bool "ntpsnmpd"
|
||||
depends on BR2_USE_MMU # netsnmp fork()
|
||||
select BR2_PACKAGE_NETSNMP
|
||||
help
|
||||
Install ntpsnmpd NTP SNMP MIB agent.
|
||||
|
||||
config BR2_PACKAGE_NTP_NTPTIME
|
||||
bool "ntptime"
|
||||
help
|
||||
The ntptime utility program is used to read and set kernel
|
||||
time variables.
|
||||
|
||||
config BR2_PACKAGE_NTP_NTPTRACE
|
||||
bool "ntptrace"
|
||||
depends on BR2_PACKAGE_PERL
|
||||
help
|
||||
ntptrace is a perl script that uses the ntpq utility program
|
||||
to follow the chain of NTP servers from a given host back to
|
||||
the primary time source
|
||||
|
||||
config BR2_PACKAGE_NTP_TICKADJ
|
||||
bool "tickadj"
|
||||
help
|
||||
set time-related kernel variables
|
||||
|
||||
endif
|
||||
55
package/ntp/S48sntp
Normal file
55
package/ntp/S48sntp
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="sntp"
|
||||
# sntp uses all the IPs resolved for the hostname (i.e. pool.ntp.org has 4).
|
||||
# It will try each until they either all timeout or time has been set. Thus
|
||||
# default to only providing one NTP pool host.
|
||||
SNTP_SERVERS="pool.ntp.org"
|
||||
# Step if time delta is greater then 128ms, otherwise slew
|
||||
SNTP_ARGS="-Ss -M 128"
|
||||
SNTP_KEY_CACHE="/tmp/kod"
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# Create key cache file to prevents warning that file is missing
|
||||
touch $SNTP_KEY_CACHE
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
/usr/bin/$DAEMON $SNTP_ARGS -K $SNTP_KEY_CACHE $SNTP_SERVERS
|
||||
# sntp behavior
|
||||
# - Does not background
|
||||
# - Does not infinitely block
|
||||
# - Time-out w/o network = ~2 sec
|
||||
# - Time-out w/ network = ~5sec * # of servers
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo "Nothing to do, $DAEMON is not a daemon."
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
}
|
||||
|
||||
reload() {
|
||||
echo "Nothing to do, $DAEMON does not support reload."
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart|reload)
|
||||
"$1";;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
56
package/ntp/S49ntp.in
Normal file
56
package/ntp/S49ntp.in
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Starts Network Time Protocol daemon
|
||||
#
|
||||
|
||||
DAEMON="ntpd"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
NTPD_ARGS="@NTPD_EXTRA_ARGS@ -g"
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \
|
||||
-- $NTPD_ARGS -p "$PIDFILE"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "$DAEMON"
|
||||
start-stop-daemon -K -q -p "$PIDFILE"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
rm -f "$PIDFILE"
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
4
package/ntp/ntp.hash
Normal file
4
package/ntp/ntp.hash
Normal file
@@ -0,0 +1,4 @@
|
||||
# From https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2.8p18.tar.gz.sha256
|
||||
sha256 cf84c5f3fb1a295284942624d823fffa634144e096cfc4f9969ac98ef5f468e5 ntp-4.2.8p18.tar.gz
|
||||
# Locally computed
|
||||
sha256 45b6e5a0a5f0ac4afdd9e23caa2241779e4da463e4dba32a41b4dbd61577b2a3 COPYRIGHT
|
||||
139
package/ntp/ntp.mk
Normal file
139
package/ntp/ntp.mk
Normal file
@@ -0,0 +1,139 @@
|
||||
################################################################################
|
||||
#
|
||||
# ntp
|
||||
#
|
||||
################################################################################
|
||||
|
||||
NTP_VERSION_MAJOR = 4.2
|
||||
NTP_VERSION_MINOR = 8
|
||||
NTP_VERSION_POINT = 18
|
||||
NTP_VERSION = $(NTP_VERSION_MAJOR).$(NTP_VERSION_MINOR)p$(NTP_VERSION_POINT)
|
||||
NTP_SITE = https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-$(NTP_VERSION_MAJOR)
|
||||
NTP_DEPENDENCIES = host-pkgconf libevent
|
||||
NTP_LICENSE = NTP
|
||||
NTP_LICENSE_FILES = COPYRIGHT
|
||||
NTP_CPE_ID_VENDOR = ntp
|
||||
NTP_CPE_ID_VERSION = $(NTP_VERSION_MAJOR).$(NTP_VERSION_MINOR)
|
||||
NTP_CPE_ID_UPDATE = p$(NTP_VERSION_POINT)
|
||||
NTP_SELINUX_MODULES = ntp
|
||||
NTP_CONF_ENV = ac_cv_lib_md5_MD5Init=no POSIX_SHELL=/bin/sh
|
||||
NTP_CONF_OPTS = \
|
||||
--with-shared \
|
||||
--program-transform-name=s,,, \
|
||||
--disable-tickadj \
|
||||
--disable-debugging \
|
||||
--with-yielding-select=yes \
|
||||
--disable-local-libevent
|
||||
|
||||
# NVD Entry incorrectly match on every patch revision. Fixed in 4.2.8p6.
|
||||
NTP_IGNORE_CVES += CVE-2015-7977
|
||||
|
||||
# 0002-ntp-syscalls-fallback.patch
|
||||
NTP_AUTORECONF = YES
|
||||
|
||||
ifeq ($(BR2_PACKAGE_OPENSSL),y)
|
||||
NTP_CONF_OPTS += --with-crypto --enable-openssl-random --enable-verbose-ssl
|
||||
NTP_DEPENDENCIES += openssl
|
||||
else
|
||||
NTP_CONF_OPTS += --without-crypto --disable-openssl-random
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_TOOLCHAIN_HAS_SSP),y)
|
||||
NTP_CONF_OPTS += --with-hardenfile=linux
|
||||
else
|
||||
NTP_CONF_OPTS += --with-hardenfile=default
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LIBCAP),y)
|
||||
NTP_CONF_OPTS += --enable-linuxcaps
|
||||
NTP_DEPENDENCIES += libcap
|
||||
define NTP_USERS
|
||||
ntp -1 ntp -1 * - - - ntpd user
|
||||
endef
|
||||
NTP_DAEMON_EXTRA_ARGS = -u ntp:ntp
|
||||
else
|
||||
NTP_CONF_OPTS += --disable-linuxcaps
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LIBEDIT),y)
|
||||
NTP_CONF_OPTS += --with-lineeditlibs=edit
|
||||
NTP_DEPENDENCIES += libedit
|
||||
else
|
||||
NTP_CONF_OPTS += --without-lineeditlibs
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_NTP_NTPSNMPD),y)
|
||||
NTP_CONF_OPTS += \
|
||||
--with-net-snmp-config=$(STAGING_DIR)/usr/bin/net-snmp-config
|
||||
NTP_DEPENDENCIES += netsnmp
|
||||
else
|
||||
NTP_CONF_OPTS += --without-ntpsnmpd
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_NTP_NTPD_ATOM_PPS),y)
|
||||
NTP_CONF_OPTS += --enable-ATOM
|
||||
NTP_DEPENDENCIES += pps-tools
|
||||
else
|
||||
NTP_CONF_OPTS += --disable-ATOM
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_NTP_NTP_SHM_CLK),y)
|
||||
NTP_CONF_OPTS += --enable-SHM
|
||||
else
|
||||
NTP_CONF_OPTS += --disable-SHM
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_NTP_SNTP),y)
|
||||
NTP_CONF_OPTS += --with-sntp
|
||||
else
|
||||
NTP_CONF_OPTS += --without-sntp
|
||||
endif
|
||||
|
||||
NTP_INSTALL_FILES_$(BR2_PACKAGE_NTP_NTP_KEYGEN) += util/ntp-keygen
|
||||
NTP_INSTALL_FILES_$(BR2_PACKAGE_NTP_NTP_WAIT) += scripts/ntp-wait/ntp-wait
|
||||
NTP_INSTALL_FILES_$(BR2_PACKAGE_NTP_NTPDATE) += ntpdate/ntpdate
|
||||
NTP_INSTALL_FILES_$(BR2_PACKAGE_NTP_NTPDC) += ntpdc/ntpdc
|
||||
NTP_INSTALL_FILES_$(BR2_PACKAGE_NTP_NTPQ) += ntpq/ntpq
|
||||
NTP_INSTALL_FILES_$(BR2_PACKAGE_NTP_NTPSNMPD) += ntpsnmpd/ntpsnmpd
|
||||
NTP_INSTALL_FILES_$(BR2_PACKAGE_NTP_NTPTIME) += util/ntptime
|
||||
NTP_INSTALL_FILES_$(BR2_PACKAGE_NTP_NTPTRACE) += scripts/ntptrace/ntptrace
|
||||
NTP_INSTALL_FILES_$(BR2_PACKAGE_NTP_SNTP) += sntp/sntp
|
||||
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
|
||||
endef
|
||||
|
||||
# This script will step the time if there is a large difference
|
||||
# before ntpd takes over the necessary slew adjustments
|
||||
ifeq ($(BR2_PACKAGE_NTP_SNTP),y)
|
||||
define NTP_INSTALL_INIT_SYSV_SNTP
|
||||
$(INSTALL) -D -m 755 package/ntp/S48sntp $(TARGET_DIR)/etc/init.d/S48sntp
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_NTP_NTPD),y)
|
||||
define NTP_INSTALL_INIT_SYSV_NTPD
|
||||
mkdir -p $(TARGET_DIR)/etc/init.d
|
||||
sed -e 's%@NTPD_EXTRA_ARGS@%$(NTP_DAEMON_EXTRA_ARGS)%g' \
|
||||
package/ntp/S49ntp.in \
|
||||
> $(TARGET_DIR)/etc/init.d/S49ntp
|
||||
chmod 0755 $(TARGET_DIR)/etc/init.d/S49ntp
|
||||
endef
|
||||
|
||||
define NTP_INSTALL_INIT_SYSTEMD
|
||||
mkdir -p $(TARGET_DIR)/usr/lib/systemd/system
|
||||
sed -e 's%@NTPD_EXTRA_ARGS@%$(NTP_DAEMON_EXTRA_ARGS)%g' \
|
||||
package/ntp/ntpd.service.in \
|
||||
> $(TARGET_DIR)/usr/lib/systemd/system/ntpd.service
|
||||
endef
|
||||
endif
|
||||
|
||||
define NTP_INSTALL_INIT_SYSV
|
||||
$(NTP_INSTALL_INIT_SYSV_NTPD)
|
||||
$(NTP_INSTALL_INIT_SYSV_SNTP)
|
||||
endef
|
||||
|
||||
$(eval $(autotools-package))
|
||||
10
package/ntp/ntpd.etc.conf
Normal file
10
package/ntp/ntpd.etc.conf
Normal file
@@ -0,0 +1,10 @@
|
||||
server 0.pool.ntp.org iburst
|
||||
server 1.pool.ntp.org iburst
|
||||
server 2.pool.ntp.org iburst
|
||||
server 3.pool.ntp.org iburst
|
||||
|
||||
# Allow only time queries, at a limited rate, sending KoD when in excess.
|
||||
# Allow all local queries (IPv4, IPv6)
|
||||
restrict default nomodify nopeer noquery limited kod
|
||||
restrict 127.0.0.1
|
||||
restrict [::1]
|
||||
15
package/ntp/ntpd.service.in
Normal file
15
package/ntp/ntpd.service.in
Normal file
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=Network Time Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
PIDFile=/run/ntpd.pid
|
||||
# Turn off DNSSEC validation for hostname look-ups, since those need the
|
||||
# correct time to work, but we likely won't acquire that without NTP. Let's
|
||||
# break this chicken-and-egg cycle here.
|
||||
Environment=SYSTEMD_NSS_RESOLVE_VALIDATE=0
|
||||
ExecStart=/usr/sbin/ntpd @NTPD_EXTRA_ARGS@ -g -p /run/ntpd.pid
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user