name = ntp
version = %{ver_major}.8
ver_major = 4.2
-release = 2
+release = 3
groups = System/Daemons
url = http://www.ntp.org/
end
source_dl = http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-%{ver_major}/
-sources += ntpstat-0.2.tgz
# The vendor part in the NTP pool address.
VENDORZONE = %{DISTRO_SNAME}
pps-tools-devel
end
- prepare
- %{MACRO_EXTRACT_TARBALL}
-
- ln -svf ../ntpstat-0.2 .
-
- %{MACRO_PATCHES}
-
+ prepare_cmds
# Create ntp user and group.
%{create_user}
end
configure_options += \
--sysconfdir=%{sysconfdir}/ntp/crypto \
- --with-openssl-libdir=%{libdir} \
--enable-all-clocks \
--enable-parse-clocks \
--enable-ntp-signd=%{localstatedir}/run/ntp_signd
- build
- ./configure %{configure_options}
-
- echo "#define KEYFILE \"%{sysconfdir}/ntp/keys\"" >> ntpdate/ntpdate.h
- echo "#define NTP_VAR \"%{localstatedir}/log/ntpstats/\"" >> config.h
-
- make ${PARALLELISMFLAGS}
-
- # Build ntpstat.
- make -C ntpstat-0.2
- end
-
make_install_targets += bindir=%{sbindir}
install_cmds
mv -v %{BUILDROOT}%{mandir}/man{1/sntp.1,8/sntp.8}
rm -rfv %{BUILDROOT}%{mandir}/man1
- # Install ntpstat.
- pushd ntpstat-0.2
- mkdir -pv %{BUILDROOT}%{bindir}
- install -m 755 ntpstat %{BUILDROOT}%{bindir}
- install -m 644 ntpstat.1 %{BUILDROOT}%{mandir}/man8/ntpstat.8
- popd
-
# Fix section numbers.
sed -i 's/\(\.TH[a-zA-Z ]*\)[1-9]\(.*\)/\18\2/' \
%{BUILDROOT}%{mandir}/man8/*.8
+++ /dev/null
-diff -up ntp-4.2.4p7/ntpstat-0.2/ntpstat.c.ntpstat ntp-4.2.4p7/ntpstat-0.2/ntpstat.c
---- ntp-4.2.4p7/ntpstat-0.2/ntpstat.c.ntpstat 2002-06-10 08:02:12.000000000 +0200
-+++ ntp-4.2.4p7/ntpstat-0.2/ntpstat.c 2009-07-20 12:22:35.000000000 +0200
-@@ -187,7 +187,7 @@ int main (void) {
- else
- printf("unknown source");
-
-- if (!strncmp(clksrcname[clksrc],clksrcname[6],sizeof(clksrcname[6]))) {
-+ if (clksrc == 6) {
- // source of sync is another NTP server so check the IP address
- strncpy(buff, ntpmsg.payload, sizeof(buff));
- if ((newstr = strstr (buff, REFID))) {
+++ /dev/null
-diff -up ntp-4.2.4p7/ntpstat-0.2/ntpstat.c.ntpstat ntp-4.2.4p7/ntpstat-0.2/ntpstat.c
---- ntp-4.2.4p7/ntpstat-0.2/ntpstat.c.ntpstat 2002-06-10 08:02:12.000000000 +0200
-+++ ntp-4.2.4p7/ntpstat-0.2/ntpstat.c 2009-07-20 12:22:35.000000000 +0200
-@@ -151,7 +151,7 @@ int main (void) {
- /* For the reply message to be valid, the first byte should be as sent,
- and the second byte should be the same, with the response bit set */
- byte1ok = ((ntpmsg.byte1&0x3F) == B1VAL);
-- byte2ok = (ntpmsg.byte2 == (B2VAL|RMASK));
-+ byte2ok = ((ntpmsg.byte2 & ~MMASK) == (B2VAL|RMASK));
- if (!(byte1ok && byte2ok)) {
- fprintf (stderr,"status word is 0x%02x%02x\n", ntpmsg.byte1,ntpmsg.byte2 );
- die ("return data appears to be invalid based on status word");
+++ /dev/null
-diff -up ntp-4.2.6p1/ntpstat-0.2/ntpstat.c.sysvars ntp-4.2.6p1/ntpstat-0.2/ntpstat.c
---- ntp-4.2.6p1/ntpstat-0.2/ntpstat.c.sysvars 2010-05-03 11:27:47.000000000 +0200
-+++ ntp-4.2.6p1/ntpstat-0.2/ntpstat.c 2010-05-03 11:32:56.000000000 +0200
-@@ -89,9 +89,9 @@ int main (void) {
- "modem"}; /* 9 */
- char *newstr;
- char *dispstr;
-- const char DISP[] = "rootdispersion=";
-+ const char DISP[] = "rootdisp=";
- const char STRATUM[] = "stratum=";
-- const char POLL[] = "poll=";
-+ const char POLL[] = "tc=";
- const char REFID[] = "refid=";
-
- /* initialise timeout value */
+++ /dev/null
-diff -up ntp-4.2.6p1/ntpstat-0.2/ntpstat.c.maxerror ntp-4.2.6p1/ntpstat-0.2/ntpstat.c
---- ntp-4.2.6p1/ntpstat-0.2/ntpstat.c.maxerror 2010-05-03 11:37:49.000000000 +0200
-+++ ntp-4.2.6p1/ntpstat-0.2/ntpstat.c 2010-05-03 12:20:08.000000000 +0200
-@@ -89,7 +89,9 @@ int main (void) {
- "modem"}; /* 9 */
- char *newstr;
- char *dispstr;
-+ char *delaystr;
- const char DISP[] = "rootdisp=";
-+ const char DELAY[] = "rootdelay=";
- const char STRATUM[] = "stratum=";
- const char POLL[] = "tc=";
- const char REFID[] = "refid=";
-@@ -235,16 +237,19 @@ int main (void) {
- /* Set the position of the start of the string to
- "rootdispersion=" part of the string. */
- strncpy(buff, ntpmsg.payload, sizeof(buff));
-- if ((newstr = strstr (buff, DISP))) {
-- newstr += sizeof(DISP) - 1;
-- dispstr = strtok(newstr,".");
-+ if ((dispstr = strstr (buff, DISP)) && (delaystr = strstr (buff, DELAY))) {
-+ dispstr += sizeof(DISP) - 1;
-+ dispstr = strtok(dispstr,",");
-+ delaystr += sizeof(DELAY) - 1;
-+ delaystr = strtok(delaystr,",");
-
- /* Check the resultant string is of a reasonable length */
-- if ((strlen (dispstr) == 0) || (strlen (dispstr) > 4)) {
-+ if ((strlen (dispstr) == 0) || (strlen (dispstr) > 10) ||
-+ (strlen (delaystr) == 0) || (strlen (delaystr) > 10)) {
- printf ("accuracy unreadable\n");
- }
- else {
-- printf(" time correct to within %s ms\n",dispstr);
-+ printf(" time correct to within %.0f ms\n", atof(dispstr) + atof(delaystr) / 2.0);
- }
- } else {
- rc=1;
+++ /dev/null
-diff -up ntp-4.2.6p4/ntpstat-0.2/ntpstat.c.errorbit ntp-4.2.6p4/ntpstat-0.2/ntpstat.c
---- ntp-4.2.6p4/ntpstat-0.2/ntpstat.c.errorbit 2011-10-06 13:41:38.591669772 +0200
-+++ ntp-4.2.6p4/ntpstat-0.2/ntpstat.c 2011-10-06 16:50:01.708315811 +0200
-@@ -104,6 +104,7 @@ int main (void) {
- FD_ZERO(&fds);
-
- inet_aton("127.0.0.1", &address);
-+ memset(&sock, 0, sizeof (sock));;
- sock.sin_family = AF_INET;
- sock.sin_addr = address;
- sock.sin_port = htons(NTP_PORT);
-@@ -159,15 +160,18 @@ int main (void) {
- die ("return data appears to be invalid based on status word");
- }
-
-- if (!(ntpmsg.byte2 | EMASK)) {
-+ if (ntpmsg.byte2 & EMASK) {
- fprintf (stderr,"status byte2 is %02x\n", ntpmsg.byte2 );
- die ("error bit is set in reply");
- }
-
-- if (!(ntpmsg.byte2 | MMASK)) {
-+ /* ignore the more bit */
-+#if 0
-+ if (ntpmsg.byte2 & MMASK) {
- fprintf (stderr,"status byte2 is %02x\n", ntpmsg.byte2 );
- fprintf (stderr,"More bit unexpected in reply");
- }
-+#endif
-
- /* if the leap indicator (LI), which is the two most significant bits
- in status byte1, are both one, then the clock is not synchronised. */