[ntp:questions] Best practice: re-resolve server IP address beforeeach poll/query

Per Hedeland per at hedeland.org
Fri Jun 15 20:43:08 UTC 2007

In article <4671FAA9.6060701 at ntp.isc.org> mayer at ntp.isc.org (Danny
Mayer) writes:
>Per Hedeland wrote:
>> In article <46717A68.5060203 at ntp.isc.org> mayer at ntp.isc.org (Danny
>> Mayer) writes:
>>> James Cloos wrote:
>>>> Wolfgang> DNS refresh and expire are two SOA entities that are meant to be
>>>> Wolfgang> looked at by the secondaries of a domain.
>>>> I'm sure he was thinking of the Time To Live (TTL) values for the
>>>> individual RRs, rather than the values in the SOA.
>>> Those are of course not the ones you need to look at since those have to
>>> do with the zone itself and not the zone records each of which has its
>>> own TTL.
>> I think you misread... "the Time To Live (TTL) values for the individual
>> RRs" are of course prcisely the ones you need to look at.
>That's what I said.

As did the previous poster... - nevermind.

>gethostbyname() only supports IPv4 so it's not acceptable.

It was only an example of using the res_*() functions/macros to get at
the TTL - gethostbyname() is obviously useless in this context anyway,
since it *in general* doesn't give access to the TTL.

> It's been a
>long time since I looked at the res_*() functions since we don't use
>them in BIND 9 even though they are built on Unix platforms if you want it.

Well, it seems the lwres_* stuff has had about zero penetration so far,
at least I can't find any trace of it on standard installs of reasonably
modern FreeBSD and Linux systems - whereas you can expect to find
resolver(3) on all Unix platforms at least, since it has been the only
documented interface to get at anything other than A/AAAA/PTR since
forever. But of course you could at least in principle bundle lwres_*
with the NTP distribution.

>> - that _dns_ttl_ variable is actually externally visible, i.e. available
>> to applications using gethostbyname(), though this is surely not
>> universal. (And it seems FreeBSD's getaddrinfo() implementation is
>> entirely disjunct from gethostby*() - it doesn't provide the TTL at all
>> as far as I can see.)
>That's probably because it was a complete redesign. TTL is usually only
>relevant for nameservers, applications are expected to just make the
>requests and let the resolver worry about that level of detail.

Obviously the FreeBSD developers added that _dns_ttl_ variable because
there was a demand for it - there are several applications besides NTP
that could make use of it, and the demand certainly hasn't gone away
with the introduction of getaddrinfo(). The real question is of course
why the getaddrinfo() designers didn't add a ttl field to that addrinfo
struct (with -1 or whatever meaning "not available"), when they put
everything else anyone would ever need in there.

--Per Hedeland
per at hedeland.org

More information about the questions mailing list