Question about BIND Source Code

Kevin Darcy kcd at daimlerchrysler.com
Wed Jan 17 01:45:56 UTC 2001


As I mentioned in a previous message, when named simply "passes
through" an answer from an authoritative nameserver, it doesn't actually
*construct* Authority and Additional Sections for the response, it just
passes through whatever's already contained in the response it received
from the authoritative server. It's only when it answers from its cache
(i.e. non-authoritatively), including negative cache entries, that it
needs to actually construct Authority and Additional. See generally, the
code for the return_msg versus the return_newmsg goto's, respectively,
in ns_resp().

So, with that in mind, notice that, continuing from line 1142,
findns() is invoked, which fills in the databuf structs of the relevant
nameservers, then a little further along, add_data() takes that list of
databufs and uses it to actually fill in the Authority Section of the
response. The low-level RR constructor called from add_data() --
make_rr() -- has special code to invoke addname() on any record type
that named considers should trigger the inclusion of an RR in the
Additional Section (which of course includes MX and NS records among
others). addname() fills in the "addinfo[]" array to keep track of the
records to be added to the Additional Section, and when ns_req() finally
calls doaddinfo() (see line 384) that routine goes through all of the
records in addinfo[] and constructs RR's for them (again, through
make_rr()).

Clear enough?

Bear in mind of course that if truncation occurs, the Additional Section
can be jetisoned in part or in its entirety. Nothing in the RFC's
*mandates* Additional records, although as a practical matter, there's
no reason *not* to provide glue records in the Additional Section of a
referral (otherwise the resolver is just going to issue one or more
additional queries to the same set of nameservers to get those A
records). Under certain circumstances, even the Authority Section is
optional in a response.


- Kevin

Questions Answers wrote:

> Hello BIND users
>
> I am using BIND 8.2.2 P7 on RH 6.2
>
> I had a question about the lookup logic of BIND for MX
> records.
>
> When an MX record of a domain is queried from an
> Authoritative DNS for the domain, BIND recives a query
> of type T_MX. It retrieves the MX record
> e.g  mail.domain.com
>
> And then it is supposed to look for the A record for
> mail.domain.com , and put it in the ADDITIONAL SECTION
>
> Could someone, please give me a pointer to the place
> where it is done in the source code? I have traced
> uptil the point where AUTHORITY SECTION is filled in
> (src/bin/named/ns_req.c Line 1142).
>
> Thanks much!






More information about the bind-users mailing list