From: Miroslav Lichvar Date: Thu, 14 Mar 2024 14:32:28 +0000 (+0100) Subject: ntp: don't keep refresh requests in list of unresolved sources X-Git-Tag: 4.6-pre1~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e5513c80bc0e962e8c0bb4b9af9b4b79e194971;p=thirdparty%2Fchrony.git ntp: don't keep refresh requests in list of unresolved sources The refresh command adds requests to reresolve addresses of all sources. If some sources didn't have an IP address resolved yet, the corresponding requests were not removed after failed resolving. Repeated refresh commands increased the number of requests and number of calls of the system resolver, which might not be caching DNS responses. Remove all refresh requests from the list after resolving attempt to fix that. Reported-by: t.barnewski@avm.de Fixes: d7e3ad17ff7a ("ntp: create sources for unresolved addresses") --- diff --git a/ntp_sources.c b/ntp_sources.c index 396175d0..1257f577 100644 --- a/ntp_sources.c +++ b/ntp_sources.c @@ -638,8 +638,10 @@ name_resolve_handler(DNS_Status status, int n_addrs, IPAddr *ip_addrs, void *any next = us->next; /* Don't repeat the resolving if it (permanently) failed, it was a - replacement of a real address, or all addresses are already resolved */ - if (status == DNS_Failure || UTI_IsIPReal(&us->address.ip_addr) || is_resolved(us)) + replacement of a real address, a refreshment, or all addresses are + already resolved */ + if (status == DNS_Failure || UTI_IsIPReal(&us->address.ip_addr) || + us->refreshment || is_resolved(us)) remove_unresolved_source(us); /* If a restart was requested and this was the last source in the list,