[packages/ntp] - updated to 4.2.8p18

qboosh qboosh at pld-linux.org
Fri May 16 21:55:28 CEST 2025


commit 5358821825c2f4072698ae659118684b93f43bc6
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Fri May 16 21:50:46 2025 +0200

    - updated to 4.2.8p18

 ntp-4.2.6p1-bcast.patch        |  93 --------
 ntp-4.2.6p1-cmsgalign.patch    |  14 --
 ntp-4.2.6p1-linkfastmath.patch |  12 -
 ntp-4.2.6p1-mlock.patch        | 140 ------------
 ntp-4.2.6p1-sleep.patch        | 495 -----------------------------------------
 ntp-openssl.patch              |  61 +++++
 ntp.spec                       |  42 ++--
 threadstack-sysconf.patch      |  29 ---
 8 files changed, 78 insertions(+), 808 deletions(-)
---
diff --git a/ntp.spec b/ntp.spec
index 835b26f..eb72b57 100644
--- a/ntp.spec
+++ b/ntp.spec
@@ -13,12 +13,13 @@ Summary:	Network Time Protocol utilities
 Summary(pl.UTF-8):	Narzędzia do synchronizacji czasu (Network Time Protocol)
 Summary(pt_BR.UTF-8):	Network Time Protocol versão 4
 Name:		ntp
-Version:	4.2.8p15
+Version:	4.2.8p18
 Release:	1
 License:	distributable
 Group:		Networking/Daemons
+# also https://downloads.nwtime.org/ntp/
 Source0:	https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/%{name}-%{version}.tar.gz
-# Source0-md5:	e1e6b23d2fc75cced41801dbcd6c2561
+# Source0-md5:	516bdabd94ab7c824e9771390761a46c
 Source1:	%{name}.conf
 Source2:	%{name}.keys
 Source3:	%{name}d.init
@@ -36,17 +37,12 @@ Patch0:		%{name}-build.patch
 Patch1:		%{name}-no_libelf.patch
 Patch2:		%{name}-ipv6.patch
 Patch3:		%{name}-nano.patch
-Patch4:		threadstack-sysconf.patch
+Patch4:		%{name}-openssl.patch
 # FC patches + 100
-Patch101:	%{name}-4.2.6p1-sleep.patch
 Patch102:	%{name}-4.2.6p1-droproot.patch
-Patch103:	%{name}-4.2.6p1-bcast.patch
-Patch104:	%{name}-4.2.6p1-cmsgalign.patch
-Patch105:	%{name}-4.2.6p1-linkfastmath.patch
 Patch107:	%{name}-4.2.6p1-retcode.patch
 Patch108:	%{name}-4.2.6p1-rtnetlink.patch
 Patch110:	%{name}-logdefault.patch
-Patch111:	%{name}-4.2.6p1-mlock.patch
 URL:		http://www.ntp.org/
 BuildRequires:	autoconf >= 2.61
 BuildRequires:	autogen-devel >= 5.18.12
@@ -63,6 +59,7 @@ BuildRequires:	pciutils-devel
 # AUTO: -- checking for pkg-config... no
 BuildRequires:	pkgconfig
 BuildRequires:	readline-devel >= 4.2
+BuildRequires:	rpm-build >= 4.6
 BuildRequires:	rpm-perlprov >= 4.1-13
 BuildRequires:	rpmbuild(macros) >= 1.626
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -207,7 +204,7 @@ Podagent SNMP AgentX NTP dla usługi Net-SNMP.
 Summary:	NTP tools
 Summary(pl.UTF-8):	Narzędzia NTP
 Group:		Applications/Networking
-Obsoletes:	ntp-ntptrace
+Obsoletes:	ntp-ntptrace < 4.2.4p3-3
 
 %description tools
 This package contains NTP tools:
@@ -246,15 +243,10 @@ Este pacote contém documentação adicional sobre o NTP versão 4.
 %patch -P4 -p1
 
 ## FC patches
-#%patch -P101 -p1
 %patch -P102 -p1
-#%patch -P103 -p1
-%patch -P104 -p1
-%patch -P105 -p1
 %patch -P107 -p1
 %patch -P108 -p1
 %patch -P110 -p1
-#%patch -P111 -p1  -- obsolete?
 
 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> configure.ac
 echo 'AM_CONDITIONAL([NEED_LIBOPTS], false)' >> sntp/configure.ac
@@ -280,25 +272,25 @@ cd ../..
 
 CPPFLAGS="%{rpmcppflags} -I/usr/include/readline"
 %configure \
-	--disable-silent-rules \
-	--with-binsubdir=sbin \
-	--enable-linuxcaps \
 	--enable-getifaddrs \
-	%{?with_seccomp:--enable-libseccomp} \
-	%{__with_without sntp} \
 	--enable-ipv6 \
+	%{?with_seccomp:--enable-libseccomp} \
+	--enable-linuxcaps \
+	--disable-local-libopts \
+	--disable-local-libevent \
 	--enable-ntp-signd \
+	--disable-silent-rules \
+	--with-binsubdir=sbin \
+	--with-crypto \
 	--with-lineeditlibs=readline \
-	--with-crypto=openssl \
-	--disable-local-libopts \
-	--disable-local-libevent
+	%{__with_without sntp}
 
 %{__make} -j1
 
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_mandir}/man1,%{systemdunitdir}} \
-	$RPM_BUILD_ROOT%{_libexecdir}/systemd/ntp-units.d \
+	$RPM_BUILD_ROOT/lib/systemd/ntp-units.d \
 	$RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,cron.hourly}
 
 %{__make} install \
@@ -316,8 +308,7 @@ cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/sysconfig/ntpdate
 install -p %{SOURCE10} $RPM_BUILD_ROOT%{_sbindir}/ntpdate-wrapper
 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}/ntpd.service
 cp -p %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/ntpdate.service
-echo 'ntpd.service' > \
-        $RPM_BUILD_ROOT%{_libexecdir}/systemd/ntp-units.d/50-ntpd.list
+echo 'ntpd.service' >$RPM_BUILD_ROOT/lib/systemd/ntp-units.d/50-ntpd.list
 
 cp -p man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
 
@@ -458,6 +449,7 @@ fi
 %attr(754,root,root) /etc/cron.hourly/ntpdate
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntpdate
 %{systemdunitdir}/ntpdate.service
+/lib/systemd/ntp-units.d/50-ntpd.list
 %{_mandir}/man1/ntpdate.1*
 
 %files -n mibs-ntp
diff --git a/ntp-4.2.6p1-bcast.patch b/ntp-4.2.6p1-bcast.patch
deleted file mode 100644
index 8c30cf3..0000000
--- a/ntp-4.2.6p1-bcast.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-diff -up ntp-4.2.6p1/ntpd/ntp_io.c.bcast ntp-4.2.6p1/ntpd/ntp_io.c
---- ntp-4.2.6p1/ntpd/ntp_io.c.bcast	2009-12-09 08:36:37.000000000 +0100
-+++ ntp-4.2.6p1/ntpd/ntp_io.c	2010-03-05 14:49:25.000000000 +0100
-@@ -151,6 +151,8 @@ int ninterfaces;			/* Total number of in
- 
- int disable_dynamic_updates;		/* scan interfaces once only */
- 
-+static int pktinfo_status = 0;		/* is IP_PKTINFO on wildipv4 iface enabled? */
-+
- #ifdef REFCLOCK
- /*
-  * Refclock stuff.	We keep a chain of structures with data concerning
-@@ -1937,6 +1939,17 @@ set_reuseaddr(
- #endif /* ! SO_EXCLUSIVEADDRUSE */
- }
- 
-+static void
-+set_pktinfo(int flag)
-+{
-+	if (wildipv4 == NULL)
-+		return;
-+	if (setsockopt(wildipv4->fd, SOL_IP, IP_PKTINFO, &flag, sizeof (flag))) {
-+		msyslog(LOG_ERR, "set_pktinfo: setsockopt(IP_PKTINFO, %s) failed: %m", flag ? "on" : "off");
-+	} else
-+		pktinfo_status = flag;
-+}
-+
- /*
-  * This is just a wrapper around an internal function so we can
-  * make other changes as necessary later on
-@@ -2374,6 +2387,7 @@ io_setbclient(void)
- 		}
- 	}
- 	set_reuseaddr(0);
-+	set_pktinfo(1);
- 	if (nif > 0)
- 		DPRINTF(1, ("io_setbclient: Opened broadcast clients\n"));
- 	else if (!nif)
-@@ -2405,6 +2419,7 @@ io_unsetbclient(void)
- 
- 		socket_broadcast_disable(interf, &interf->sin);
- 	}
-+	set_pktinfo(0);
- }
- 
- /*
-@@ -3130,7 +3145,8 @@ read_network_packet(
- #ifdef HAVE_TIMESTAMP
- 	struct msghdr msghdr;
- 	struct iovec iovec;
--	char control[TIMESTAMP_CTLMSGBUF_SIZE];
-+	char control[sizeof (struct cmsghdr) * 2 + sizeof (struct timeval) +
-+		sizeof (struct in_pktinfo) + 32];
- #endif
- 
- 	/*
-@@ -3141,7 +3157,7 @@ read_network_packet(
- 	 */
- 
- 	rb = get_free_recv_buffer();
--	if (NULL == rb || itf->ignore_packets) {
-+	if (NULL == rb || (itf->ignore_packets && !(pktinfo_status && itf == wildipv4))) {
- 		char buf[RX_BUFF_SIZE];
- 		sockaddr_u from;
- 
-@@ -3201,6 +3217,27 @@ read_network_packet(
- 		return (buflen);
- 	}
- 
-+	if (pktinfo_status && itf->ignore_packets && itf == wildipv4) {
-+		/* check for broadcast on 255.255.255.255, exception allowed on wildipv4 */
-+		struct cmsghdr *cmsg;
-+		struct in_pktinfo *pktinfo = NULL;
-+
-+		if ((cmsg = CMSG_FIRSTHDR(&msghdr)))
-+			do {
-+				if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_PKTINFO)
-+					pktinfo = (struct in_pktinfo *) CMSG_DATA(cmsg);
-+			} while ((cmsg = CMSG_NXTHDR(&msghdr, cmsg)));
-+		if (pktinfo && pktinfo->ipi_addr.s_addr == INADDR_BROADCAST) {
-+			DPRINTF(4, ("INADDR_BROADCAST\n"));
-+		} else {
-+			DPRINTF(4, ("%s on (%lu) fd=%d from %s\n", "ignore",
-+				free_recvbuffs(), fd, stoa(&rb->recv_srcadr)));
-+			packets_ignored++;
-+			freerecvbuf(rb);
-+			return (buflen);
-+		}
-+	}
-+
- 	DPRINTF(3, ("read_network_packet: fd=%d length %d from %s\n",
- 		    fd, buflen, stoa(&rb->recv_srcadr)));
- 
diff --git a/ntp-4.2.6p1-cmsgalign.patch b/ntp-4.2.6p1-cmsgalign.patch
deleted file mode 100644
index 0e4b8cc..0000000
--- a/ntp-4.2.6p1-cmsgalign.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff -up ntp-4.2.6p1/ntpd/ntp_io.c.cmsgalign ntp-4.2.6p1/ntpd/ntp_io.c
---- ntp-4.2.6p1/ntpd/ntp_io.c.cmsgalign	2010-03-04 18:28:53.000000000 +0100
-+++ ntp-4.2.6p1/ntpd/ntp_io.c	2010-03-04 18:30:34.000000000 +0100
-@@ -3194,8 +3194,8 @@ read_network_packet(
- 	msghdr.msg_namelen    = fromlen;
- 	msghdr.msg_iov        = &iovec;
- 	msghdr.msg_iovlen     = 1;
--	msghdr.msg_control    = (void *)&control;
--	msghdr.msg_controllen = sizeof(control);
-+	msghdr.msg_control    = (void *)((long)(control + 7) & -8); /* align to 8 bytes */
-+	msghdr.msg_controllen = sizeof(control) - 8;
- 	msghdr.msg_flags      = 0;
- 	rb->recv_length       = recvmsg(fd, &msghdr, 0);
- #endif
diff --git a/ntp-4.2.6p1-linkfastmath.patch b/ntp-4.2.6p1-linkfastmath.patch
deleted file mode 100644
index 2bc8a0b..0000000
--- a/ntp-4.2.6p1-linkfastmath.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -ruN ntp-4.2.8p3.orig/ntpd/Makefile.in ntp-4.2.8p3/ntpd/Makefile.in
---- ntp-4.2.8p3.orig/ntpd/Makefile.in	2015-06-29 22:24:11.000000000 +0200
-+++ ntp-4.2.8p3/ntpd/Makefile.in	2015-07-29 20:26:43.269520417 +0200
-@@ -647,7 +647,7 @@
- # longer a reason to have ntpdbase-opts.def split off of ntpd-opts.def.
- LDADD_NTPD_COMMON = $(LDADD_LIBNTP) $(LIBOPTS_LDADD) $(PTHREAD_LIBS) \
- 	$(LIBM) $(LDADD_NTP) $(LSCF)
--ntpd_LDADD = $(LDADD) ../libntp/libntp.a $(LDADD_NTPD_COMMON) $(LDADD_LIBUTIL)
-+ntpd_LDADD = $(LDADD) ../libntp/libntp.a $(LDADD_NTPD_COMMON) -ffast-math $(LDADD_LIBUTIL)
- ntpdsim_LDADD = $(LDADD) ../libntp/libntpsim.a $(LDADD_NTPD_COMMON)
- ntpdsim_CPPFLAGS = $(AM_CPPFLAGS) -DSIM
- check_y2k_LDADD = $(LDADD) ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(LDADD_LIBNTP) $(PTHREAD_LIBS)
diff --git a/ntp-4.2.6p1-mlock.patch b/ntp-4.2.6p1-mlock.patch
deleted file mode 100644
index f977b3d..0000000
--- a/ntp-4.2.6p1-mlock.patch
+++ /dev/null
@@ -1,140 +0,0 @@
-diff -up ntp-4.2.6p3/html/ntpd.html.mlock ntp-4.2.6p3/html/ntpd.html
---- ntp-4.2.6p3/html/ntpd.html.mlock	2011-01-05 17:51:36.242120783 +0100
-+++ ntp-4.2.6p3/html/ntpd.html	2011-01-05 17:51:36.254121258 +0100
-@@ -32,7 +32,7 @@
- 		</ul>
- 		<hr>
- 		<h4 id="synop">Synopsis</h4>
--		<tt>ntpd [ -46aAbdDgLnNqx ] [ -c <i>conffile</i> ] [ -f <i>driftfile</i> ] [ -i <i>jaildir</i> ] [ -I <i>iface</i> ] [ -k <i>keyfile</i> ] [ -l <i>logfile</i> ] [ -p <i>pidfile</i> ] [ -P <i>priority</i> ] [ -r <i>broadcastdelay</i> ] [ -s <i>statsdir</i> ] [ -t <i>key</i> ] [ -u <i>user</i>[:<i>group</i>] ] [ -U <i>interface_update_interval</i> ] [ -v <i>variable</i> ] [ -V <i>variable</i> ]</tt>
-+		<tt>ntpd [ -46aAbdDgLmnNqx ] [ -c <i>conffile</i> ] [ -f <i>driftfile</i> ] [ -i <i>jaildir</i> ] [ -I <i>iface</i> ] [ -k <i>keyfile</i> ] [ -l <i>logfile</i> ] [ -p <i>pidfile</i> ] [ -P <i>priority</i> ] [ -r <i>broadcastdelay</i> ] [ -s <i>statsdir</i> ] [ -t <i>key</i> ] [ -u <i>user</i>[:<i>group</i>] ] [ -U <i>interface_update_interval</i> ] [ -v <i>variable</i> ] [ -V <i>variable</i> ]</tt>
- 		<h4 id="descr">Description</h4>
- 		<p>The <tt>ntpd</tt> program is an operating system daemon that synchronises the system clock with remote NTP time servers or local reference clocks. It is a complete implementation of the Network Time Protocol (NTP) version 4, but also retains compatibility with version 3, as defined by RFC-1305, and version 1 and 2, as defined by RFC-1059 and RFC-1119, respectively. The program can operate in any of several modes, as described on the <a href="assoc.html">Association Management</a> page, and with both symmetric key and public key cryptography, as described on the <a href="manyopt.html">Authentication Options</a> page.</p>
- 		<p>The <tt>ntpd</tt> program ordinarily requires a configuration file as desccribe on the Configuration Commands and Options collection above. However a client can discover remote servers and configure them automatically. This makes it possible to deploy a fleet of workstations without specifying configuration details specific to the local environment. Further details are on the <a href="manyopt.html">Automatic Server Discovery</a> page.</p>
-@@ -123,6 +123,8 @@
- 			<dd>Do not listen to virtual interfaces, defined as those with names containing a colon. This option is deprecated. Please consider using the configuration file <a href="miscopt.html#interface">interface</a> command, which is more versatile.</dd>
- 			<dt><tt>-M</tt></dt>
- 			<dd>Raise scheduler precision to its maximum (1 msec) using timeBeginPeriod. (Windows only)</dd>
-+			<dt><tt>-m</tt>
-+			<dd>Lock memory.
- 			<dt><tt>-n</tt></dt>
- 			<dd>Don't fork.</dd>
- 			<dt><tt>-N</tt></dt>
-diff -up ntp-4.2.6p3/ntpd/ntpd-opts.c.mlock ntp-4.2.6p3/ntpd/ntpd-opts.c
---- ntp-4.2.6p3/ntpd/ntpd-opts.c.mlock	2011-01-04 03:15:35.000000000 +0100
-+++ ntp-4.2.6p3/ntpd/ntpd-opts.c	2011-01-05 17:55:01.609260787 +0100
-@@ -282,6 +282,15 @@ static char const zNice_Name[]          
- #define NICE_FLAGS       (OPTST_DISABLED)
- 
- /*
-+ *  Mlock option description:
-+ */
-+static char const zMlockText[] =
-+        "Lock memory";
-+static char const zMlock_NAME[]              = "MLOCK";
-+static char const zMlock_Name[]              = "mlock";
-+#define MLOCK_FLAGS       (OPTST_DISABLED)
-+
-+/*
-  *  Pidfile option description:
-  */
- static char const zPidfileText[] =
-@@ -909,6 +918,18 @@ static tOptDesc optDesc[ OPTION_CT ] = {
-      /* desc, NAME, name */ zPccfreqText, zPccfreq_NAME, zPccfreq_Name,
-      /* disablement strs */ NULL, NULL },
- 
-+  {  /* entry idx, value */ 32, VALUE_OPT_MLOCK,
-+     /* equiv idx, value */ 32, VALUE_OPT_MLOCK,
-+     /* equivalenced to  */ NO_EQUIVALENT,
-+     /* min, max, act ct */ 0, 1, 0,
-+     /* opt state flags  */ MLOCK_FLAGS, 0,
-+     /* last opt argumnt */ { NULL },
-+     /* arg list/cookie  */ NULL,
-+     /* must/cannot opts */ NULL, NULL,
-+     /* option proc      */ NULL,
-+     /* desc, NAME, name */ zMlockText, zMlock_NAME, zMlock_Name,
-+     /* disablement strs */ NULL, NULL },
-+
-   {  /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
-      /* equiv idx value  */ NO_EQUIVALENT, 0,
-      /* equivalenced to  */ NO_EQUIVALENT,
-@@ -1008,7 +1029,7 @@ tOptions ntpdOptions = {
-       NO_EQUIVALENT, /* '-#' option index */
-       NO_EQUIVALENT /* index of default opt */
-     },
--    35 /* full option count */, 32 /* user option count */,
-+    36 /* full option count */, 33 /* user option count */,
-     ntpd_full_usage, ntpd_short_usage,
-     NULL, NULL,
-     PKGDATADIR
-diff -up ntp-4.2.6p3/ntpd/ntpd-opts.h.mlock ntp-4.2.6p3/ntpd/ntpd-opts.h
---- ntp-4.2.6p3/ntpd/ntpd-opts.h.mlock	2011-01-04 03:15:35.000000000 +0100
-+++ ntp-4.2.6p3/ntpd/ntpd-opts.h	2011-01-05 17:51:36.256121337 +0100
-@@ -82,6 +82,7 @@ typedef enum {
--    INDEX_OPT_VERSION           = 32,
--    INDEX_OPT_HELP              = 33,
--    INDEX_OPT_MORE_HELP         = 34
-+    INDEX_OPT_MLOCK             = 32,
-+    INDEX_OPT_VERSION           = 33,
-+    INDEX_OPT_HELP              = 34,
-+    INDEX_OPT_MORE_HELP         = 35
- } teOptIndex;
- 
--#define OPTION_CT    35
-+#define OPTION_CT    36
-@@ -189,6 +190,10 @@ typedef enum {
- #  warning undefining MODIFYMMTIMER due to option name conflict
- #  undef   MODIFYMMTIMER
- # endif
-+# ifdef    MLOCK
-+#  warning undefining MLOCK due to option name conflict
-+#  undef   MLOCK
-+# endif
- # ifdef    NOFORK
- #  warning undefining NOFORK due to option name conflict
- #  undef   NOFORK
-@@ -270,6 +275,7 @@ typedef enum {
- # undef LOGFILE
- # undef NOVIRTUALIPS
- # undef MODIFYMMTIMER
-+# undef MLOCK
- # undef NOFORK
- # undef NICE
- # undef PIDFILE
-@@ -308,6 +314,7 @@ typedef enum {
- #define VALUE_OPT_LOGFILE        'l'
- #define VALUE_OPT_NOVIRTUALIPS   'L'
- #define VALUE_OPT_MODIFYMMTIMER  'M'
-+#define VALUE_OPT_MLOCK          'm'
- #define VALUE_OPT_NOFORK         'n'
- #define VALUE_OPT_NICE           'N'
- #define VALUE_OPT_PIDFILE        'p'
-diff -up ntp-4.2.6p3/ntpd/ntpd.c.mlock ntp-4.2.6p3/ntpd/ntpd.c
---- ntp-4.2.6p3/ntpd/ntpd.c.mlock	2011-01-05 17:51:36.191118761 +0100
-+++ ntp-4.2.6p3/ntpd/ntpd.c	2011-01-05 17:51:36.257121377 +0100
-@@ -723,7 +723,8 @@ ntpdmain(
- 	}
- #endif
- 
--#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) && defined(MCL_FUTURE)
-+#if defined(MCL_CURRENT) && defined(MCL_FUTURE)
-+    if (HAVE_OPT( MLOCK )) {
- # ifdef HAVE_SETRLIMIT
- 	/*
- 	 * Set the stack limit to something smaller, so that we don't lock a lot
-@@ -749,7 +750,7 @@ ntpdmain(
- 	     * fail if we drop root privlege.  To be useful the value
- 	     * has to be larger than the largest ntpd resident set size.
- 	     */
--	    rl.rlim_cur = rl.rlim_max = 32*1024*1024;
-+	    rl.rlim_cur = rl.rlim_max = 64*1024*1024;
- 	    if (setrlimit(RLIMIT_MEMLOCK, &rl) == -1) {
- 		msyslog(LOG_ERR, "Cannot set RLIMIT_MEMLOCK: %m");
- 	    }
-@@ -761,6 +762,7 @@ ntpdmain(
- 	 */
- 	if (mlockall(MCL_CURRENT|MCL_FUTURE) < 0)
- 		msyslog(LOG_ERR, "mlockall(): %m");
-+    }
- #else /* not (HAVE_MLOCKALL && MCL_CURRENT && MCL_FUTURE) */
- # ifdef HAVE_PLOCK
- #  ifdef PROCLOCK
diff --git a/ntp-4.2.6p1-sleep.patch b/ntp-4.2.6p1-sleep.patch
deleted file mode 100644
index 577ef26..0000000
--- a/ntp-4.2.6p1-sleep.patch
+++ /dev/null
@@ -1,495 +0,0 @@
-diff -up ntp-4.2.6p1/include/ntp_refclock.h.sleep ntp-4.2.6p1/include/ntp_refclock.h
---- ntp-4.2.6p1/include/ntp_refclock.h.sleep	2009-12-09 08:36:35.000000000 +0100
-+++ ntp-4.2.6p1/include/ntp_refclock.h	2010-03-10 19:27:46.000000000 +0100
-@@ -260,6 +260,7 @@ extern	void	refclock_control (sockaddr_u
- 				    struct refclockstat *);
- extern	int	refclock_open	(char *, u_int, u_int);
- extern	int	refclock_setup	(int, u_int, u_int);
-+extern	int	refclock_timer_needed	(struct peer *);
- extern	void	refclock_timer	(struct peer *);
- extern	void	refclock_transmit (struct peer *);
- extern	int	refclock_ioctl	(int, u_int);
-diff -up ntp-4.2.6p1/include/ntp_stdlib.h.sleep ntp-4.2.6p1/include/ntp_stdlib.h
---- ntp-4.2.6p1/include/ntp_stdlib.h.sleep	2009-12-09 08:36:35.000000000 +0100
-+++ ntp-4.2.6p1/include/ntp_stdlib.h	2010-03-10 19:27:46.000000000 +0100
-@@ -116,6 +116,7 @@ extern	const char * FindConfig	(const ch
- extern	void	signal_no_reset (int, RETSIGTYPE (*func)(int));
- 
- extern	void	getauthkeys 	(const char *);
-+extern	int	auth_agekeys_needed (void);
- extern	void	auth_agekeys	(void);
- extern	void	rereadkeys	(void);
- 
-diff -up ntp-4.2.6p1/include/ntpd.h.sleep ntp-4.2.6p1/include/ntpd.h
---- ntp-4.2.6p1/include/ntpd.h.sleep	2009-12-09 08:36:35.000000000 +0100
-+++ ntp-4.2.6p1/include/ntpd.h	2010-03-10 19:27:46.000000000 +0100
-@@ -112,8 +112,10 @@ extern	void	block_io_and_alarm	(void);
- /* ntp_loopfilter.c */
- extern	void	init_loopfilter(void);
- extern	int 	local_clock(struct peer *, double);
--extern	void	adj_host_clock(void);
-+extern	int	adj_host_clock_needed(void);
-+extern	void	adj_host_clock(int);
- extern	void	loop_config(int, double);
-+extern	int	huffpuff_enabled(void);
- extern	void	huffpuff(void);
- extern	u_long	sys_clocktime;
- extern	u_int	sys_tai;
-@@ -219,6 +221,8 @@ extern	void	hack_restrict	(int, sockaddr
- /* ntp_timer.c */
- extern	void	init_timer	(void);
- extern	void	reinit_timer	(void);
-+extern	double	get_timeout	(l_fp *);
-+extern	int	timer_elapsed	(l_fp, int);
- extern	void	timer		(void);
- extern	void	timer_clr_stats (void);
- extern  void    timer_interfacetimeout (u_long);
-diff -up ntp-4.2.6p1/libntp/authkeys.c.sleep ntp-4.2.6p1/libntp/authkeys.c
---- ntp-4.2.6p1/libntp/authkeys.c.sleep	2009-12-09 08:36:35.000000000 +0100
-+++ ntp-4.2.6p1/libntp/authkeys.c	2010-03-10 19:27:46.000000000 +0100
-@@ -445,6 +445,25 @@ auth_delkeys(void)
- 	}
- }
- 
-+int
-+auth_agekeys_needed(void) {
-+	struct savekey *sk;
-+	int i;
-+
-+	if (authnumkeys > 20)
-+		return 1;
-+
-+	for (i = 0; i < HASHSIZE; i++) {
-+		sk = key_hash[i];
-+		while (sk != 0) {
-+			if (sk->lifetime > 0)
-+				return 1;
-+			sk = sk->next;
-+		}
-+	}
-+	return 0;
-+}
-+
- /*
-  * auth_agekeys - delete keys whose lifetimes have expired
-  */
-diff -up ntp-4.2.6p1/ntpd/ntp_loopfilter.c.sleep ntp-4.2.6p1/ntpd/ntp_loopfilter.c
---- ntp-4.2.6p1/ntpd/ntp_loopfilter.c.sleep	2009-12-09 08:36:36.000000000 +0100
-+++ ntp-4.2.6p1/ntpd/ntp_loopfilter.c	2010-03-10 19:27:46.000000000 +0100
-@@ -677,6 +677,13 @@ local_clock(
- #endif /* LOCKCLOCK */
- }
- 
-+int
-+adj_host_clock_needed(void)
-+{
-+	return !(!ntp_enable || mode_ntpdate || (pll_control &&
-+	    kern_enable));
-+}
-+ 
- 
- /*
-  * adj_host_clock - Called once every second to update the local clock.
-@@ -686,7 +693,7 @@ local_clock(
-  */
- void
- adj_host_clock(
--	void
-+	int time_elapsed
- 	)
- {
- 	double	adjustment;
-@@ -698,7 +705,7 @@ adj_host_clock(
- 	 * since the poll interval can exceed one day, the old test
- 	 * would be counterproductive.
- 	 */
--	sys_rootdisp += clock_phi;
-+	sys_rootdisp += clock_phi * time_elapsed;
- 
- #ifndef LOCKCLOCK
- 	/*
-@@ -819,6 +826,12 @@ set_freq(
- #endif /* KERNEL_PLL */
- }
- 
-+int
-+huffpuff_enabled(void)
-+{
-+	return sys_huffpuff != NULL;
-+}
-+
- /*
-  * huff-n'-puff filter
-  */
-diff -up ntp-4.2.6p1/ntpd/ntp_refclock.c.sleep ntp-4.2.6p1/ntpd/ntp_refclock.c
---- ntp-4.2.6p1/ntpd/ntp_refclock.c.sleep	2009-12-09 08:36:36.000000000 +0100
-+++ ntp-4.2.6p1/ntpd/ntp_refclock.c	2010-03-10 19:27:46.000000000 +0100
-@@ -268,6 +268,21 @@ refclock_unpeer(
- }
- 
- 
-+int
-+refclock_timer_needed(
-+	struct peer *peer	/* peer structure pointer */
-+	)
-+{
-+	u_char clktype;
-+	int unit;
-+
-+	clktype = peer->refclktype;
-+	unit = peer->refclkunit;
-+	if (refclock_conf[clktype]->clock_timer != noentry)
-+		return 1;
-+	return 0;
-+}
-+
- /*
-  * refclock_timer - called once per second for housekeeping.
-  */
-diff -up ntp-4.2.6p1/ntpd/ntp_timer.c.sleep ntp-4.2.6p1/ntpd/ntp_timer.c
---- ntp-4.2.6p1/ntpd/ntp_timer.c.sleep	2009-12-09 08:36:35.000000000 +0100
-+++ ntp-4.2.6p1/ntpd/ntp_timer.c	2010-03-11 15:23:59.000000000 +0100
-@@ -56,7 +56,6 @@ static	u_long adjust_timer;	/* second ti
- static	u_long stats_timer;	/* stats timer */
- static	u_long huffpuff_timer;	/* huff-n'-puff timer */
- u_long	leapsec;		/* leapseconds countdown */
--l_fp	sys_time;		/* current system time */
- #ifdef OPENSSL
- static	u_long revoke_timer;	/* keys revoke timer */
- static	u_long keys_timer;	/* session key timer */
-@@ -74,6 +73,12 @@ volatile u_long alarm_overflow;
- #define	DAY	(24 * HOUR)
- 
- u_long current_time;		/* seconds since startup */
-+l_fp timer_base;
-+int time_elapsed;
-+
-+#define TIMEOUT_TS_SIZE 2
-+l_fp timeout_ts[TIMEOUT_TS_SIZE];
-+unsigned int timeout_ts_index;
- 
- /*
-  * Stats.  Number of overflows and number of calls to transmit().
-@@ -110,6 +115,8 @@ static	RETSIGTYPE alarming (int);
- void 
- reinit_timer(void)
- {
-+	get_systime(&timer_base);
-+#if 0
- #if !defined(SYS_WINNT) && !defined(VMS)
- #  if defined(HAVE_TIMER_CREATE) && defined(HAVE_TIMER_SETTIME)
- 	timer_gettime(ntpd_timerid, &itimer);
-@@ -143,6 +150,7 @@ reinit_timer(void)
- 	setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0);
- #  endif
- # endif /* VMS */
-+#endif
- }
- 
- /*
-@@ -165,6 +173,12 @@ init_timer(void)
- 	timer_xmtcalls = 0;
- 	timer_timereset = 0;
- 
-+	get_systime(&timer_base);
-+
-+	for (timeout_ts_index = 0; timeout_ts_index < TIMEOUT_TS_SIZE; timeout_ts_index++)
-+		L_CLR(&timeout_ts[timeout_ts_index]);
-+	timeout_ts_index = 0;
-+#if 0
- #if !defined(SYS_WINNT)
- 	/*
- 	 * Set up the alarm interrupt.	The first comes 2**EVENT_TIMEOUT
-@@ -226,6 +240,7 @@ init_timer(void)
- 	}
- 
- #endif /* SYS_WINNT */
-+#endif
- }
- 
- #if defined(SYS_WINNT)
-@@ -236,6 +251,104 @@ get_timer_handle(void)
- }
- #endif
- 
-+double
-+get_timeout(l_fp *now)
-+{
-+	register struct peer *peer, *next_peer;
-+	u_int	n;
-+	double r;
-+	int next;
-+	l_fp ts;
-+
-+	ts = *now;
-+	L_SUB(&ts, &timeout_ts[timeout_ts_index]);
-+	timeout_ts[timeout_ts_index] = *now;
-+	timeout_ts_index = (timeout_ts_index + 1) % TIMEOUT_TS_SIZE;
-+
-+	/* don't waste CPU time if called too frequently */
-+	if (ts.l_ui == 0) {
-+		next = 1;
-+		goto finish;
-+	}
-+
-+	next = current_time + HOUR;
-+
-+	if (adj_host_clock_needed()) {
-+		next = 1;
-+		goto finish;
-+	}
-+	for (n = 0; n < NTP_HASH_SIZE; n++) {
-+		for (peer = peer_hash[n]; peer != 0; peer = next_peer) {
-+			next_peer = peer->next;
-+#ifdef REFCLOCK
-+			if (peer->flags & FLAG_REFCLOCK && refclock_timer_needed(peer)) {
-+				next = 1;
-+				goto finish;
-+			}
-+#endif /* REFCLOCK */
-+			if (peer->action)
-+			       next = min(next, peer->nextaction);
-+			next = min(next, peer->nextdate);
-+		}
-+	}
-+
-+	if (leapsec > 0)
-+		next = min(next, leapsec);
-+
-+	if (huffpuff_enabled())
-+		next = min(next, huffpuff_timer);
-+
-+#ifdef OPENSSL
-+	if (auth_agekeys_needed())
-+		next = min(next, keys_timer);
-+	if (sys_leap != LEAP_NOTINSYNC)
-+		next = min(next, revoke_timer);
-+#endif /* OPENSSL */
-+
-+	if (interface_interval)
-+		next = min(next, interface_timer);
-+
-+	next = min(next, stats_timer);
-+
-+	next -= current_time;
-+	if (next <= 0)
-+		next = 1;
-+finish:
-+	ts = timer_base;
-+	ts.l_ui += next;
-+	L_SUB(&ts, now);
-+	LFPTOD(&ts, r);
-+#ifdef DEBUG 
-+	DPRINTF(2, ("timer: timeout %f\n", r));
-+#endif
-+
-+	return r;
-+}
-+
-+int
-+timer_elapsed(l_fp now, int timeout)
-+{
-+	int elapsed;
-+
-+	L_SUB(&now, &timer_base);
-+	elapsed = now.l_i;
-+	if (elapsed < 0 || elapsed > timeout + 10) {
-+#ifdef DEBUG 
-+		DPRINTF(2, ("timer: unexpected time jump\n"));
-+#endif
-+		elapsed = 0;
-+		reinit_timer();
-+
-+	}
-+	timer_base.l_ui += elapsed;
-+	time_elapsed += elapsed;
-+	current_time += elapsed;
-+#ifdef DEBUG 
-+	DPRINTF(2, ("timer: time elapsed %d\n", time_elapsed));
-+#endif
-+	return time_elapsed;
-+}
-+
- /*
-  * timer - event timer
-  */
-@@ -251,11 +364,9 @@ timer(void)
- 	 * kiss-o'-deatch function and implement the association
- 	 * polling function..
- 	 */
--	current_time++;
--	get_systime(&sys_time);
- 	if (adjust_timer <= current_time) {
--		adjust_timer += 1;
--		adj_host_clock();
-+		adjust_timer += time_elapsed;
-+		adj_host_clock(time_elapsed);
- #ifdef REFCLOCK
- 		for (n = 0; n < NTP_HASH_SIZE; n++) {
- 			for (peer = peer_hash[n]; peer != 0; peer = next_peer) {
-@@ -286,7 +397,7 @@ timer(void)
- 			 * 128 s or less.
- 			 */
- 			if (peer->throttle > 0)
--				peer->throttle--;
-+				peer->throttle -= min(peer->throttle, time_elapsed);
- 			if (peer->nextdate <= current_time) {
- #ifdef REFCLOCK
- 				if (peer->flags & FLAG_REFCLOCK)
-@@ -333,7 +444,7 @@ timer(void)
- 	 * set.
- 	 */
- 	if (leapsec > 0) {
--		leapsec--;
-+		leapsec -= min(leapsec, time_elapsed);
- 		if (leapsec == 0) {
- 			sys_leap = LEAP_NOWARNING;
- 			sys_tai = leap_tai;
-@@ -398,11 +509,15 @@ timer(void)
- 	 * Finally, write hourly stats.
- 	 */
- 	if (stats_timer <= current_time) {
-+		l_fp sys_time;
-+		get_systime(&sys_time);
- 		stats_timer += HOUR;
- 		write_stats();
- 		if (sys_tai != 0 && sys_time.l_ui > leap_expire)
- 			report_event(EVNT_LEAPVAL, NULL, NULL);
- 	}
-+
-+	time_elapsed = 0;
- }
- 
- 
-diff -up ntp-4.2.6p1/ntpd/ntpd.c.sleep ntp-4.2.6p1/ntpd/ntpd.c
---- ntp-4.2.6p1/ntpd/ntpd.c.sleep	2010-03-10 19:27:46.000000000 +0100
-+++ ntp-4.2.6p1/ntpd/ntpd.c	2010-03-10 19:27:46.000000000 +0100
-@@ -195,8 +195,6 @@ extern const char *Version;
- 
- char const *progname;
- 
--int was_alarmed;
--
- #ifdef DECL_SYSCALL
- /*
-  * We put this here, since the argument profile is syscall-specific
-@@ -1033,7 +1031,7 @@ getgroup:
- #else /* normal I/O */
- 
- 	BLOCK_IO_AND_ALARM();
--	was_alarmed = 0;
-+
- 	for (;;)
- 	{
- # if !defined(HAVE_SIGNALED_IO)
-@@ -1041,42 +1039,39 @@ getgroup:
- 		extern int maxactivefd;
- 
- 		fd_set rdfdes;
--		int nfound;
--# endif
-+		int nfound, time_elapsed;
- 
--		if (alarm_flag)		/* alarmed? */
--		{
--			was_alarmed = 1;
--			alarm_flag = 0;
--		}
-+		time_elapsed = 0;
-+# endif
- 
--		if (!was_alarmed && has_full_recv_buffer() == ISC_FALSE)
-+		if (has_full_recv_buffer() == ISC_FALSE)
- 		{
- 			/*
- 			 * Nothing to do.  Wait for something.
- 			 */
- # ifndef HAVE_SIGNALED_IO
-+			double timeout;
-+
- 			rdfdes = activefds;
--#  if defined(VMS) || defined(SYS_VXWORKS)
--			/* make select() wake up after one second */
--			{
--				struct timeval t1;
-+			get_systime(&now);
-+			timeout = get_timeout(&now);
- 
--				t1.tv_sec = 1; t1.tv_usec = 0;
-+			if (timeout > 0.0) {
-+ 				struct timeval t1;
-+
-+				t1.tv_sec = timeout;
-+				t1.tv_usec = (timeout - t1.tv_sec) * 1000000;
- 				nfound = select(maxactivefd+1, &rdfdes, (fd_set *)0,
- 						(fd_set *)0, &t1);
--			}
--#  else
--			nfound = select(maxactivefd+1, &rdfdes, (fd_set *)0,
--					(fd_set *)0, (struct timeval *)0);
--#  endif /* VMS */
--			if (nfound > 0)
--			{
--				l_fp ts;
-+				get_systime(&now);
-+			} else
-+				nfound = 0;
- 
--				get_systime(&ts);
-+			time_elapsed = timer_elapsed(now, timeout);
- 
--				(void)input_handler(&ts);
-+			if (nfound > 0)
-+			{
-+				(void)input_handler(&now);
- 			}
- 			else if (nfound == -1 && errno != EINTR)
- 				msyslog(LOG_ERR, "select() error: %m");
-@@ -1085,17 +1080,13 @@ getgroup:
- 				msyslog(LOG_DEBUG, "select(): nfound=%d, error: %m", nfound);
- #  endif /* DEBUG */
- # else /* HAVE_SIGNALED_IO */
-+#  error not supported by sleep patch
- 
- 			wait_for_signal();
- # endif /* HAVE_SIGNALED_IO */
--			if (alarm_flag)		/* alarmed? */
--			{
--				was_alarmed = 1;
--				alarm_flag = 0;
--			}
- 		}
- 
--		if (was_alarmed)
-+		if (time_elapsed > 0)
- 		{
- 			UNBLOCK_IO_AND_ALARM();
- 			/*
-@@ -1103,7 +1094,6 @@ getgroup:
- 			 * to process expiry.
- 			 */
- 			timer();
--			was_alarmed = 0;
- 			BLOCK_IO_AND_ALARM();
- 		}
- 
-@@ -1121,19 +1111,8 @@ getgroup:
- 			rbuf = get_full_recv_buffer();
- 			while (rbuf != NULL)
- 			{
--				if (alarm_flag)
--				{
--					was_alarmed = 1;
--					alarm_flag = 0;
--				}
- 				UNBLOCK_IO_AND_ALARM();
- 
--				if (was_alarmed)
--				{	/* avoid timer starvation during lengthy I/O handling */
--					timer();
--					was_alarmed = 0;
--				}
--
- 				/*
- 				 * Call the data procedure to handle each received
- 				 * packet.
diff --git a/ntp-openssl.patch b/ntp-openssl.patch
new file mode 100644
index 0000000..29fc8b7
--- /dev/null
+++ b/ntp-openssl.patch
@@ -0,0 +1,61 @@
+--- ntp-4.2.8p18/libntp/a_md5encrypt.c.orig	2024-05-07 13:21:31.000000000 +0200
++++ ntp-4.2.8p18/libntp/a_md5encrypt.c	2025-05-16 20:12:50.358752811 +0200
+@@ -10,6 +10,7 @@
+ #include "ntp_stdlib.h"
+ #include "ntp.h"
+ #include "isc/string.h"
++#include <openssl/md5.h>
+ 
+ typedef struct {
+ 	const void *	buf;
+@@ -279,9 +280,9 @@ addr2refid(sockaddr_u *addr)
+ 		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);
++	MD5_Init(&md5_ctx);
++	MD5_Update(&md5_ctx, (void *)&SOCK_ADDR6(addr), sizeof(SOCK_ADDR6(addr)));
++	MD5_Final(u.digest, &md5_ctx);
+ #ifdef WORDS_BIGENDIAN
+ 	u.addr_refid = BYTESWAP32(u.addr_refid);
+ #endif
+--- ntp-4.2.8p18/ntpd/ntp_control.c.orig	2024-05-07 13:21:15.000000000 +0200
++++ ntp-4.2.8p18/ntpd/ntp_control.c	2025-05-16 20:45:58.407982624 +0200
+@@ -15,6 +15,7 @@
+ # include <netinet/in.h>
+ #endif
+ #include <arpa/inet.h>
++#include <openssl/md5.h>
+ 
+ #include "ntpd.h"
+ #include "ntp_io.h"
+@@ -3663,18 +3664,18 @@ static u_int32 derive_nonce(
+ 		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));
++	MD5_Init(&ctx);
++	MD5_Update(&ctx, salt, sizeof(salt));
++	MD5_Update(&ctx, &ts_i, sizeof(ts_i));
++	MD5_Update(&ctx, &ts_f, sizeof(ts_f));
+ 	if (IS_IPV4(addr)) {
+-		MD5Update(&ctx, &SOCK_ADDR4(addr), sizeof(SOCK_ADDR4(addr)));
++		MD5_Update(&ctx, &SOCK_ADDR4(addr), sizeof(SOCK_ADDR4(addr)));
+ 	} else {
+-		MD5Update(&ctx, &SOCK_ADDR6(addr), sizeof(SOCK_ADDR6(addr)));
++		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);
++	MD5_Update(&ctx, &NSRCPORT(addr), sizeof(NSRCPORT(addr)));
++	MD5_Update(&ctx, salt, sizeof(salt));
++	MD5_Final(d.digest, &ctx);
+ 
+ 	return d.extract;
+ }
diff --git a/threadstack-sysconf.patch b/threadstack-sysconf.patch
deleted file mode 100644
index c90c922..0000000
--- a/threadstack-sysconf.patch
+++ /dev/null
@@ -1,29 +0,0 @@
---- ntp-4.2.8p15/libntp/work_thread.c~	2018-08-14 13:51:06.000000000 +0200
-+++ ntp-4.2.8p15/libntp/work_thread.c	2021-10-16 21:40:00.752349056 +0200
-@@ -41,12 +41,6 @@
- #ifndef THREAD_MINSTACKSIZE
- # define THREAD_MINSTACKSIZE	(64U * 1024)
- #endif
--#ifndef __sun
--#if defined(PTHREAD_STACK_MIN) && THREAD_MINSTACKSIZE < PTHREAD_STACK_MIN
--# undef THREAD_MINSTACKSIZE
--# define THREAD_MINSTACKSIZE PTHREAD_STACK_MIN
--#endif
--#endif
- 
- #ifndef THREAD_MAXSTACKSIZE
- # define THREAD_MAXSTACKSIZE	(256U * 1024)
-@@ -594,8 +588,11 @@
- 			"start_blocking_thread: pthread_attr_getstacksize() -> %s",
- 			strerror(rc));
- 	} else {
--		if (ostacksize < THREAD_MINSTACKSIZE)
--			nstacksize = THREAD_MINSTACKSIZE;
-+		int minstack = THREAD_MINSTACKSIZE;
-+		if (minstack < PTHREAD_STACK_MIN)
-+			minstack = PTHREAD_STACK_MIN;
-+		if (ostacksize < minstack)
-+			nstacksize = minstack;
- 		else if (ostacksize > THREAD_MAXSTACKSIZE)
- 			nstacksize = THREAD_MAXSTACKSIZE;
- 		else
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/ntp.git/commitdiff/5358821825c2f4072698ae659118684b93f43bc6



More information about the pld-cvs-commit mailing list