Tangle with -4 and -6

Hal Murray halmurray at sonic.net
Mon Sep 18 05:36:08 UTC 2023

-4 and -6 work on the server line in ntp.conf but are not documented

-4/ipv4 and -6/ipv6 "work" on the command line, but they don't do what the 
documentation says.  The man page says:
           Force DNS resolution of following host names on the command line to
           the IPv4 namespace.
What they do is turn off setting up sockets for the other protocol.

I'm not sure what the NTS server does if, say, the system doesn't support IPv6 
when it tries to listen on an IPv6 address.


The network side sets up two flags: ipv4_works and ipv6_works
The command line -4 and -6 flags turn off the other _works flag.

I wrote the DNS code for both server/pool and NTS.  I don't remember how the 
-4/-6 options work (and a quick look didn't refresh my memory).  I don't 
remember ever checking the above flags or thinking about doing it.

Note that there are 2 DNS lookups on the NTS path, one for the NTS-KE server 
and another if the server returns a name/address rather than using the default 
of the same address as was used for the NTS-KE lookup.

I'm pretty sure the command line processing doesn't do any DNS lookups.
It roughly adds a server line, and does a DNS lookup with the constant-only 
(no net traffic) flag so that slot won't get delayed behing a real DNS lookup 
that is skow.


I think we should clean up this area.  That includes:

Making sure DNS lookups don't use an address for a disabled protocol.

Add enable/disable -4/ipv4 -6/ipv6 to ntp.conf
Note that these will have a backwards meaning from the -4 on the command line.
  -4 on the command line <=> disable -6

Does this make sense?
Am I missing anything?

This will take a lot of testing.


We should move the command line code in config_peers to that checks for a 
numeric address to the main processing loop.

These are my opinions.  I hate spam.

More information about the devel mailing list