Commit 9396752c115b3ab733fa476b30da73237e12e7ba added support for dns query retransmission in case a server returns refused in strict-order mode. The patch did not cover the case when all servers return refused triggering a dns query retransmission storm resulting into a high cpu load by dnsmasq. Fix the problem by checking in strict-order mode if a next dns server is available in the dns server list before forwarding the query again.
Signed-off-by: Hans Dedecker <dedec...@gmail.com> --- src/forward.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/forward.c b/src/forward.c index 4824759..3d58571 100644 --- a/src/forward.c +++ b/src/forward.c @@ -799,11 +799,23 @@ void reply_query(int fd, int family, time_t now) { unsigned char *pheader; size_t plen; - int is_sign; - + int is_sign, fwd_query = 0; + + if (option_bool(OPT_ORDER)) + { + /* try to find a good server to which the query can be forwarded */ + for (server = forward->sentto->next; server; server = server->next) + if (!(server->flags & (SERV_LITERAL_ADDRESS | SERV_HAS_DOMAIN | SERV_FOR_NODOTS | SERV_NO_ADDR | SERV_LOOP))) + { + fwd_query = 1; + break; + } + } else + fwd_query = 1; + /* recreate query from reply */ pheader = find_pseudoheader(header, (size_t)n, &plen, NULL, &is_sign, NULL); - if (!is_sign) + if (!is_sign && fwd_query) { header->ancount = htons(0); header->nscount = htons(0); -- 1.9.1 _______________________________________________ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss