]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 628] Fallback to ntp discipline not working for large offsets
authorHarlan Stenn <stenn@ntp.org>
Sat, 24 Feb 2007 10:07:16 +0000 (05:07 -0500)
committerHarlan Stenn <stenn@ntp.org>
Sat, 24 Feb 2007 10:07:16 +0000 (05:07 -0500)
bk: 45e00e54iQoCBTZBgMDg2ZsrLjBzuQ

ntpd/ntp_loopfilter.c

index a103d3aecaac861c5fafa7d6655ec0232b4fe0d9..d0fa466c9eb3753dc4941719829f69c15d2938f4 100644 (file)
@@ -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)