From 1cb18fc6b67ddb17b4412afe8b4c354c96a6292e Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Jul 21 2009 15:55:14 +0000 Subject: - handle system time jumps better - don't wake up every second for refclocks without timer - don't crash in ntpstat when unknown clock type is received (#505564) - make ntpstat process first packet in multipacket response - switch to editline - set pool.ntp.org vendor zone in spec (#512711) - compile with -fno-strict-aliasing --- diff --git a/ntp-4.2.4p4-bsdadv.patch b/ntp-4.2.4p4-bsdadv.patch deleted file mode 100644 index a4d24d7..0000000 --- a/ntp-4.2.4p4-bsdadv.patch +++ /dev/null @@ -1,320 +0,0 @@ -diff -up ntp-4.2.4p4/include/ntp_random.h.bsdadv ntp-4.2.4p4/include/ntp_random.h ---- ntp-4.2.4p4/include/ntp_random.h.bsdadv 2006-06-06 22:16:18.000000000 +0200 -+++ ntp-4.2.4p4/include/ntp_random.h 2007-10-26 13:57:38.000000000 +0200 -@@ -1,14 +1,12 @@ -+#include - --#include -- --long ntp_random P((void)); --void ntp_srandom P((unsigned long)); --void ntp_srandomdev P((void)); --char * ntp_initstate P((unsigned long, /* seed for R.N.G. */ -- char *, /* pointer to state array */ -- long /* # bytes of state info */ -- )); --char * ntp_setstate P((char *)); /* pointer to state array */ -- -- -+#if RAND_MAX < 2147483647 -+#error RAND_MAX < 2147483647 -+#endif - -+#if RAND_MAX == 2147483647 -+#define ntp_random random -+#else -+#define ntp_random() (random() & 0x7fffffff) -+#endif -+#define ntp_srandom srandom -diff -up /dev/null ntp-4.2.4p4/include/md5.h ---- /dev/null 2007-08-14 18:13:05.327268775 +0200 -+++ ntp-4.2.4p4/include/md5.h 2007-10-26 14:11:38.000000000 +0200 -@@ -0,0 +1,23 @@ -+#ifndef MD5_H -+#define MD5_H -+ -+#include -+typedef uint32_t uint32; -+ -+struct MD5Context { -+ uint32 buf[4]; -+ uint32 bits[2]; -+ unsigned char in[64]; -+}; -+ -+extern void MD5Init(struct MD5Context *ctx); -+extern void MD5Update(struct MD5Context *ctx, unsigned char *buf, unsigned len); -+extern void MD5Final(unsigned char digest[16], struct MD5Context *ctx); -+extern void MD5Transform(uint32 buf[4], uint32 in[16]); -+ -+/* -+ * This is needed to make RSAREF happy on some MS-DOS compilers. -+ */ -+typedef struct MD5Context MD5_CTX; -+ -+#endif /* !MD5_H */ -diff -up ntp-4.2.4p4/include/ntp_rfc2553.h.bsdadv ntp-4.2.4p4/include/ntp_rfc2553.h ---- ntp-4.2.4p4/include/ntp_rfc2553.h.bsdadv 2007-10-26 13:43:07.000000000 +0200 -+++ ntp-4.2.4p4/include/ntp_rfc2553.h 2007-10-26 13:43:07.000000000 +0200 -@@ -0,0 +1 @@ -+#include -diff -up /dev/null ntp-4.2.4p4/libntp/md5.c ---- /dev/null 2007-08-14 18:13:05.327268775 +0200 -+++ ntp-4.2.4p4/libntp/md5.c 2007-10-26 14:11:09.000000000 +0200 -@@ -0,0 +1,256 @@ -+/* -+ * This code implements the MD5 message-digest algorithm. -+ * The algorithm is due to Ron Rivest. This code was -+ * written by Colin Plumb in 1993, no copyright is claimed. -+ * This code is in the public domain; do with it what you wish. -+ * -+ * Equivalent code is available from RSA Data Security, Inc. -+ * This code has been tested against that, and is equivalent, -+ * except that you don't need to include two pages of legalese -+ * with every copy. -+ * -+ * To compute the message digest of a chunk of bytes, declare an -+ * MD5Context structure, pass it to MD5Init, call MD5Update as -+ * needed on buffers full of bytes, and then call MD5Final, which -+ * will fill a supplied 16-byte array with the digest. -+ */ -+ -+/* Brutally hacked by John Walker back from ANSI C to K&R (no -+ prototypes) to maintain the tradition that Netfone will compile -+ with Sun's original "cc". */ -+ -+#include /* for memcpy() */ -+#include "md5.h" -+#include "config.h" -+ -+#ifndef WORDS_BIGENDIAN -+#define byteReverse(buf, len) /* Nothing */ -+#else -+/* -+ * Note: this code is harmless on little-endian machines. -+ */ -+static void byteReverse(buf, longs) -+ unsigned char *buf; unsigned longs; -+{ -+ uint32 t; -+ do { -+ t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 | -+ ((unsigned) buf[1] << 8 | buf[0]); -+ *(uint32 *) buf = t; -+ buf += 4; -+ } while (--longs); -+} -+#endif -+ -+/* -+ * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious -+ * initialization constants. -+ */ -+void MD5Init(ctx) -+ struct MD5Context *ctx; -+{ -+ ctx->buf[0] = 0x67452301; -+ ctx->buf[1] = 0xefcdab89; -+ ctx->buf[2] = 0x98badcfe; -+ ctx->buf[3] = 0x10325476; -+ -+ ctx->bits[0] = 0; -+ ctx->bits[1] = 0; -+} -+ -+/* -+ * Update context to reflect the concatenation of another buffer full -+ * of bytes. -+ */ -+void MD5Update(ctx, buf, len) -+ struct MD5Context *ctx; unsigned char *buf; unsigned len; -+{ -+ uint32 t; -+ -+ /* Update bitcount */ -+ -+ t = ctx->bits[0]; -+ if ((ctx->bits[0] = t + ((uint32) len << 3)) < t) -+ ctx->bits[1]++; /* Carry from low to high */ -+ ctx->bits[1] += len >> 29; -+ -+ t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ -+ -+ /* Handle any leading odd-sized chunks */ -+ -+ if (t) { -+ unsigned char *p = (unsigned char *) ctx->in + t; -+ -+ t = 64 - t; -+ if (len < t) { -+ memcpy(p, buf, len); -+ return; -+ } -+ memcpy(p, buf, t); -+ byteReverse(ctx->in, 16); -+ MD5Transform(ctx->buf, (uint32 *) ctx->in); -+ buf += t; -+ len -= t; -+ } -+ /* Process data in 64-byte chunks */ -+ -+ while (len >= 64) { -+ memcpy(ctx->in, buf, 64); -+ byteReverse(ctx->in, 16); -+ MD5Transform(ctx->buf, (uint32 *) ctx->in); -+ buf += 64; -+ len -= 64; -+ } -+ -+ /* Handle any remaining bytes of data. */ -+ -+ memcpy(ctx->in, buf, len); -+} -+ -+/* -+ * Final wrapup - pad to 64-byte boundary with the bit pattern -+ * 1 0* (64-bit count of bits processed, MSB-first) -+ */ -+void MD5Final(digest, ctx) -+ unsigned char digest[16]; struct MD5Context *ctx; -+{ -+ unsigned count; -+ unsigned char *p; -+ -+ /* Compute number of bytes mod 64 */ -+ count = (ctx->bits[0] >> 3) & 0x3F; -+ -+ /* Set the first char of padding to 0x80. This is safe since there is -+ always at least one byte free */ -+ p = ctx->in + count; -+ *p++ = 0x80; -+ -+ /* Bytes of padding needed to make 64 bytes */ -+ count = 64 - 1 - count; -+ -+ /* Pad out to 56 mod 64 */ -+ if (count < 8) { -+ /* Two lots of padding: Pad the first block to 64 bytes */ -+ memset(p, 0, count); -+ byteReverse(ctx->in, 16); -+ MD5Transform(ctx->buf, (uint32 *) ctx->in); -+ -+ /* Now fill the next block with 56 bytes */ -+ memset(ctx->in, 0, 56); -+ } else { -+ /* Pad block to 56 bytes */ -+ memset(p, 0, count - 8); -+ } -+ byteReverse(ctx->in, 14); -+ -+ /* Append length in bits and transform */ -+ ((uint32 *) ctx->in)[14] = ctx->bits[0]; -+ ((uint32 *) ctx->in)[15] = ctx->bits[1]; -+ -+ MD5Transform(ctx->buf, (uint32 *) ctx->in); -+ byteReverse((unsigned char *) ctx->buf, 4); -+ memcpy(digest, ctx->buf, 16); -+ memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ -+} -+ -+ -+/* The four core functions - F1 is optimized somewhat */ -+ -+/* #define F1(x, y, z) (x & y | ~x & z) */ -+#define F1(x, y, z) (z ^ (x & (y ^ z))) -+#define F2(x, y, z) F1(z, x, y) -+#define F3(x, y, z) (x ^ y ^ z) -+#define F4(x, y, z) (y ^ (x | ~z)) -+ -+/* This is the central step in the MD5 algorithm. */ -+#define MD5STEP(f, w, x, y, z, data, s) \ -+ ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) -+ -+/* -+ * The core of the MD5 algorithm, this alters an existing MD5 hash to -+ * reflect the addition of 16 longwords of new data. MD5Update blocks -+ * the data and converts bytes into longwords for this routine. -+ */ -+void MD5Transform(buf, in) -+ uint32 buf[4]; uint32 in[16]; -+{ -+ register uint32 a, b, c, d; -+ -+ a = buf[0]; -+ b = buf[1]; -+ c = buf[2]; -+ d = buf[3]; -+ -+ MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); -+ MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); -+ MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); -+ MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); -+ MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); -+ MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); -+ MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); -+ MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); -+ MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); -+ MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); -+ MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); -+ MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); -+ MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); -+ MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); -+ MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); -+ MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); -+ -+ MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); -+ MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); -+ MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); -+ MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); -+ MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); -+ MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); -+ MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); -+ MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); -+ MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); -+ MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); -+ MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); -+ MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); -+ MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); -+ MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); -+ MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); -+ MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); -+ -+ MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); -+ MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); -+ MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); -+ MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); -+ MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); -+ MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); -+ MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); -+ MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); -+ MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); -+ MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); -+ MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); -+ MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); -+ MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); -+ MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); -+ MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); -+ MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); -+ -+ MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); -+ MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); -+ MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); -+ MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); -+ MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); -+ MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); -+ MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); -+ MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); -+ MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); -+ MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); -+ MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); -+ MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); -+ MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); -+ MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); -+ MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); -+ MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); -+ -+ buf[0] += a; -+ buf[1] += b; -+ buf[2] += c; -+ buf[3] += d; -+} diff --git a/ntp-4.2.4p5-sleep.patch b/ntp-4.2.4p5-sleep.patch deleted file mode 100644 index d6578cb..0000000 --- a/ntp-4.2.4p5-sleep.patch +++ /dev/null @@ -1,388 +0,0 @@ -diff -up ntp-4.2.4p5/include/ntp_stdlib.h.sleep ntp-4.2.4p5/include/ntp_stdlib.h ---- ntp-4.2.4p5/include/ntp_stdlib.h.sleep 2006-12-28 13:03:05.000000000 +0100 -+++ ntp-4.2.4p5/include/ntp_stdlib.h 2008-08-27 18:08:08.000000000 +0200 -@@ -101,6 +101,7 @@ extern const char * FindConfig P((const - extern void signal_no_reset P((int, RETSIGTYPE (*func)(int))); - - extern void getauthkeys P((const char *)); -+extern int auth_agekeys_is_needed P((void)); - extern void auth_agekeys P((void)); - extern void rereadkeys P((void)); - -diff -up ntp-4.2.4p5/include/ntpd.h.sleep ntp-4.2.4p5/include/ntpd.h ---- ntp-4.2.4p5/include/ntpd.h.sleep 2008-08-27 18:08:08.000000000 +0200 -+++ ntp-4.2.4p5/include/ntpd.h 2008-08-27 18:08:08.000000000 +0200 -@@ -120,8 +120,10 @@ extern int leap_actual P((int)); - /* ntp_loopfilter.c */ - extern void init_loopfilter P((void)); - extern int local_clock P((struct peer *, double)); --extern void adj_host_clock P((void)); -+extern int adj_host_clock_is_needed P((void)); -+extern void adj_host_clock P((int)); - extern void loop_config P((int, double)); -+extern int huffpuff_enabled P((void)); - extern void huffpuff P((void)); - extern u_long sys_clocktime; - extern u_long sys_tai; -@@ -221,6 +223,7 @@ extern void hack_restrict P((int, struct - /* ntp_timer.c */ - extern void init_timer P((void)); - extern void reinit_timer P((void)); -+extern int when_next_event P((void)); - extern void timer P((void)); - extern void timer_clr_stats P((void)); - extern void timer_interfacetimeout P((u_long)); -diff -up ntp-4.2.4p5/libntp/authkeys.c.sleep ntp-4.2.4p5/libntp/authkeys.c ---- ntp-4.2.4p5/libntp/authkeys.c.sleep 2004-02-25 06:58:03.000000000 +0100 -+++ ntp-4.2.4p5/libntp/authkeys.c 2008-08-27 18:08:08.000000000 +0200 -@@ -394,6 +394,24 @@ auth_delkeys(void) - } - } - -+int auth_agekeys_is_needed() { -+ 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.4p5/ntpd/ntp_loopfilter.c.sleep ntp-4.2.4p5/ntpd/ntp_loopfilter.c ---- ntp-4.2.4p5/ntpd/ntp_loopfilter.c.sleep 2008-08-27 18:08:08.000000000 +0200 -+++ ntp-4.2.4p5/ntpd/ntp_loopfilter.c 2008-08-27 18:08:08.000000000 +0200 -@@ -753,6 +753,10 @@ local_clock( - #endif /* LOCKCLOCK */ - } - -+int adj_host_clock_is_needed() { -+ return !(!ntp_enable || mode_ntpdate || (pll_control && -+ kern_enable)); -+} - - /* - * adj_host_clock - Called once every second to update the local clock. -@@ -762,7 +766,7 @@ local_clock( - */ - void - adj_host_clock( -- void -+ int time_elapsed - ) - { - double adjustment; -@@ -777,7 +781,8 @@ adj_host_clock( - * maximum error and the local clock driver will pick it up and - * pass to the common refclock routines. Very elegant. - */ -- sys_rootdispersion += clock_phi; -+ sys_rootdispersion += clock_phi * time_elapsed; -+ DPRINTF(2, ("loopfilter: %d\n", time_elapsed)); - - #ifndef LOCKCLOCK - /* -@@ -837,6 +842,11 @@ rstclock( - } - - -+int huffpuff_enabled() -+{ -+ return sys_huffpuff != NULL; -+} -+ - /* - * huff-n'-puff filter - */ -diff -up ntp-4.2.4p5/ntpd/ntp_timer.c.sleep ntp-4.2.4p5/ntpd/ntp_timer.c ---- ntp-4.2.4p5/ntpd/ntp_timer.c.sleep 2006-12-28 13:03:34.000000000 +0100 -+++ ntp-4.2.4p5/ntpd/ntp_timer.c 2008-08-27 18:08:08.000000000 +0200 -@@ -63,6 +63,7 @@ volatile u_long alarm_overflow; - #define HOUR (60*60) - - u_long current_time; -+l_fp timer_base; - - /* - * Stats. Number of overflows and number of calls to transmit(). -@@ -99,6 +100,8 @@ static RETSIGTYPE alarming P((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); -@@ -132,6 +135,7 @@ reinit_timer(void) - setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0); - # endif - # endif /* VMS */ -+#endif - } - - /* -@@ -159,6 +163,8 @@ init_timer(void) - timer_xmtcalls = 0; - timer_timereset = 0; - -+ get_systime(&timer_base); -+#if 0 - #if !defined(SYS_WINNT) - /* - * Set up the alarm interrupt. The first comes 2**EVENT_TIMEOUT -@@ -242,6 +248,7 @@ init_timer(void) - } - - #endif /* SYS_WINNT */ -+#endif - } - - #if defined(SYS_WINNT) -@@ -252,6 +257,46 @@ get_timer_handle(void) - } - #endif - -+int when_next_event() { -+ register struct peer *peer, *next_peer; -+ u_int n; -+ int next = current_time + HOUR; -+ -+ if (adj_host_clock_is_needed()) -+ return 1; -+ 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) -+ return 1; -+#endif /* REFCLOCK */ -+ if (peer->action && peer->nextaction < next) -+ next = peer->nextaction; -+ if (peer->nextdate < next) -+ next = peer->nextdate; -+ } -+ } -+ -+ if (auth_agekeys_is_needed() && keys_timer < next) -+ next = keys_timer; -+ if (huffpuff_enabled() && huffpuff_timer < next) -+ next = huffpuff_timer; -+#ifdef OPENSSL -+ if (revoke_timer < next) -+ next = revoke_timer; -+#endif /* OPENSSL */ -+ if (interface_interval && interface_timer < next) -+ next = interface_timer; -+ if (stats_timer < next) -+ next = stats_timer; -+ -+ next -= current_time; -+ if (next <= 0) -+ next = 1; -+ return next; -+} -+ - /* - * timer - dispatch anyone who needs to be - */ -@@ -264,14 +309,12 @@ timer(void) - #endif /* OPENSSL */ - u_int n; - -- current_time += (1<= 0.0) { - struct timeval t1; - -- t1.tv_sec = 1; t1.tv_usec = 0; -+ /* shoot 1ms over */ -+ d += 0.001; -+ t1.tv_sec = floor(d); -+ t1.tv_usec = (d - 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(&ts); -+ } else -+ nfound = 0; -+ -+ ts2 = ts; -+ L_SUB(&ts2, &timer_base); -+ time_elapsed += ts2.l_ui; -+ current_time += ts2.l_ui; -+ timer_base.l_ui += ts2.l_ui; -+#ifdef DEBUG -+ LFPTOD(&ts2, d); -+ DPRINTF(2, ("elapsed %f\n", d)); -+#endif - -+ if (nfound > 0) -+ { - (void)input_handler(&ts); -+ ts_last[ts_last_index] = ts; -+ ts_last_index = (ts_last_index + 1) % TS_LAST_SIZE; - } - else if (nfound == -1 && errno != EINTR) - netsyslog(LOG_ERR, "select() error: %m"); -@@ -1061,17 +1087,12 @@ getgroup: - netsyslog(LOG_DEBUG, "select(): nfound=%d, error: %m", nfound); - # endif /* DEBUG */ - # else /* HAVE_SIGNALED_IO */ -- -+# error not supported - wait_for_signal(); - # endif /* HAVE_SIGNALED_IO */ -- if (alarm_flag) /* alarmed? */ -- { -- was_alarmed = 1; -- alarm_flag = 0; -- } - } - -- if (was_alarmed) -+ if (time_elapsed) - { - UNBLOCK_IO_AND_ALARM(); - /* -@@ -1079,7 +1100,7 @@ getgroup: - * to process expiry. - */ - timer(); -- was_alarmed = 0; -+ time_elapsed = 0; - BLOCK_IO_AND_ALARM(); - } - -@@ -1097,19 +1118,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-4.2.4p7-editline.patch b/ntp-4.2.4p7-editline.patch new file mode 100644 index 0000000..c76b2a1 --- /dev/null +++ b/ntp-4.2.4p7-editline.patch @@ -0,0 +1,57 @@ +diff -up ntp-4.2.4p7/configure.editline ntp-4.2.4p7/configure +--- ntp-4.2.4p7/configure.editline 2009-05-18 10:44:23.000000000 +0200 ++++ ntp-4.2.4p7/configure 2009-07-20 15:18:48.000000000 +0200 +@@ -24614,8 +24614,14 @@ done + # following block becomes on 4.2.5: NTP_LINEEDITLIBS + + ++READLINE_LIBS="-ledit" ++cat >>confdefs.h <<\_ACEOF ++#define HAVE_LIBEDIT ++_ACEOF ++ + for ac_header in readline/history.h readline/readline.h + do ++break + as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` + if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +@@ -24764,7 +24770,7 @@ fi + done + + case "$ac_cv_header_readline_history_h$ac_cv_header_readline_readline_h" in +- *no*) ;; ++ *) ;; + *) save_LIBS=$LIBS + LIBS= + # Ralf Wildenhues: either unset ... or cache READLINE_LIBS +diff -up ntp-4.2.4p7/ntpdc/ntpdc.c.editline ntp-4.2.4p7/ntpdc/ntpdc.c +--- ntp-4.2.4p7/ntpdc/ntpdc.c.editline 2009-05-18 10:22:36.000000000 +0200 ++++ ntp-4.2.4p7/ntpdc/ntpdc.c 2009-07-20 15:17:25.000000000 +0200 +@@ -26,9 +26,8 @@ + # define closesocket close + #endif /* SYS_WINNT */ + +-#if defined(HAVE_LIBREADLINE) || defined (HAVE_LIBEDIT) +-# include +-# include ++#if defined (HAVE_LIBEDIT) ++# include + #endif /* HAVE_LIBREADLINE || HAVE_LIBEDIT */ + + #ifdef SYS_VXWORKS +diff -up ntp-4.2.4p7/ntpq/ntpq.c.editline ntp-4.2.4p7/ntpq/ntpq.c +--- ntp-4.2.4p7/ntpq/ntpq.c.editline 2009-05-18 10:22:36.000000000 +0200 ++++ ntp-4.2.4p7/ntpq/ntpq.c 2009-07-20 15:17:25.000000000 +0200 +@@ -30,9 +30,8 @@ + # define closesocket close + #endif /* SYS_WINNT */ + +-#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT) +-# include +-# include ++#if defined(HAVE_LIBEDIT) ++# include + #endif /* HAVE_LIBREADLINE || HAVE_LIBEDIT */ + + #ifdef SYS_VXWORKS diff --git a/ntp-4.2.4p7-sleep.patch b/ntp-4.2.4p7-sleep.patch new file mode 100644 index 0000000..d8539ba --- /dev/null +++ b/ntp-4.2.4p7-sleep.patch @@ -0,0 +1,430 @@ +diff -up ntp-4.2.4p7/include/ntp_refclock.h.sleep ntp-4.2.4p7/include/ntp_refclock.h +--- ntp-4.2.4p7/include/ntp_refclock.h.sleep 2006-06-06 22:16:19.000000000 +0200 ++++ ntp-4.2.4p7/include/ntp_refclock.h 2009-07-21 16:38:47.000000000 +0200 +@@ -260,6 +260,7 @@ extern void refclock_control P((struct s + struct refclockstat *)); + extern int refclock_open P((char *, u_int, u_int)); + extern int refclock_setup P((int, u_int, u_int)); ++extern int refclock_timer_needed P((struct peer *)); + extern void refclock_timer P((struct peer *)); + extern void refclock_transmit P((struct peer *)); + extern int refclock_ioctl P((int, u_int)); +diff -up ntp-4.2.4p7/include/ntp_stdlib.h.sleep ntp-4.2.4p7/include/ntp_stdlib.h +--- ntp-4.2.4p7/include/ntp_stdlib.h.sleep 2006-12-28 13:03:05.000000000 +0100 ++++ ntp-4.2.4p7/include/ntp_stdlib.h 2009-07-21 16:38:47.000000000 +0200 +@@ -101,6 +101,7 @@ extern const char * FindConfig P((const + extern void signal_no_reset P((int, RETSIGTYPE (*func)(int))); + + extern void getauthkeys P((const char *)); ++extern int auth_agekeys_is_needed P((void)); + extern void auth_agekeys P((void)); + extern void rereadkeys P((void)); + +diff -up ntp-4.2.4p7/include/ntpd.h.sleep ntp-4.2.4p7/include/ntpd.h +--- ntp-4.2.4p7/include/ntpd.h.sleep 2009-07-21 16:38:47.000000000 +0200 ++++ ntp-4.2.4p7/include/ntpd.h 2009-07-21 16:38:47.000000000 +0200 +@@ -120,8 +120,10 @@ extern int leap_actual P((int)); + /* ntp_loopfilter.c */ + extern void init_loopfilter P((void)); + extern int local_clock P((struct peer *, double)); +-extern void adj_host_clock P((void)); ++extern int adj_host_clock_is_needed P((void)); ++extern void adj_host_clock P((int)); + extern void loop_config P((int, double)); ++extern int huffpuff_enabled P((void)); + extern void huffpuff P((void)); + extern u_long sys_clocktime; + extern u_long sys_tai; +@@ -221,6 +223,7 @@ extern void hack_restrict P((int, struct + /* ntp_timer.c */ + extern void init_timer P((void)); + extern void reinit_timer P((void)); ++extern int when_next_event P((void)); + extern void timer P((void)); + extern void timer_clr_stats P((void)); + extern void timer_interfacetimeout P((u_long)); +diff -up ntp-4.2.4p7/libntp/authkeys.c.sleep ntp-4.2.4p7/libntp/authkeys.c +--- ntp-4.2.4p7/libntp/authkeys.c.sleep 2004-02-25 06:58:03.000000000 +0100 ++++ ntp-4.2.4p7/libntp/authkeys.c 2009-07-21 16:38:47.000000000 +0200 +@@ -394,6 +394,24 @@ auth_delkeys(void) + } + } + ++int auth_agekeys_is_needed() { ++ 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.4p7/ntpd/ntp_loopfilter.c.sleep ntp-4.2.4p7/ntpd/ntp_loopfilter.c +--- ntp-4.2.4p7/ntpd/ntp_loopfilter.c.sleep 2009-07-21 16:38:47.000000000 +0200 ++++ ntp-4.2.4p7/ntpd/ntp_loopfilter.c 2009-07-21 16:38:47.000000000 +0200 +@@ -752,6 +752,10 @@ local_clock( + #endif /* LOCKCLOCK */ + } + ++int adj_host_clock_is_needed() { ++ return !(!ntp_enable || mode_ntpdate || (pll_control && ++ kern_enable)); ++} + + /* + * adj_host_clock - Called once every second to update the local clock. +@@ -761,7 +765,7 @@ local_clock( + */ + void + adj_host_clock( +- void ++ int time_elapsed + ) + { + double adjustment; +@@ -776,7 +780,8 @@ adj_host_clock( + * maximum error and the local clock driver will pick it up and + * pass to the common refclock routines. Very elegant. + */ +- sys_rootdispersion += clock_phi; ++ sys_rootdispersion += clock_phi * time_elapsed; ++ DPRINTF(2, ("loopfilter: %d\n", time_elapsed)); + + #ifndef LOCKCLOCK + /* +@@ -833,6 +838,11 @@ rstclock( + } + + ++int huffpuff_enabled() ++{ ++ return sys_huffpuff != NULL; ++} ++ + /* + * huff-n'-puff filter + */ +diff -up ntp-4.2.4p7/ntpd/ntp_refclock.c.sleep ntp-4.2.4p7/ntpd/ntp_refclock.c +--- ntp-4.2.4p7/ntpd/ntp_refclock.c.sleep 2006-06-06 22:16:43.000000000 +0200 ++++ ntp-4.2.4p7/ntpd/ntp_refclock.c 2009-07-21 16:38:47.000000000 +0200 +@@ -309,6 +309,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.4p7/ntpd/ntp_timer.c.sleep ntp-4.2.4p7/ntpd/ntp_timer.c +--- ntp-4.2.4p7/ntpd/ntp_timer.c.sleep 2009-05-12 07:58:55.000000000 +0200 ++++ ntp-4.2.4p7/ntpd/ntp_timer.c 2009-07-21 16:38:47.000000000 +0200 +@@ -63,6 +63,7 @@ volatile u_long alarm_overflow; + #define HOUR (60*60) + + u_long current_time; ++l_fp timer_base; + + /* + * Stats. Number of overflows and number of calls to transmit(). +@@ -99,6 +100,8 @@ static RETSIGTYPE alarming P((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); +@@ -132,6 +135,7 @@ reinit_timer(void) + setitimer(ITIMER_REAL, &itimer, (struct itimerval *)0); + # endif + # endif /* VMS */ ++#endif + } + + /* +@@ -159,6 +163,8 @@ init_timer(void) + timer_xmtcalls = 0; + timer_timereset = 0; + ++ get_systime(&timer_base); ++#if 0 + #if !defined(SYS_WINNT) + /* + * Set up the alarm interrupt. The first comes 2**EVENT_TIMEOUT +@@ -242,6 +248,7 @@ init_timer(void) + } + + #endif /* SYS_WINNT */ ++#endif + } + + #if defined(SYS_WINNT) +@@ -252,6 +259,46 @@ get_timer_handle(void) + } + #endif + ++int when_next_event() { ++ register struct peer *peer, *next_peer; ++ u_int n; ++ int next = current_time + HOUR; ++ ++ if (adj_host_clock_is_needed()) ++ return 1; ++ 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)) ++ return 1; ++#endif /* REFCLOCK */ ++ if (peer->action && peer->nextaction < next) ++ next = peer->nextaction; ++ if (peer->nextdate < next) ++ next = peer->nextdate; ++ } ++ } ++ ++ if (auth_agekeys_is_needed() && keys_timer < next) ++ next = keys_timer; ++ if (huffpuff_enabled() && huffpuff_timer < next) ++ next = huffpuff_timer; ++#ifdef OPENSSL ++ if (revoke_timer < next) ++ next = revoke_timer; ++#endif /* OPENSSL */ ++ if (interface_interval && interface_timer < next) ++ next = interface_timer; ++ if (stats_timer < next) ++ next = stats_timer; ++ ++ next -= current_time; ++ if (next <= 0) ++ next = 1; ++ return next; ++} ++ + /* + * timer - dispatch anyone who needs to be + */ +@@ -264,14 +311,12 @@ timer(void) + #endif /* OPENSSL */ + u_int n; + +- current_time += (1< 0.0) { + struct timeval t1; + +- t1.tv_sec = 1; t1.tv_usec = 0; ++ t1.tv_sec = d; ++ t1.tv_usec = (d - t1.tv_sec) * 1000000; + nfound = select(maxactivefd+1, &rdfdes, (fd_set *)0, + (fd_set *)0, &t1); ++ get_systime(&ts); ++ } else ++ nfound = 0; ++ ++ ts3 = ts; ++ L_SUB(&ts3, &timer_base); ++#ifdef DEBUG ++ LFPTOD(&ts3, d); ++ DPRINTF(2, ("main: elapsed %f\n", d)); ++#endif ++ ++ if (ts3.l_i < 0 || ts3.l_ui > ts2.l_ui + 10) { ++#ifdef DEBUG ++ DPRINTF(2, ("main: unexpected time jump\n")); ++#endif ++ ts3.l_ui = 0; ++ reinit_timer(); + } +-# 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(&ts); ++ time_elapsed += ts3.l_ui; ++ current_time += ts3.l_ui; ++ timer_base.l_ui += ts3.l_ui; + ++ if (nfound > 0) ++ { + (void)input_handler(&ts); ++ ts_last[ts_last_index] = ts; ++ ts_last_index = (ts_last_index + 1) % TS_LAST_SIZE; + } + else if (nfound == -1 && errno != EINTR) + netsyslog(LOG_ERR, "select() error: %m"); +@@ -1050,17 +1083,12 @@ getgroup: + netsyslog(LOG_DEBUG, "select(): nfound=%d, error: %m", nfound); + # endif /* DEBUG */ + # else /* HAVE_SIGNALED_IO */ +- ++# error not supported + wait_for_signal(); + # endif /* HAVE_SIGNALED_IO */ +- if (alarm_flag) /* alarmed? */ +- { +- was_alarmed = 1; +- alarm_flag = 0; +- } + } + +- if (was_alarmed) ++ if (time_elapsed) + { + UNBLOCK_IO_AND_ALARM(); + /* +@@ -1068,7 +1096,7 @@ getgroup: + * to process expiry. + */ + timer(); +- was_alarmed = 0; ++ time_elapsed = 0; + BLOCK_IO_AND_ALARM(); + } + +@@ -1086,19 +1114,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.conf b/ntp.conf index 6a6ff25..c0815c0 100644 --- a/ntp.conf +++ b/ntp.conf @@ -19,9 +19,9 @@ restrict -6 ::1 # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). -server 0.fedora.pool.ntp.org -server 1.fedora.pool.ntp.org -server 2.fedora.pool.ntp.org +server 0.VENDORZONE.pool.ntp.org +server 1.VENDORZONE.pool.ntp.org +server 2.VENDORZONE.pool.ntp.org #broadcast 192.168.1.255 autokey # broadcast server #broadcastclient # broadcast client diff --git a/ntp.spec b/ntp.spec index 623bef6..ac6c88f 100644 --- a/ntp.spec +++ b/ntp.spec @@ -1,19 +1,19 @@ Summary: The NTP daemon and utilities Name: ntp Version: 4.2.4p7 -Release: 2%{?dist} +Release: 3%{?dist} # primary license (COPYRIGHT) : MIT # ElectricFence/ (not used) : GPLv2 # kernel/sys/ppsclock.h (not used) : BSD with advertising # include/ntif.h (not used) : BSD -# include/rsa_md5.h (replaced) : BSD with advertising -# include/ntp_rfc2553.h (replaced) : BSD with advertising +# include/rsa_md5.h : BSD with advertising +# include/ntp_rfc2553.h : BSD with advertising # libisc/inet_aton.c (not used) : BSD with advertising -# libntp/md5c.c (replaced) : BSD with advertising -# libntp/mktime.c (replaced) : BSD with advertising -# libntp/ntp_random.c (replaced) : BSD with advertising -# libntp/memmove.c (replaced) : BSD with advertising -# libntp/ntp_rfc2553.c (replaced) : BSD with advertising +# libntp/md5c.c : BSD with advertising +# libntp/mktime.c : BSD with advertising +# libntp/ntp_random.c : BSD with advertising +# libntp/memmove.c : BSD with advertising +# libntp/ntp_rfc2553.c : BSD with advertising # libntp/adjtimex.c (not used) : BSD # libopts/ : BSD or GPLv2+ # libparse/ : BSD @@ -26,7 +26,7 @@ Release: 2%{?dist} # ntpstat-0.2/ : GPLv2 # util/ansi2knr.c (not used) : GPL+ # sntp/ (not packaged) : MSNTP -License: (MIT and BSD and BSD with advertising) and (MIT and BSD) and GPLv2 +License: (MIT and BSD and BSD with advertising) and GPLv2 Group: System Environment/Daemons Source0: http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-%{version}.tar.gz Source1: ntp.conf @@ -64,8 +64,8 @@ Patch10: ntp-4.2.4p5-htmldoc.patch Patch11: ntp-4.2.4p2-filegen.patch # ntpbz #738 Patch12: ntp-4.2.4-sprintf.patch -# drop this and switch to libedit in 4.2.6 -Patch13: ntp-4.2.4p4-bsdadv.patch +# use editline instead of readline +Patch13: ntp-4.2.4p7-editline.patch # add option -m to lock memory Patch14: ntp-4.2.4p7-mlock.patch # fixed in 4.2.5 @@ -73,7 +73,7 @@ Patch15: ntp-4.2.4p2-clockselect.patch # don't build sntp Patch16: ntp-4.2.4p7-nosntp.patch # ntpbz #802 -Patch17: ntp-4.2.4p5-sleep.patch +Patch17: ntp-4.2.4p7-sleep.patch # ntpbz #779, #823 Patch18: ntp-4.2.4p7-bcast.patch # ntpbz #759 @@ -100,15 +100,17 @@ Patch28: ntp-4.2.4p7-nano.patch Patch29: ntp-4.2.4p7-minpoll.patch # fix frequency mode, backported from 4.2.5 Patch30: ntp-4.2.4p7-freqmode.patch +# handle unknown clock types +Patch31: ntpstat-0.2-clksrc.patch +# process first packet in multipacket response +Patch32: ntpstat-0.2-multipacket.patch URL: http://www.ntp.org Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig /sbin/service Requires(postun): /sbin/service Requires: ntpdate = %{version}-%{release} -# Require libreadline linked with libtinfo -Requires: readline >= 5.2-3 -BuildRequires: libcap-devel openssl-devel readline-devel perl-HTML-Parser +BuildRequires: libcap-devel openssl-devel libedit-devel perl-HTML-Parser BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description @@ -151,6 +153,12 @@ This package contains NTP documentation in HTML format. %define ntpdocdir %{_datadir}/doc/%{name}-%{version} +# pool.ntp.org vendor zone which will be used in ntp.conf +%if 0%{!?vendorzone:1} +%{?fedora: %define vendorzone fedora.} +%{?rhel: %define vendorzone rhel.} +%endif + %prep %setup -q -a 5 @@ -165,6 +173,7 @@ This package contains NTP documentation in HTML format. %patch10 -p1 -b .htmldoc %patch11 -p1 -b .filegen %patch12 -p1 -b .sprintf +%patch13 -p1 -b .editline %patch14 -p1 -b .mlock %patch15 -p1 -b .clockselect %patch16 -p1 -b .nosntp @@ -181,6 +190,8 @@ This package contains NTP documentation in HTML format. %patch28 -p1 -b .nano %patch29 -p1 -b .minpoll %patch30 -p1 -b .freqmode +%patch31 -p1 -b .clksrc +%patch32 -p1 -b .multipacket # clock_gettime needs -lrt sed -i.gettime 's|^LIBS = @LIBS@|& -lrt|' ntp{d,q,dc,date}/Makefile.in @@ -190,20 +201,12 @@ sed -i.gettime 's|^LIBS = @LIBS@|& -lrt|' ntp{d,q,dc,date}/Makefile.in %patch5 -p1 -b .linkfastmath %endif -# replace BSD with advertising code in ntp{dc,q} to allow linking with readline -for f in include/{ntp_rfc2553,rsa_md5}.h \ - libntp/{mktime,memmove,md5c,ntp_rfc2553,ntp_random}.c -do rm -f $f; touch $f; done -ln -sf md5.h include/rsa_md5.h -ln -sf md5.c libntp/md5c.c -%patch13 -p1 -b .bsdadv - for f in COPYRIGHT; do iconv -f iso8859-1 -t utf8 -o ${f}{_,} && touch -r ${f}{,_} && mv -f ${f}{_,} done %build -export CFLAGS="$RPM_OPT_FLAGS" +export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" if echo 'int main () { return 0; }' | gcc -pie -fPIE -O2 -xc - -o pietest 2>/dev/null; then ./pietest && export CFLAGS="$CFLAGS -pie -fPIE" rm -f pietest @@ -260,7 +263,9 @@ pushd $RPM_BUILD_ROOT mkdir -p .%{_sysconfdir}/{ntp/crypto,sysconfig,dhcp/dhclient.d} .%{_initrddir} mkdir -p .%{_localstatedir}/{lib/ntp,log/ntpstats} touch .%{_localstatedir}/lib/ntp/drift -sed -e 's|ETCNTP|%{_sysconfdir}/ntp|' -e 's|VARNTP|%{_localstatedir}/lib/ntp|' \ +sed -e 's|VENDORZONE\.|%{vendorzone}|' \ + -e 's|ETCNTP|%{_sysconfdir}/ntp|' \ + -e 's|VARNTP|%{_localstatedir}/lib/ntp|' \ < %{SOURCE1} > .%{_sysconfdir}/ntp.conf touch -r %{SOURCE1} .%{_sysconfdir}/ntp.conf install -p -m600 %{SOURCE2} .%{_sysconfdir}/ntp/keys @@ -360,6 +365,15 @@ fi %{ntpdocdir}/html %changelog +* Tue Jul 21 2009 Miroslav Lichvar 4.2.4p7-3 +- handle system time jumps better +- don't wake up every second for refclocks without timer +- don't crash in ntpstat when unknown clock type is received (#505564) +- make ntpstat process first packet in multipacket response +- switch to editline +- set pool.ntp.org vendor zone in spec (#512711) +- compile with -fno-strict-aliasing + * Thu May 28 2009 Miroslav Lichvar 4.2.4p7-2 - fix frequency calculation when starting with no drift file - reduce phase adjustments beyond Allan intercept in daemon PLL diff --git a/ntpstat-0.2-clksrc.patch b/ntpstat-0.2-clksrc.patch new file mode 100644 index 0000000..c427f1f --- /dev/null +++ b/ntpstat-0.2-clksrc.patch @@ -0,0 +1,12 @@ +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))) { diff --git a/ntpstat-0.2-multipacket.patch b/ntpstat-0.2-multipacket.patch new file mode 100644 index 0000000..ca21257 --- /dev/null +++ b/ntpstat-0.2-multipacket.patch @@ -0,0 +1,12 @@ +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");