Re: merge-similar-outgoing-queries.patch and lame servers
Jeff King <[email protected]>
| Newsgroups | gmane.network.djbdns |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Mar 04, 2009 at 07:25:25AM -0500, Jeff King wrote:
> However, it has one failing: the zeroing of the lame server happens
> through the dns_transmit object's server list, which is in turn a
> pointer to the server list passed in by the first querier. Which means
> that if N queries are sharing one dns_transmit object, only the first
> will correctly have the lame server erased from its possibilities. The
> other ones will see the lame response, and then on retrying use the lame
> server again, eventually sending one packet per query.
BTW, it is tempting to do something like this to fix it:
diff --git a/query.c b/query.c
index 9bb9550..cbe310f 100644
--- a/query.c
+++ b/query.c
@@ -513,7 +513,7 @@ static int doit(struct query *z,int state)
if (!flagcname && !rcode && !flagout && flagreferral && !flagsoa)
if (dns_domain_equal(referral,control) || !dns_domain_suffix(referral,control)) {
log_lame(whichserver,control,referral);
- byte_zero(whichserver,4);
+ byte_zero(z->servers[z->level] + 4 * z->qm->dt.curserver);
qmerge_lame(z->qm);
goto HAVENS;
}
but that is not quite right; we don't know that each query actually had
the same list of servers.
This highlights a failing of the qmerge patch, which might mean it is
better to scrap it and restart.
It sits between the query and dns_transmit levels, and it merges queries
which match in qid, query, and control. But it doesn't look at the
servers list, and dns_transmit tries each in turn. I did it this way to
try to make a minimally invasive change, and because I didn't realize
that the dns_transmit parameters were being munged after the fact (as in
the zero-ing of the servers list).
So another possibility is to abstract the udp send/response loop _below_
dns_transmit, and merge outgoing queries going to the same IP (and with
the same qtype and query, of course). I didn't want to do it that way
because dns_transmit is not just part of dnscache, so it would be
affecting other programs, as well (and it would require more surgery on
dns_transmit.c than I needed to do on query.c).
I can try to take a look at doing it that way, but it may be a few days.
-Peff