[Bug 10466] ntpd: fails to sync if bad servers first in list

bugzilla at busybox.net bugzilla at busybox.net
Sat Oct 28 16:04:47 UTC 2017


https://bugs.busybox.net/show_bug.cgi?id=10466

Denys Vlasenko <vda.linux at googlemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #3 from Denys Vlasenko <vda.linux at googlemail.com> ---
Indeed, DNS resolution delay...
Fixed in git this way:

--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -866,10 +866,8 @@ do_sendto(int fd,
 static void
 send_query_to_peer(peer_t *p)
 {
-       if (!p->p_lsa) {
-               if (!resolve_peer_hostname(p))
-                       return;
-       }
+       if (!p->p_lsa)
+               return;

        /* Why do we need to bind()?
         * See what happens when we don't bind:
@@ -2360,6 +2358,14 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv)
                int nfds, timeout;
                double nextaction;

+               /* Resolve peer names to IPs, if not resolved yet */
+               for (item = G.ntp_peers; item != NULL; item = item->link) {
+                       peer_t *p = (peer_t *) item->data;
+
+                       if (p->next_action_time <= G.cur_time && !p->p_lsa)
+                               resolve_peer_hostname(p);
+               }
+
                /* Nothing between here and poll() blocks for any significant
time */

                nextaction = G.cur_time + 3600;

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list