Closes #7211.
is used instead.</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>RootDistanceMaxSec=</varname></term>
+ <listitem><para>Maximum acceptable root distance in seconds.
+ Defaults to 5 seconds.</para></listitem>
+ </varlistentry>
+
</variablelist>
</refsect1>
%struct-type
%includes
%%
-Time.NTP, config_parse_servers, SERVER_SYSTEM, 0
-Time.Servers, config_parse_servers, SERVER_SYSTEM, 0
-Time.FallbackNTP, config_parse_servers, SERVER_FALLBACK, 0
+Time.NTP, config_parse_servers, SERVER_SYSTEM, 0
+Time.Servers, config_parse_servers, SERVER_SYSTEM, 0
+Time.FallbackNTP, config_parse_servers, SERVER_FALLBACK, 0
+Time.RootDistanceMaxSec, config_parse_sec, 0, offsetof(Manager, max_root_distance_usec)
#define NTP_FIELD_MODE(f) ((f) & 7)
#define NTP_FIELD(l, v, m) (((l) << 6) | ((v) << 3) | (m))
-/* Maximum acceptable root distance in seconds. */
-#define NTP_MAX_ROOT_DISTANCE 5.0
+/* Maximum acceptable root distance in microseconds. */
+#define NTP_MAX_ROOT_DISTANCE (5 * USEC_PER_SEC)
/* Maximum number of missed replies before selecting another source. */
#define NTP_MAX_MISSED_REPLIES 2
}
root_distance = ntp_ts_short_to_d(&ntpmsg.root_delay) / 2 + ntp_ts_short_to_d(&ntpmsg.root_dispersion);
- if (root_distance > NTP_MAX_ROOT_DISTANCE) {
+ if (root_distance > (double) m->max_root_distance_usec / (double) USEC_PER_SEC) {
log_debug("Server has too large root distance. Disconnecting.");
return manager_connect(m);
}
if (!m)
return -ENOMEM;
+ m->max_root_distance_usec = NTP_MAX_ROOT_DISTANCE;
+
m->server_socket = m->clock_watch_fd = -1;
RATELIMIT_INIT(m->ratelimit, RATELIMIT_INTERVAL_USEC, RATELIMIT_BURST);
} samples[8];
unsigned int samples_idx;
double samples_jitter;
+ usec_t max_root_distance_usec;
/* last change */
bool jumped;
[Time]
#NTP=
#FallbackNTP=@NTP_SERVERS@
+#RootDistanceMaxSec=5