From: Harlan Stenn Date: Sat, 24 Feb 2007 10:07:16 +0000 (-0500) Subject: [Bug 628] Fallback to ntp discipline not working for large offsets X-Git-Tag: NTP_4_2_4P0_RC5~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0233fa07065513d608f5b8354e5a649dad376145;p=thirdparty%2Fntp.git [Bug 628] Fallback to ntp discipline not working for large offsets bk: 45e00e54iQoCBTZBgMDg2ZsrLjBzuQ --- diff --git a/ntpd/ntp_loopfilter.c b/ntpd/ntp_loopfilter.c index a103d3aec..d0fa466c9 100644 --- a/ntpd/ntp_loopfilter.c +++ b/ntpd/ntp_loopfilter.c @@ -332,10 +332,13 @@ local_clock( * these actions interact with the command line options. * * Note the system poll is set to minpoll only if the clock is - * stepped. + * stepped. Note also the kernel is disabled if step is + * disabled or greater than 0.5 s. */ clock_frequency = flladj = plladj = 0; mu = peer->epoch - sys_clocktime; + if (clock_max == 0 || clock_max > 0.5) + kern_enable = 0; rval = 1; if (fabs(fp_offset) > clock_max && clock_max > 0) { switch (state) { @@ -544,8 +547,7 @@ local_clock( * lead to overflow problems. This might occur if some misguided * lad set the step threshold to something ridiculous. */ - if (pll_control && kern_enable && clock_max < 0.5 && - clock_max > 0) { + if (pll_control && kern_enable) { /* * We initialize the structure for the ntp_adjtime() @@ -617,16 +619,6 @@ local_clock( } } - /* - * Switch to FLL mode if the poll interval is - * greater than MAXDPOLL, so that the kernel - * loop behaves as the daemon loop; viz., - * selects the FLL when necessary, etc. For - * legacy only. - */ - if (sys_poll > NTP_MAXDPOLL) - ntv.status |= STA_FLL; - /* * If the PPS signal is up and enabled, light * the frequency bit. If the PPS driver is @@ -795,7 +787,7 @@ adj_host_clock( * get out of Dodge quick. */ if (!ntp_enable || mode_ntpdate || (pll_control && - kern_enable && clock_max < 0.5)) + kern_enable)) return; /* @@ -894,15 +886,8 @@ loop_config( * behind. While at it, ask to set nanosecond mode. If * the kernel agrees, rejoice; othewise, it does only * microseconds. - * - * Call out the safety patrol. If ntpdate mode or if the - * step threshold has been increased by the -x option or - * tinker command, kernel discipline is unsafe, so don't - * do any of this stuff. Otherwise, initialize the - * kernel to appear unsynchronized until the first - * update is received. */ - if (mode_ntpdate || clock_max > CLOCK_MAX) + if (mode_ntpdate) break; pll_control = 1; @@ -985,7 +970,7 @@ loop_config( */ if (pll_control && kern_enable) { memset((char *)&ntv, 0, sizeof(ntv)); - ntv.modes = MOD_FREQUENCY; + ntv.modes = MOD_OFFSET | MOD_FREQUENCY; ntv.freq = (int32)(drift_comp * 65536e6); ntp_adjtime(&ntv); } @@ -999,7 +984,7 @@ loop_config( /* Completely turn off the kernel time adjustments. */ if (pll_control) { memset((char *)&ntv, 0, sizeof(ntv)); - ntv.modes = MOD_BITS | MOD_FREQUENCY; + ntv.modes = MOD_BITS | MOD_OFFSET | MOD_FREQUENCY; ntv.status = STA_UNSYNC; ntp_adjtime(&ntv); NLOG(NLOG_SYNCEVENT | NLOG_SYSEVENT)