From: Harlan Stenn Date: Wed, 5 Dec 2007 06:34:40 +0000 (-0500) Subject: Fixes from Dave Mills X-Git-Tag: NTP_4_2_5P105~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32c4070713cdf0d151610bff3ac374bc514a5484;p=thirdparty%2Fntp.git Fixes from Dave Mills bk: 47564680_igxXwT4wFHbIGLtAL5kmw --- diff --git a/ChangeLog b/ChangeLog index 0e3dc3072..2cf27bea9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +* ntp_proto.c: sys_survivors and hpoll cleanup from Dave Mills. +* ntp_loopfilter.c: sys_poll cleanup from Dave Mills. * refclock_wwv.c: maximum-likelihood digit and DSYNC fixes from Dave Mills. * [Bug 967] preemptable associations are lost forever on a step. * ntp_config.c: [CID 48] missing "else" clause. diff --git a/ntpd/ntp_loopfilter.c b/ntpd/ntp_loopfilter.c index 5c171ccfb..9090c9cc2 100644 --- a/ntpd/ntp_loopfilter.c +++ b/ntpd/ntp_loopfilter.c @@ -326,6 +326,10 @@ local_clock( * than 0.5 s. */ osys_poll = sys_poll; + if (sys_poll < peer->minpoll) + sys_poll = peer->minpoll; + if (sys_poll > peer->maxpoll) + sys_poll = peer->maxpoll; clock_epoch += mu; clock_frequency = flladj = plladj = 0; rval = 1; @@ -408,15 +412,10 @@ local_clock( } else { /* - * The offset is less than the step threshold. Clamp the - * poll update to the current peer. Calculatethe jitter - * as the exponentially weighted offset + * The offset is less than the step threshold. Calculate + * the jitter as the exponentially weighted offset * differences. */ - if (sys_poll < peer->minpoll) - sys_poll = peer->minpoll; - if (sys_poll > peer->maxpoll) - sys_poll = peer->maxpoll; etemp = SQUARE(clock_jitter); dtemp = SQUARE(max(fabs(fp_offset - last_offset), LOGTOD(sys_precision))); diff --git a/ntpd/ntp_proto.c b/ntpd/ntp_proto.c index d88c2931b..e9bdbc69e 100644 --- a/ntpd/ntp_proto.c +++ b/ntpd/ntp_proto.c @@ -156,6 +156,7 @@ transmit( * is intricate... */ hpoll = peer->hpoll; + /* * In broadcast mode the poll interval is never changed from * minpoll. @@ -233,6 +234,7 @@ transmit( * Here the peer is reachable. Send a burst if * enabled and the peer is fit. */ + hpoll = sys_poll; if (!oreach || !(peer->flags & FLAG_PREEMPT)) peer->unreach = 0; if (peer->flags & FLAG_BURST && peer->retry == @@ -246,7 +248,8 @@ transmit( * poll_update() routine will clamp it to maxpoll. */ if (peer->unreach >= NTP_UNREACH) { - if (peer->flags & FLAG_PREEMPT) { + if (peer->flags & FLAG_PREEMPT && + sys_survivors >= sys_maxclock) { peer_clear(peer, "TIME"); unpeer(peer); return; @@ -261,8 +264,8 @@ transmit( peer_clear(peer, "TIME"); peer->unreach = 0; } - hpoll++; #endif /* OPENSSL */ + hpoll++; } } } else { @@ -1842,13 +1845,13 @@ clock_filter( * If the the new sample and the current sample are both valid * and the difference between their offsets exceeds CLOCK_SGATE * (3) times the jitter and the interval between them is less - * than twice the system poll interval, consider the new sample + * than twice the host poll interval, consider the new sample * a popcorn spike and ignore it. */ if (peer->disp < sys_maxdist && peer->filter_disp[k] < sys_maxdist && etemp > CLOCK_SGATE * peer->jitter && peer->filter_epoch[k] - peer->epoch < 2. * - ULOGTOD(sys_poll)) { + ULOGTOD(peer->hpoll)) { #ifdef DEBUG if (debug) printf("clock_filter: popcorn %.6f %.6f\n", @@ -3086,10 +3089,10 @@ peer_unfit( /* * A distance error for a remote peer occurs if the root * distance is greater than or equal to the distance threshold - * plus the increment due to one poll interval. + * plus the increment due to one host poll interval. */ if (!(peer->flags & FLAG_REFCLOCK) && root_distance(peer) >= - sys_maxdist + clock_phi * ULOGTOD(sys_poll)) + sys_maxdist + clock_phi * ULOGTOD(peer->hpoll)) rval |= TEST11; /* distance exceeded */ /*