From: Dave Hart Date: Sat, 3 Jun 2023 22:48:12 +0000 (+0000) Subject: [Bug 3822] ntpd significantly delays first poll of servers specified by name. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba406d4eed136b35b2d1fedc8657f3c327df9b1d;p=thirdparty%2Fntp.git [Bug 3822] ntpd significantly delays first poll of servers specified by name. bk: 647bc32chIrpRZUjfC8jv3kwMsvLag --- diff --git a/ChangeLog b/ChangeLog index 8e34d2a96..2e2f3c314 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +--- +* [Bug 3822] ntpd significantly delays first poll of servers specified by name. + Miroslav Lichvar identified regression in 4.2.8p16. + --- (4.2.8p16) 2023/05/31 Released by Harlan Stenn diff --git a/ntpd/ntp_config.c b/ntpd/ntp_config.c index f7219b8ee..d9a753ee3 100644 --- a/ntpd/ntp_config.c +++ b/ntpd/ntp_config.c @@ -131,6 +131,7 @@ typedef struct peer_resolved_ctx_tag { u_char maxpoll; u_int32 ttl; const char * group; + int was_initializing; } peer_resolved_ctx; /* Limits */ @@ -4420,6 +4421,7 @@ config_peers( ctx->hmode = MODE_CLIENT; ctx->version = NTP_VERSION; ctx->flags = FLAG_IBURST; + ctx->was_initializing = initializing; ZERO(hints); hints.ai_family = (u_short)ctx->family; @@ -4500,6 +4502,7 @@ config_peers( ctx->ttl = curr_peer->ttl; ctx->keyid = curr_peer->peerkey; ctx->group = curr_peer->group; + ctx->was_initializing = initializing; ZERO(hints); hints.ai_family = ctx->family; @@ -4574,6 +4577,16 @@ peer_name_resolved( name, fam_spec, stoa(&peeraddr)); } + + /* + * peer_clear needs to know if this association was specified + * in the startup configuration file to set the next poll time. + */ + if (ctx->was_initializing) { + INSIST(!initializing); + initializing = TRUE; + } + peer_config( &peeraddr, NULL, @@ -4587,6 +4600,11 @@ peer_name_resolved( ctx->ttl, ctx->keyid, ctx->group); + + if (ctx->was_initializing) { + initializing = FALSE; + } + break; } }