]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 3822] ntpd significantly delays first poll of servers specified by name.
authorDave Hart <hart@ntp.org>
Sat, 3 Jun 2023 22:48:12 +0000 (22:48 +0000)
committerDave Hart <hart@ntp.org>
Sat, 3 Jun 2023 22:48:12 +0000 (22:48 +0000)
bk: 647bc32chIrpRZUjfC8jv3kwMsvLag

ChangeLog
ntpd/ntp_config.c

index 8e34d2a966967d8143214c12a5cfe88baa6837f7..2e2f3c314e1a73dffd461814760bbcf17241993e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+---
+* [Bug 3822] ntpd significantly delays first poll of servers specified by name.
+             <hart@ntp.org>  Miroslav Lichvar identified regression in 4.2.8p16.
+
 ---
 (4.2.8p16) 2023/05/31 Released by Harlan Stenn <stenn@ntp.org>
 
index f7219b8ee5604dc7ed390209b0e3a7f746404b7e..d9a753ee3a1eb759f9259c0a2c46cd39a4b6aff8 100644 (file)
@@ -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;
                }
        }