ntpd/ntpq tangle

James Browning jamesb192 at jamesb192.com
Sat Jul 11 06:28:13 UTC 2026


> On 07/10/2026 9:10 PM PDT Hal Murray <halmurray at sonic.net> wrote:
>  
> 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.

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

Ah, but what if (rhetorically) it's some ridiculous value like AF_VSOCK?

```patch
diff --git a/ntpd/ntp_control.c b/ntpd/ntp_control.c
index e7cd9f045..6786ae501 100644
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -1634,6 +1634,9 @@ ctl_putpeer(
                break;
 
        case CP_SRCADR:
+               if ((AF_INET != AF(&p->srcadr)) && (AF_INET6 != AF(&p->srcadr))) {
+                       break;   // empty slot: pool, or no DNS yet
+               }
                ctl_putadr(CV_NAME, 0, &p->srcadr);
                break;
 
diff --git a/pylib/util.py b/pylib/util.py
index 7b6e69336..61511447c 100644
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -1120,7 +1120,7 @@ class PeerSummary:
                 ptype = 'l'     # local refclock
             elif dstadr_refid == "POOL":
                 ptype = 'p'     # pool
-            elif srcadr.startswith("224."):
+            elif srcadr and srcadr.startswith("224."):
                 ptype = 'a'     # manycastclient (compatibility with Classic)
             elif ntscookies > -1:
                 # FIXME: Will foo up if there are ever more than 9 cookies
```

If only I'd seen this back before 000dfdcef (and its fallout)


More information about the devel mailing list