From: Harlan Stenn Date: Fri, 29 May 2009 07:50:53 +0000 (-0400) Subject: Lose FLAG_FIXPOLL, from Dave Mills X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=271a83e4a06e486cbf5e2a1c5424642c8ebb29e8;p=thirdparty%2Fntp.git Lose FLAG_FIXPOLL, from Dave Mills bk: 4a1f93ddkVCRctywwRjhLbyILGPwLA --- diff --git a/ChangeLog b/ChangeLog index d9818af098..c5c3e2424c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* Lose FLAG_FIXPOLL, from Dave Mills. (4.2.5p179) 2009/05/23 Released by Harlan Stenn * [Bug 1041] xmt -> aorg timestamp cleanup from Dave Mills, reported by Dave Hart. diff --git a/include/ntp.h b/include/ntp.h index 333a1d2163..f845b3c433 100644 --- a/include/ntp.h +++ b/include/ntp.h @@ -438,7 +438,7 @@ struct peer { #define FLAG_SYSPEER 0x0010 /* system peer */ #define FLAG_PREFER 0x0020 /* prefer peer */ #define FLAG_BURST 0x0040 /* burst mode */ -#define FLAG_FIXPOLL 0x0080 /* stick at minpoll */ +#define FLAG_PPS 0x0080 /* steered by PPS */ #define FLAG_IBURST 0x0100 /* initial burst mode */ #define FLAG_NOSELECT 0x0200 /* never select */ #define FLAG_TRUE 0x0400 /* force truechimer */ @@ -446,11 +446,10 @@ struct peer { #define FLAG_XLEAVE 0x1000 /* interleaved protocol */ #define FLAG_XB 0x2000 /* interleaved broadcast */ #define FLAG_XBOGUS 0x4000 /* interleaved bogus packet */ -#define FLAG_PPS 0x8000 /* steered by PPS */ #ifdef OPENSSL -#define FLAG_ASSOC 0x10000 /* autokey request */ +#define FLAG_ASSOC 0x8000 /* autokey request */ #endif /* OPENSSL */ -#define FLAG_ADKEY 0x00010000 /* Authenticated (or wants reply to be authenticated) using AD authentication */ +#define FLAG_ADKEY 0x10000 /* Authenticated (or wants reply to be authenticated) using AD authentication */ /* * Definitions for the clear() routine. We use memset() to clear diff --git a/ntpd/ntp_config.c b/ntpd/ntp_config.c index 8935a11c57..5be1e3af5a 100644 --- a/ntpd/ntp_config.c +++ b/ntpd/ntp_config.c @@ -562,8 +562,8 @@ create_peer_node( my_node = get_node(sizeof *my_node); /* Initialze node values to default */ - my_node->minpoll = NTP_MINDPOLL; - my_node->maxpoll = NTP_MAXDPOLL; + my_node->minpoll = 0; + my_node->maxpoll = 0; my_node->ttl = 0; my_node->peerversion = NTP_VERSION; my_node->peerkey = 0; diff --git a/ntpd/ntp_peer.c b/ntpd/ntp_peer.c index 039bf4dbf4..3ee2911f7e 100644 --- a/ntpd/ntp_peer.c +++ b/ntpd/ntp_peer.c @@ -817,9 +817,25 @@ newpeer( cast_flags)); peer->hmode = (u_char)hmode; peer->version = (u_char)version; - peer->minpoll = (u_char)max(ntp_minpoll, minpoll); - peer->maxpoll = (u_char)min(NTP_MAXPOLL, maxpoll); peer->flags = flags; + + /* + * It is an error to set minpoll less than NTP_MINPOLL or to + * set maxpoll greater than NTP_MAXPOLL. However, minpoll is + * clamped not greater than NTP_MAXPOLL and maxpoll is clamped + * not less than NTP_MINPOLL without complaint. Finally, + * minpoll is clamped not greater than maxpoll. + */ + if (minpoll == 0) + peer->minpoll = NTP_MINDPOLL; + else + peer->minpoll = min(minpoll, NTP_MAXPOLL); + if (maxpoll == 0) + peer->maxpoll = NTP_MAXDPOLL; + else + peer->maxpoll = max(maxpoll, NTP_MINPOLL); + if (peer->minpoll > peer->maxpoll) + peer->minpoll = peer->maxpoll; #ifdef DEBUG if (debug > 2) { if (peer->dstadr) @@ -879,12 +895,13 @@ newpeer( * the peer timer, since the clock may have requirements * for this. */ + if (maxpoll == 0) + peer->maxpoll = peer->minpoll; if (!refclock_newpeer(peer)) { /* * Dump it, something screwed up */ set_peerdstadr(peer, NULL); - peer->next = peer_free; peer_free = peer; peer_free_count++; diff --git a/ntpd/ntp_proto.c b/ntpd/ntp_proto.c index 9930d2b316..5bd5853ee7 100644 --- a/ntpd/ntp_proto.c +++ b/ntpd/ntp_proto.c @@ -1807,8 +1807,7 @@ poll_update( * works for any association. Otherwise, clamp the poll interval * between minpoll and maxpoll. */ - if ((peer->flags & FLAG_FIXPOLL) || (peer->cast_flags & - MDF_BCLNT)) + if (peer->cast_flags & MDF_BCLNT) hpoll = peer->minpoll; else hpoll = max(min(peer->maxpoll, mpoll), peer->minpoll); diff --git a/ntpd/ntp_refclock.c b/ntpd/ntp_refclock.c index 9ab311c0e2..298e3a1940 100644 --- a/ntpd/ntp_refclock.c +++ b/ntpd/ntp_refclock.c @@ -214,7 +214,7 @@ refclock_newpeer( */ peer->refclktype = clktype; peer->refclkunit = (u_char)unit; - peer->flags |= FLAG_REFCLOCK | FLAG_FIXPOLL; + peer->flags |= FLAG_REFCLOCK; peer->leap = LEAP_NOTINSYNC; peer->stratum = STRATUM_REFCLOCK; peer->ppoll = peer->maxpoll; diff --git a/ntpd/refclock_acts.c b/ntpd/refclock_acts.c index d463ea21c4..058abfd642 100644 --- a/ntpd/refclock_acts.c +++ b/ntpd/refclock_acts.c @@ -268,7 +268,6 @@ acts_start ( pp->clockdesc = DESCRIPTION; memcpy((char *)&pp->refid, REFID, 4); peer->sstclktype = CTL_SST_TS_TELEPHONE; - peer->flags &= ~FLAG_FIXPOLL; up->bufptr = pp->a_lastcode; return (1); }