[dns-operations] Who Ignores TTLs ?

Wessels, Duane dwessels at verisign.com
Thu Feb 17 19:02:33 UTC 2011


On Feb 17, 2011, at 9:31 AM, Rick Jones wrote:

> Mark Andrews wrote:
>> It's the apps not the caches that don't respect TTLs.
> 
> Well, they can't really.  Certainly not directly.  Getaddrinfo() (or gethostbyname()) don't give TTL information to the application.  The only way they could "respect" the TTLs would be to make a getaddrinfo() call before every connection, no matter how short-lived, in which case the complaint would be applications making too many DNS queries and every end point in the Internet should run their queries through a system local cache.


Squid suffered from this problem many years ago when it was using
gethostbyname() and we came up with a simple hack which survives
to this day in FreeBSD.  src/lib/libc/net/gethostbydns.c defines a
global integer named _dns_ttl_ and sets it for responses to A queries.
The application then copies _dns_ttl_ immediately after gethostbyname()
returns.

Unfortunately looks like the hack doesn't exist for getaddrinfo() and
perhaps this trick is not thread-safe.

DW


More information about the dns-operations mailing list