Subject: Re: Adding TTL information to gethostbyname() and friends
To: NetBSD Networking Technical Discussion List <tech-net@NetBSD.ORG>
From: Ian Lance Taylor <ian@airs.com>
List: tech-net
Date: 06/02/2003 15:19:38
"Greg A. Woods" <woods@weird.com> writes:

> Yuck.  What a horrible situation.  Clue-by-4 the browser authors.
> 
> DNS cache should always be "local" to the application -- i.e. within
> reach by a very minimal RTT.
> 
> If you're talking about doing this only in NetBSD (and maybe the other
> *BSDs) then the correct fix is always to eliminate all application
> specific DNS caching in pkgsrc hacks and instead to simply turn on a
> local DNS cache server by default.
> 
> If you're talking about proposing a fix that could generically work for
> everyone then the correct fix is to implement a portable in-core-only
> cache that can be placed invisibly in libbind/libresolv/libc/whatever
> behind gethostbyname() and friends and still convince all application
> authors to eliminate all DNS caching from their applications.
> 
> It is never "right" for an application to cache DNS information and thus
> it is never "right" for an application to need the DNS TTL values.

I dunno, I've never been all that good on arguments about "right" when
we're talking about existing code.

The approach you suggest sounds like a certain amount of overhead for
applications which don't need it.  More importantly, it is rather
unlikely to be implemented everywhere (remembering that many browsers
are highly portable, to Windows and MacOS, etc.).  It is therefore
rather unlikely to solve the problem everywhere, and so it is unlikely
to convince browsers to stop caching DNS information.

If an application has DNS TTL information, I personally don't see any
reason why it is not "right" for that application to cache it.  For
example, I can't see any reason why an application should not cache
the results of a call to getrrsetname().  Perhaps this does not meet
some abstract purity test.

In any case, today's gritty reality requires browsers to cache DNS
information.  I don't personally see any problem with having them
continue to do so.  If it is to be stopped, there needs to be some
incremental plan to get us from here to there.

Ian