[Dnsmasq-discuss] [PATCH] Retry queries only after giving the upstream server some time to respond

Dominik Derigs dl6er at dl6er.de
Mon Apr 5 15:46:36 UTC 2021


Hey all,

I've seeing a notable increase in upstream traffic with the current
dnsmasq release candidate. Some investigations have revealed that the
reason for this is the modified forwarding philosophy that *always*
triggers a retry whenever a query is received before the upstream was
able to answer (which may take long on slow networks).

This patch adds a timeout to stop such forward destination flooding.
Before the timeout is reached, identical queries are just put on the
list form where they will get replied to when the response to the first
forwarded query arrives. The difference added by the patch is that such
queries do not trigger another forwarding within the configured
interval.
If we still received nothing, the next query *after* the timeout is
again forwarded to avoid hanging because the original query got lost.

Th default for this interval is 3 seconds, it can be changed using a
setting and even be disabled (by setting to zero) which restores the
behavior we have right now. The default of 3 seconds has been chosen
such that we will retry when other software considers this a good idea
(retry timeout is 5 seconds in Linux, see RES_TIMEOUT in <resolv.h>).

I confirmed the intended effect in my local tests: Reduced unnecessary
forwarding traffic without the danger of failing when the first query
is lost (or whatever).

Let me know if you need something more/else. It should be easy to
review this one.

Best,
Dominik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Retry-queries-only-after-giving-the-upstream-server-.patch
Type: text/x-patch
Size: 6316 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20210405/0709d0a7/attachment-0001.bin>


More information about the Dnsmasq-discuss mailing list