1034 Resolver Algo Question
Kevin Darcy
kcd at daimlerchrysler.com
Thu Aug 19 02:42:21 UTC 2004
William Stacey wrote:
>Trying to do some pseudocode to get my head around resolver process better.
>Is this close or could you please change or add to fix? TIA.
>
>///
>/// 5.3.3 Algorithm Pseudocode
>///
>Step1:
> reply = IsLocal(question);
> if ( reply != null )
> return reply;
>
>Step2:
> slist = FindBestServers(question)
>
>Step3:
> reply = slist.Ask(question)
>
>Step4:
> if ( reply.Header.RCode == RCode.NoError )
> {
> if ( reply.AnswerSection.Count > 0 )
> {
> if ( answersection answers the question ? ) // 4a.
> {
> CacheReply(reply);
> return reply;
> }
> if ( answer is CNAME ? ) // 4c.
> {
> CacheCName(reply);
> question.SName = GetCName(reply);
> goto Step1;
> }
> }
> if ( reply.AuthoritySection.Count > 0 ) // 4b.
> {
> CacheNS(reply);
> goto Step2;
> }
> else
> // nxrrset ? - noerror + noAnswers + noDelegations
> Error("bad reply"); // Not sure this is needed or what to do
>here.
> }
> else if ( nxdomain ) // Part of 4a.
> {
> CacheNX(reply);
> return reply;
> }
> else // 4d.
> {
> slist.RemoveCurrentServer();
> goto Step3;
> }
>/// Done
>
4b specifies that the response "contains a *better* delegation to other
nameservers" (emphasis added). This referral needs to be analyzed before
it is used. Only a "down" referral is useful. If it is "up" or
"sideways", then it should be considered "bizarre contents", as in Step 4d.
The only other thing that comes to mind is that RFC 1034 didn't really
specify negative caching in any detail. In order to round out your
understanding of the resolver algorithm as implemented today, I'd
recommend reading RFC 2308 thoroughly. A NOERROR response with empty
Answer and Authority sections, for instance (which you question in your
pseudocode), is actually a valid (although not recommended) "type 3
NODATA" response, as categorized by RFC 2308, and should not trigger an
error.
- Kevin
More information about the bind-users
mailing list