]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sources: try to replace NTP sources with bad distance
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 22 Mar 2016 16:01:38 +0000 (17:01 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 22 Mar 2016 16:12:27 +0000 (17:12 +0100)
Similarly to unreachable sources and falsetickers, try to replace
sources with distance larger than the limit set by the maxdistance
directive with a newly resolved address of the hostname.

doc/chrony.conf.adoc
sources.c

index 8cca026cd9587dbe0ddbaa93e87cc3a8c0f2275b..55d20caf1072b2842e7af42a096c17ed99753127 100644 (file)
@@ -204,10 +204,11 @@ the default value is 4.
 +
 On start, when the pool name is resolved, *chronyd* will add up to 16 sources,
 one for each resolved address. When the number of sources from which at least
-one valid reply was received reaches *maxsources*, the other sources will be
-removed. When a pool source is unreachable or marked as a falseticker,
-*chronyd* will try to replace the source with a newly resolved address of the
-pool.
+one valid reply was received reaches the number specified by the *maxsources*
+option, the other sources will be removed. When a pool source is unreachable,
+marked as a falseticker, or has a distance larger than the limit set by the
+<<maxdistance,*maxdistance*>> directive, *chronyd* will try to replace the
+source with a newly resolved address from the pool.
 +
 An example of the *pool* directive is
 +
index 04bd36bc4799f8c6f39d20dc66742f6bc2a5ba15..28fc16b12ebedf7a6ec69581d8ac76af2645c11f 100644 (file)
--- a/sources.c
+++ b/sources.c
@@ -429,9 +429,11 @@ SRC_UpdateReachability(SRC_Instance inst, int reachable)
     REF_SetUnsynchronised();
   }
 
-  /* Try to replace NTP sources that are unreachable or falsetickers */
-  if (inst->type == SRC_NTP && (inst->status == SRC_FALSETICKER ||
-      (!inst->reachability && inst->reachability_size == SOURCE_REACH_BITS))) {
+  /* Try to replace NTP sources that are unreachable, falsetickers, or
+     have root distance larger than the allowed maximum */
+  if (inst->type == SRC_NTP &&
+      ((!inst->reachability && inst->reachability_size == SOURCE_REACH_BITS) ||
+       inst->status == SRC_FALSETICKER || inst->status == SRC_BAD_DISTANCE)) {
     NSR_HandleBadSource(inst->ip_addr);
   }
 }