Your message dated Thu, 21 Sep 2017 14:41:00 +0200
with message-id <20170921124100.qzasb4rtsfoewsbn@lamella>
and subject line chrony: please allow to force using a source
has caused the Debian Bug report #479303,
regarding chrony: please allow to force using a source
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
479303: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=479303
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: chrony
Version: 1.23-3
Severity: wishlist
Tags: patch

It would be nice to tell chrony to always use a given source,
especially as it tends to give up easily if it has problems
with the local clock and then fills the syslog with messages
about no available sources and selecting this source again
every few seconds.

Attached patch adds a "trusted" keyword that seems to have the effect
I want.

Hochachtungsvoll,
        Bernhard R. Link
Index: chrony-1.23/cmdparse.c
===================================================================
--- chrony-1.23.orig/cmdparse.c	2008-04-30 15:52:08.000000000 +0200
+++ chrony-1.23/cmdparse.c	2008-04-30 15:52:21.000000000 +0200
@@ -56,6 +56,7 @@
   src->params.max_delay_ratio = 16384.0;
   src->params.online = 1;
   src->params.auto_offline = 0;
+  src->params.trusted = 0;
 
   result = CPS_Success;
   
@@ -138,6 +139,9 @@
           } else {
             line += n;
           }
+        } else if (!strncasecmp(cmd, "trusted", 7)) {
+          src->params.trusted = 1;
+
         } else if (!strncasecmp(cmd, "offline", 7)) {
           src->params.online = 0;
 
Index: chrony-1.23/srcparams.h
===================================================================
--- chrony-1.23.orig/srcparams.h	2008-04-30 15:52:08.000000000 +0200
+++ chrony-1.23/srcparams.h	2008-04-30 15:52:21.000000000 +0200
@@ -40,6 +40,7 @@
   unsigned long authkey;
   double max_delay;
   double max_delay_ratio;
+  int trusted;
 } SourceParameters;
 
 #define INACTIVE_AUTHKEY 0UL
Index: chrony-1.23/ntp_core.c
===================================================================
--- chrony-1.23.orig/ntp_core.c	2008-04-30 15:58:24.000000000 +0200
+++ chrony-1.23/ntp_core.c	2008-04-30 16:03:40.000000000 +0200
@@ -316,7 +316,7 @@
   result->local_poll = params->minpoll;
 
   /* Create a source instance for this NTP source */
-  result->source = SRC_CreateNewInstance(remote_addr->ip_addr); /* Will need extra params eventually */
+  result->source = SRC_CreateNewInstance(remote_addr->ip_addr, params->trusted); /* Will need extra params eventually */
 
   result->local_rx.tv_sec = 0;
   result->local_rx.tv_usec = 0;
Index: chrony-1.23/sources.c
===================================================================
--- chrony-1.23.orig/sources.c	2008-04-30 15:53:18.000000000 +0200
+++ chrony-1.23/sources.c	2008-04-30 16:06:32.000000000 +0200
@@ -88,6 +88,7 @@
   unsigned long ref_id;         /* The reference ID of this source
                                    (i.e. its IP address, NOT the
                                    reference _it_ is sync'd to) */
+  int trusted;                  /* flag set to never mark it jittery */
 
   /* Flag indicating that we are receiving packets with valid headers
      from this source and can use it as a reference */
@@ -155,7 +156,7 @@
 /* Function to create a new instance.  This would be called by one of
    the individual source-type instance creation routines. */
 
-SRC_Instance SRC_CreateNewInstance(unsigned long ref_id)
+SRC_Instance SRC_CreateNewInstance(unsigned long ref_id, int trusted)
 {
   SRC_Instance result;
 
@@ -186,6 +187,7 @@
   result->ref_id = ref_id;
   result->reachable = 0;
   result->status = SRC_BAD_STATS;
+  result->trusted = trusted;
 
   n_sources++;
 
@@ -599,7 +601,7 @@
          variance */
       for (i=0; i<n_sel_sources; i++) {
         index = sel_sources[i];
-        if (sources[index]->sel_info.variance > min_distance) {
+        if (sources[index]->sel_info.variance > min_distance && !sources[index]->trusted) {
           sel_sources[i] = INVALID_SOURCE;
           sources[index]->status = SRC_JITTERY;
 #if 0
Index: chrony-1.23/sources.h
===================================================================
--- chrony-1.23.orig/sources.h	2008-04-30 16:04:01.000000000 +0200
+++ chrony-1.23/sources.h	2008-04-30 16:04:16.000000000 +0200
@@ -53,7 +53,7 @@
 /* Function to create a new instance.  This would be called by one of
    the individual source-type instance creation routines. */
 
-extern SRC_Instance SRC_CreateNewInstance(unsigned long ref_id);
+extern SRC_Instance SRC_CreateNewInstance(unsigned long ref_id, int trusted);
 
 /* Function to get rid of a source when it is being unconfigured.
    This may cause the current reference source to be reselected, if this
Index: chrony-1.23/chrony.txt
===================================================================
--- chrony-1.23.orig/chrony.txt	2008-04-30 16:09:12.000000000 +0200
+++ chrony-1.23/chrony.txt	2008-04-30 16:11:18.000000000 +0200
@@ -1984,6 +1984,10 @@
      `online' (*note online command::) command when the link has been
      established, to enable measurements to start.)
 
+`trust'
+     Never mark this source as too wrong. Only usefull to force when
+     your local system clock does very strange things.
+
 
 4.3 Running chronyc
 ===================

--- End Message ---
--- Begin Message ---
Version: 2.2.1-1

I guess that the introduction of the “trust” option does what you requested in this bug report, consequently I’m closing it. Feel free to reopen if that is not the case!

Cheers,
Vincent

Attachment: signature.asc
Description: PGP signature


--- End Message ---

Reply via email to