On Thursday, February 1, 2007 at 0:34:10 +0100, Serge Bets wrote:

> It seems you are right on the track: My system has no getaddrinfo().
> So ntpq 4.2.4 uses its own bundled replacement from
> libntp/ntp_rfc2553.c, which doesn't seem to make use of
> AI_NUMERICHOST.

Confirmed: libntp/ntp_rfc2553.c:getaddrinfo() calls do_nodename(), which
calls DNSlookup_name(), regardless of AI_NUMERICHOST. To confirm it
experimentaly I made the DNSlookup_name() call conditional. And then
ntpq -p display becomes normally fast, and DNS logs show no more
importune A queries. Problem solved: Bravo Ronan, thank you very much,
and thanks to all contributors. :-)

Next step is to report this to bugzilla, I suppose. Could anyone suggest
a proper fix? Mine works as proof but is probably inapropriate:


= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
--- ntp-4.2.4/libntp/ntp_rfc2553.c      Thu Dec 28 13:03:08 2006
+++ ntp-4.2.4.mod/libntp/ntp_rfc2553.c  Thu Feb  1 14:30:16 2007
@@ -397,7 +397,10 @@ do_nodename(
         * Look for a name
         */
 
-       errval = DNSlookup_name(nodename, AF_INET, &hp);
+       if ((hints->ai_flags & AI_NUMERICHOST) == 0)
+               errval = DNSlookup_name(nodename, AF_INET, &hp);
+       else
+               errval = EAI_NONAME;    /* ?? */
 
        if (hp == NULL) {
                if (errval == TRY_AGAIN || errval == EAI_AGAIN)
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =


Serge.
-- 
Serge point Bets arobase laposte point net

_______________________________________________
questions mailing list
[email protected]
https://lists.ntp.isc.org/mailman/listinfo/questions

Reply via email to