From f0e435e3eb529af46ddbf095694b41aa67aff7bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Sat, 16 Oct 2021 21:45:12 +0200 Subject: [PATCH] - up to 4.2.8p15 - fix building with glibc 2.34 --- ntp-4.2.6p1-droproot.patch | 33 +++++++++++++++++---------------- ntp-4.2.6p1-rtnetlink.patch | 10 +++++----- ntp-ipv6.patch | 6 ++---- ntp-nano.patch | 10 ++++++---- ntp.spec | 8 +++++--- threadstack-sysconf.patch | 29 +++++++++++++++++++++++++++++ 6 files changed, 64 insertions(+), 32 deletions(-) create mode 100644 threadstack-sysconf.patch diff --git a/ntp-4.2.6p1-droproot.patch b/ntp-4.2.6p1-droproot.patch index 7c09bfc..c35fd3d 100644 --- a/ntp-4.2.6p1-droproot.patch +++ b/ntp-4.2.6p1-droproot.patch @@ -1,6 +1,7 @@ ---- ntp-4.2.8/html/ntpdate.html~ 2014-12-19 13:56:51.000000000 +0200 -+++ ntp-4.2.8/html/ntpdate.html 2015-01-02 10:27:05.538902307 +0200 -@@ -27,7 +27,7 @@ +diff -urNp -x '*.orig' ntp-4.2.8p12.org/html/ntpdate.html ntp-4.2.8p12/html/ntpdate.html +--- ntp-4.2.8p12.org/html/ntpdate.html 2018-08-14 13:51:07.000000000 +0200 ++++ ntp-4.2.8p12/html/ntpdate.html 2021-10-15 23:43:00.522149878 +0200 +@@ -27,7 +27,7 @@ href="ntpd.html">ntpd - Network page and/or the sntp - Simple Network Time Protocol (SNTP) Client page. After a suitable period of mourning, the ntpdate program will be retired from this distribution.

Synopsis

@@ -9,7 +10,7 @@

Description

ntpdate sets the local date and time by polling the Network Time Protocol (NTP) server(s) given as the server arguments to determine the correct time. It must be run as root on the local host. A number of samples are obtained from each of the servers specified and a subset of the NTP clock filter and selection algorithms are applied to select the best of these. Note that the accuracy and reliability of ntpdate depends on the number of servers, the number of polls each time it is run and the interval between runs.

ntpdate can be run manually as necessary to set the host clock, or it can be run from the host startup script to set the clock at boot time. This is useful in some cases to set the clock initially before starting the NTP daemon ntpd. It is also possible to run ntpdate from a cron script. However, it is important to note that ntpdate with contrived cron scripts is no substitute for the NTP daemon, which uses sophisticated algorithms to maximize accuracy and reliability while minimizing resource use. Finally, since ntpdate does not discipline the host clock frequency as does ntpd, the accuracy using ntpdate is limited.

-@@ -68,6 +68,11 @@ +@@ -68,6 +68,11 @@ Protocol (SNTP) Client page. After
Direct ntpdate to use an unprivileged port for outgoing packets. This is most useful when behind a firewall that blocks incoming traffic to privileged ports, and you want to synchronize with hosts beyond the firewall. Note that the -d option always uses unprivileged ports.
-v
Be verbose. This option will cause ntpdate's version identification string to be logged.
@@ -21,9 +22,9 @@

Diagnostics

ntpdate's exit status is zero if it finds a server and updates the clock, and nonzero otherwise. -diff -up ntp-4.2.6p1/ntpdate/ntpdate.c.droproot ntp-4.2.6p1/ntpdate/ntpdate.c ---- ntp-4.2.6p1/ntpdate/ntpdate.c.droproot 2009-12-09 08:36:35.000000000 +0100 -+++ ntp-4.2.6p1/ntpdate/ntpdate.c 2010-03-03 15:33:06.000000000 +0100 +diff -urNp -x '*.orig' ntp-4.2.8p12.org/ntpdate/ntpdate.c ntp-4.2.8p12/ntpdate/ntpdate.c +--- ntp-4.2.8p12.org/ntpdate/ntpdate.c 2021-10-15 23:43:00.362150298 +0200 ++++ ntp-4.2.8p12/ntpdate/ntpdate.c 2021-10-15 23:43:00.522149878 +0200 @@ -48,6 +48,12 @@ #include @@ -37,7 +38,7 @@ diff -up ntp-4.2.6p1/ntpdate/ntpdate.c.droproot ntp-4.2.6p1/ntpdate/ntpdate.c #ifdef SYS_VXWORKS # include "ioLib.h" # include "sockLib.h" -@@ -152,6 +158,11 @@ int simple_query = 0; +@@ -147,6 +153,11 @@ int simple_query = 0; int unpriv_port = 0; /* @@ -48,8 +49,8 @@ diff -up ntp-4.2.6p1/ntpdate/ntpdate.c.droproot ntp-4.2.6p1/ntpdate/ntpdate.c +/* * Program name. */ - char *progname; -@@ -293,6 +304,88 @@ void clear_globals() + char const *progname; +@@ -288,6 +299,88 @@ void clear_globals() static ni_namelist *getnetinfoservers (void); #endif @@ -138,7 +139,7 @@ diff -up ntp-4.2.6p1/ntpdate/ntpdate.c.droproot ntp-4.2.6p1/ntpdate/ntpdate.c /* * Main program. Initialize us and loop waiting for I/O and/or * timer expiries. -@@ -340,6 +433,8 @@ ntpdatemain ( +@@ -335,6 +428,8 @@ ntpdatemain ( init_lib(); /* sets up ipv4_works, ipv6_works */ @@ -147,7 +148,7 @@ diff -up ntp-4.2.6p1/ntpdate/ntpdate.c.droproot ntp-4.2.6p1/ntpdate/ntpdate.c /* Check to see if we have IPv6. Otherwise default to IPv4 */ if (!ipv6_works) ai_fam_templ = AF_INET; -@@ -351,7 +446,7 @@ ntpdatemain ( +@@ -346,7 +441,7 @@ ntpdatemain ( /* * Decode argument list */ @@ -156,7 +157,7 @@ diff -up ntp-4.2.6p1/ntpdate/ntpdate.c.droproot ntp-4.2.6p1/ntpdate/ntpdate.c switch (c) { case '4': -@@ -429,6 +524,14 @@ ntpdatemain ( +@@ -423,6 +518,14 @@ ntpdatemain ( case 'u': unpriv_port = 1; break; @@ -171,8 +172,8 @@ diff -up ntp-4.2.6p1/ntpdate/ntpdate.c.droproot ntp-4.2.6p1/ntpdate/ntpdate.c case '?': ++errflg; break; -@@ -438,7 +541,7 @@ ntpdatemain ( - +@@ -432,7 +535,7 @@ ntpdatemain ( + if (errflg) { (void) fprintf(stderr, - "usage: %s [-46bBdqsuv] [-a key#] [-e delay] [-k file] [-p samples] [-o version#] [-t timeo] server ...\n", @@ -180,7 +181,7 @@ diff -up ntp-4.2.6p1/ntpdate/ntpdate.c.droproot ntp-4.2.6p1/ntpdate/ntpdate.c progname); exit(2); } -@@ -544,6 +647,24 @@ ntpdatemain ( +@@ -546,6 +649,24 @@ ntpdatemain ( initializing = 0; was_alarmed = 0; diff --git a/ntp-4.2.6p1-rtnetlink.patch b/ntp-4.2.6p1-rtnetlink.patch index 8d34c23..ad5457a 100644 --- a/ntp-4.2.6p1-rtnetlink.patch +++ b/ntp-4.2.6p1-rtnetlink.patch @@ -1,9 +1,9 @@ -diff -up ntp-4.2.6p3/ntpd/ntp_io.c.rtnetlink ntp-4.2.6p3/ntpd/ntp_io.c ---- ntp-4.2.6p3/ntpd/ntp_io.c.rtnetlink 2011-01-05 16:03:19.328001089 +0100 -+++ ntp-4.2.6p3/ntpd/ntp_io.c 2011-01-05 16:03:19.349001911 +0100 -@@ -4549,10 +4549,7 @@ init_async_notifications() +diff -urNp -x '*.orig' ntp-4.2.8p12.org/ntpd/ntp_io.c ntp-4.2.8p12/ntpd/ntp_io.c +--- ntp-4.2.8p12.org/ntpd/ntp_io.c 2021-10-15 23:43:02.012145954 +0200 ++++ ntp-4.2.8p12/ntpd/ntp_io.c 2021-10-15 23:43:02.175478857 +0200 +@@ -4832,10 +4832,7 @@ init_async_notifications() #ifdef HAVE_RTNETLINK - memset(&sa, 0, sizeof(sa)); + ZERO(sa); sa.nl_family = PF_NETLINK; - sa.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR - | RTMGRP_IPV6_IFADDR | RTMGRP_IPV4_ROUTE diff --git a/ntp-ipv6.patch b/ntp-ipv6.patch index 674a6a7..3127123 100644 --- a/ntp-ipv6.patch +++ b/ntp-ipv6.patch @@ -1,7 +1,7 @@ diff -durN -x '*.orig' ntp-4.2.6p1.orig/ntpdate/ntpdate.c ntp-4.2.6p1/ntpdate/ntpdate.c --- ntp-4.2.6p1.orig/ntpdate/ntpdate.c 2010-05-24 19:28:54.000000000 +0200 +++ ntp-4.2.6p1/ntpdate/ntpdate.c 2010-05-24 19:30:19.000000000 +0200 -@@ -1729,11 +1729,13 @@ +@@ -1729,9 +1729,11 @@ } #ifdef IPV6_V6ONLY /* Restricts AF_INET6 socket to IPv6 communications (see RFC 2553bis-03) */ @@ -10,9 +10,7 @@ diff -durN -x '*.orig' ntp-4.2.6p1.orig/ntpdate/ntpdate.c ntp-4.2.6p1/ntpdate/nt + if (res->ai_family == AF_INET6) { + int i = setsockopt(fd[nbsock], IPPROTO_IPV6, IPV6_V6ONLY, (void*) &optval, sizeof(optval)); + if ( i < 0 && errno != ENOPROTOOPT ) { - msyslog(LOG_ERR, "setsockopt() IPV6_V6ONLY failed: %m"); - exit(1); - /*NOTREACHED*/ + msyslog(LOG_ERR, "setsockopt() IPV6_V6ONLY failed: %m"); + } } #endif diff --git a/ntp-nano.patch b/ntp-nano.patch index 4814bec..f001794 100644 --- a/ntp-nano.patch +++ b/ntp-nano.patch @@ -1,6 +1,7 @@ ---- ntp-4.2.4p7/include/ntp_syscall.h -+++ ntp-4.2.4p7/include/ntp_syscall.h -@@ -14,5 +14,13 @@ +diff -urNp -x '*.orig' ntp-4.2.8p12.org/include/ntp_syscall.h ntp-4.2.8p12/include/ntp_syscall.h +--- ntp-4.2.8p12.org/include/ntp_syscall.h 2011-03-26 03:03:33.000000000 +0100 ++++ ntp-4.2.8p12/include/ntp_syscall.h 2021-10-15 23:43:00.115484280 +0200 +@@ -10,6 +10,14 @@ # include #endif @@ -13,4 +14,5 @@ +#endif + #ifndef NTP_SYSCALLS_LIBC - #ifdef NTP_SYSCALLS_STD + # ifdef NTP_SYSCALLS_STD + # define ntp_adjtime(t) syscall(SYS_ntp_adjtime, (t)) diff --git a/ntp.spec b/ntp.spec index 8e9e01b..970901f 100644 --- a/ntp.spec +++ b/ntp.spec @@ -13,12 +13,12 @@ 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.8p12 -Release: 8 +Version: 4.2.8p15 +Release: 1 License: distributable Group: Networking/Daemons Source0: https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/%{name}-%{version}.tar.gz -# Source0-md5: 1522d66574bae14abb2622746dad2bdc +# Source0-md5: e1e6b23d2fc75cced41801dbcd6c2561 Source1: %{name}.conf Source2: %{name}.keys Source3: %{name}d.init @@ -36,6 +36,7 @@ Patch0: %{name}-build.patch Patch1: %{name}-no_libelf.patch Patch2: %{name}-ipv6.patch Patch3: %{name}-nano.patch +Patch4: threadstack-sysconf.patch # FC patches + 100 Patch101: %{name}-4.2.6p1-sleep.patch Patch102: %{name}-4.2.6p1-droproot.patch @@ -242,6 +243,7 @@ Este pacote contém documentação adicional sobre o NTP versão 4. %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 ## FC patches #%patch101 -p1 diff --git a/threadstack-sysconf.patch b/threadstack-sysconf.patch new file mode 100644 index 0000000..c90c922 --- /dev/null +++ b/threadstack-sysconf.patch @@ -0,0 +1,29 @@ +--- 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 -- 2.44.0