Bugzilla – Bug 235
Skip dname compression for replies with no answers.
Last modified: 2009-02-19 12:26:26 CET
Created attachment 100 [details]
This is trivial patch, but we shouldn't waste precious CPUTIME ;)
But you still may compress dnames in the authoritative or additional section (in case of YXDOMAIN for example).
Well, I thought that I'd probably miss some RCODEs... To be honest I never encountered YXDOMAIN before, so I didn't even think about this case.
Anyway, fast grep through source code shows that those RCODEs are used:
- OK - with answers,
- FORMAT - no answers,
- SERVFAIL - no answers,
- NXDOMAIN - with answers,
- IMPL - no answers,
- REFUSE - no answers,
- YXDOMAIN - with answers(?).
Please correct me if I'm wrong...
--- query.c (revision 2858)
+++ query.c (working copy)
@@ -1171,6 +1171,11 @@
answer_lookup_zone(nsd, q, &answer, 0, exact, closest_match,
+ /* We can't use !AA(q->packet) because of queries with class ANY */
+ if (RCODE(q->packet) != RCODE_OK && RCODE(q->packet) != RCODE_NXDOMAIN
+ && RCODE(q->packet) != RCODE_YXDOMAIN)
offset = dname_label_offsets(q->qname)[domain_dname(closest_encloser)->label_count - 1] + QHEADERSZ;
query_add_compression_domain(q, closest_encloser, offset);
A whole list can be found here:
or in dns.h ;-).
Anyway, I prefer to assure that no dnames (except the QDNAME) in the response in order to skip dname compression.
+ if (ANCOUNT(q->packet) + NSCOUNT(q->packet) + ARCOUNT(q->packet) == 0)
Thanks for the patch. I have made changes according to my last comment. Hope this will satisfy you enough:)
Your patch is even better, thanks!