]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 3435] anchor NTP era alignment
authorJuergen Perlinger <perlinger@ntp.org>
Sat, 14 Oct 2017 06:37:26 +0000 (08:37 +0200)
committerJuergen Perlinger <perlinger@ntp.org>
Sat, 14 Oct 2017 06:37:26 +0000 (08:37 +0200)
bk: 59e1b0a6M8b40QR_jp7-h4PgIv1sGQ

html/miscopt.html
ntpd/ntp_config.c

index b458d799ab329f84badcb79e9dff4bf86fb0b448..69dbc3e00697f8a44981405bc3316b380ab354af 100644 (file)
@@ -11,7 +11,7 @@
 <img src="pic/boom3.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/~mills/pictures.html">from <i>Pogo</i>, Walt Kelly</a>
 <p>We have three, now looking for more.</p>
 <p>Last update:
-  <!-- #BeginDate format:En2m -->9-Nov-2016  12:26<!-- #EndDate -->
+  <!-- #BeginDate format:En2m -->14-Oct-2017  08:34<!-- #EndDate -->
     UTC</p>
 <br clear="left">
 <h4>Related Links</h4>
index 16fccb76ee818276aba2e2c7acb53451abc5b7c9..853e12f913c3ca23fe255187ff5fb5cd8a0c7505 100644 (file)
@@ -312,7 +312,7 @@ static void config_monitor(config_tree *);
 static void config_rlimit(config_tree *);
 static void config_system_opts(config_tree *);
 static void config_tinker(config_tree *);
-static void config_tos_clock(config_tree *);
+static int  config_tos_clock(config_tree *);
 static void config_tos(config_tree *);
 static void config_vars(config_tree *);
 
@@ -2025,13 +2025,19 @@ free_config_auth(
 #endif /* FREE_CFG_T */
 
 
-static void
+/* Configure low-level clock-related parameters. Return TRUE if the
+ * clock might need adjustment like era-checking after the call, FALSE
+ * otherwise.
+ */
+static int/*BOOL*/
 config_tos_clock(
        config_tree *ptree
        )
 {
+       int             ret;
        attr_val *      tos;
 
+       ret = FALSE;
        tos = HEAD_PFIFO(ptree->orphan_cmds);
        for (; tos != NULL; tos = tos->link) {
                switch(tos->attr) {
@@ -2041,9 +2047,11 @@ config_tos_clock(
 
                case T_Basedate:
                        basedate_set_day(tos->value.i);
+                       ret = TRUE;
                        break;
                }
        }
+       return ret;
 }
 
 static void
@@ -4467,10 +4475,13 @@ config_ntpd(
        int/*BOOL*/ input_from_files
        )
 {
-       dump_config_tree(ptree, stderr, 1); 
+       /* [Bug 3435] check and esure clock sanity if configured from
+        * file and clock sanity parameters (-> basedate) are given. Do
+        * this ASAP, so we don't disturb the closed loop controller.
+        */
        if (input_from_files) {
-               config_tos_clock(ptree);
-               clamp_systime();
+               if (config_tos_clock(ptree))
+                       clamp_systime();
        }
        
        config_nic_rules(ptree, input_from_files);