Omitting out-of-control additional records from responses?

Matthew Dempsky <[email protected]>
Newsgroups gmane.network.djbdns
Message-ID <[email protected]>
Right now when searching for records to include in the additional
records section of a response, tinydns includes any records that it
knows about.  But can anyone suggest a realistic scenarios where this
is useful, rather than only including records within the "control"
(i.e., nearest parent name with SOA/NS records)?

E.g., right now if you query "dnsq a shinobi.dempsky.org
ns1.everydns.net", ns1.everydns.net includes glue records for
ns[1-4].everydns.net.  Theoretically DNS caches could recognize that
ns1.everydns.net is authoritative for everydns.net, but in practice I
don't know of any that do.  As such, it seems like a waste of
bandwidth and CPU cycles to include these records.  (On the other
hand, checking this is potentially a waste of CPU cycles for zones
that only use in-bailiwick names.)

The (proof-of-concept) patch below omits out-of-control records from
the additional records section in authoritative responses.  I think
the test for flagauthoritative could be removed without harm, but I
can imagine legitimate use cases where non-authoritative responses
include out-of-control records that are still within the bailiwick of
the client.  (E.g., if example.com were to delegate sub.example.com to
sub-ns.example.com.)

Any thoughts?

--- tdlookup.c.orig	2009-09-21 17:28:19.000000000 -0700
+++ tdlookup.c	2009-09-21 17:47:22.000000000 -0700
@@ -249,6 +249,8 @@
       }
       else
         if (!dns_packet_getname(response,arpos,bpos + 2,&d1)) return 0;
+      if (flagauthoritative && !dns_domain_suffix(d1,control))
+        continue;
       case_lowerb(d1,dns_domain_length(d1));
       if (want(d1,DNS_T_A)) {
 	cdb_findstart(&c);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.