Re: Possible Cool idea...

Alexander Dupuy (dupuy@smarts.com)
Mon, 2 May 1994 11:44:20 +0500

Date: Mon, 2 May 1994 11:44:20 +0500
From: dupuy@smarts.com (Alexander Dupuy)
Message-Id: <9405021544.AA29920@brainy.smarts.com>
To: uri@bunyip.com, martin@mrrl.lut.ac.uk
Subject: Re: Possible Cool idea...

> We can combine gethostbyname() with a TXT lookup by calling
> res_mkquery() with type T_ANY instead of T_TXT. The result should be
> all of the records associated with the domain name - i.e. the union of
> gethostbyname and a TXT lookup. This hardly increases the network
> traffic at all, and the code to implement it is trivial.

You have to be careful when doing this. If you specify a query type of T_ANY,
any cached records will match and be returned, even if the cached records are
not complete. This means, for example, that if the only recent query for
some.do.main was of type T_MX, and the MX records are still in the cache, a
T_ANY query for some.do.main will return the MX records, and nothing else.

This is an unfortunate design flaw in DNS, and the only ways to prevent it are
to disable DNS caching for the T_ANY query by requiring an authoritative
answer (AA bit) or to make an explicit query for each record type you want (in
this case, T_TXT and T_A).

However, in the general case (and this is especially true if the queries are
for some.do.main.urn.int, for which presumably nobody does T_MX queries), a
T_ANY record will return both A and TXT records. In this case, using TXT
records has a real advantage over a separate "probe" or "selector" port, in
that all the information can be obtained in a single DNS lookup. If the DNS
lookup fails to locate any A or TXT records, it should retry with specific
queries for each record type; but this code would not be executed in the
majority of cases.

@alex