]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sources: add new status for sources that overlap trusted sources
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 11 Nov 2016 13:04:12 +0000 (14:04 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 21 Nov 2016 11:03:45 +0000 (12:03 +0100)
Sources that overlap trusted sources should be displayed in the chronyc
sources report with the '-' symbol and they shouldn't trigger a
replacement.

sources.c

index 79f72cfe2d941b65a9c487190121a21c41614a29..550d1093c77a460b973aa7c4d5a66fa8f45b5cc7 100644 (file)
--- a/sources.c
+++ b/sources.c
@@ -74,6 +74,7 @@ typedef enum {
   SRC_WAITS_STATS,      /* Others have bad stats, selection postponed */
   SRC_STALE,            /* Has older samples than others */
   SRC_ORPHAN,           /* Has stratum equal or larger than orphan stratum */
+  SRC_UNTRUSTED,        /* Overlaps trusted sources */
   SRC_FALSETICKER,      /* Doesn't agree with others */
   SRC_JITTERY,          /* Scatter worse than other's dispersion (not used) */
   SRC_WAITS_SOURCES,    /* Not enough sources, selection postponed */
@@ -890,6 +891,9 @@ SRC_SelectSource(SRC_Instance updated_inst)
 
       if (sources[i]->sel_options & SRC_SELECT_REQUIRE)
         sel_req_source = 0;
+    } else if (sources[i]->sel_info.lo_limit <= best_lo &&
+               sources[i]->sel_info.hi_limit >= best_hi) {
+      sources[i]->status = SRC_UNTRUSTED;
     } else {
       sources[i]->status = SRC_FALSETICKER;
     }
@@ -1318,6 +1322,7 @@ SRC_ReportSource(int index, RPT_SourceReport *report, struct timeval *now)
       case SRC_JITTERY:
         report->state = RPT_JITTERY;
         break;
+      case SRC_UNTRUSTED:
       case SRC_WAITS_SOURCES:
       case SRC_NONPREFERRED:
       case SRC_WAITS_UPDATE: