From: Miroslav Lichvar Date: Thu, 23 Jul 2026 13:48:08 +0000 (+0200) Subject: ntp: warn if no hostnames can be resolved X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;p=thirdparty%2Fchrony.git ntp: warn if no hostnames can be resolved If no hostnames could be resolved succesfully and the resolving retry interval reaches the maximum (about 1 hour after start), log once a warning message to indicate there might be a DNS issue. --- diff --git a/ntp_sources.c b/ntp_sources.c index aa53c425..e7f76d75 100644 --- a/ntp_sources.c +++ b/ntp_sources.c @@ -618,6 +618,7 @@ resolve_sources_timeout(void *arg) static void name_resolve_handler(DNS_Status status, int n_addrs, IPAddr *ip_addrs, void *anything) { + static int any_resolved_sources = 0; struct UnresolvedSource *us, *next; us = (struct UnresolvedSource *)anything; @@ -632,6 +633,7 @@ name_resolve_handler(DNS_Status status, int n_addrs, IPAddr *ip_addrs, void *any break; case DNS_Success: process_resolved_name(us, ip_addrs, n_addrs); + any_resolved_sources = 1; break; case DNS_Failure: LOG(LOGS_WARN, "Invalid host %s", us->name); @@ -671,6 +673,9 @@ name_resolve_handler(DNS_Status status, int n_addrs, IPAddr *ip_addrs, void *any MAX_RESOLVE_INTERVAL); resolving_id = SCH_AddTimeoutByDelay(RESOLVE_INTERVAL_UNIT * (1 << resolving_interval), resolve_sources_timeout, NULL); + + if (!any_resolved_sources && resolving_interval == MAX_RESOLVE_INTERVAL) + LOG_ONCE(LOGS_WARN, "Could not resolve any hostnames yet (misconfigured DNS?)"); } else { resolving_interval = 0; }