ntpd/ntpq tangle

Hal Murray halmurray at sonic.net
Sat Jul 11 04:10:20 UTC 2026


You should be able to drop these edits into your evironment.


This is a bug-fix.  It causes useless DNSFAIL printout in ntpq -p or 
ntpmon if you have pool slots, or DNS slots where the DNS hasn't worked 
yet.

diff --git a/libntp/socktoa.c b/libntp/socktoa.c
index e8925803b..567718511 100644
--- a/libntp/socktoa.c
+++ b/libntp/socktoa.c
@@ -46,7 +46,6 @@ socktoa_r(
                switch(AF(sock)) {
 
                case AF_INET:
-               case AF_UNSPEC:
                        inet_ntop(AF_INET, PSOCK_ADDR4(sock), buf, buflen);
                        break;

This is an attempt to avoid the bogus printout.  It crashed ntpq.

diff --git a/ntpd/ntp_control.c b/ntpd/ntp_control.c
index e7cd9f045..b41614dd4 100644
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -1634,6 +1634,8 @@ ctl_putpeer(
                break;
 
        case CP_SRCADR:
+               if (AF_UNSPEC == AF(&p->srcadr))
+                       break;   // empty slot: pool, or no DNS yet
                ctl_putadr(CV_NAME, 0, &p->srcadr);
                break;


-- 
These are my opinions.  I hate spam.





More information about the devel mailing list