dnsmasq: backport patch fixing DNS failover (FS#841)
[openwrt/openwrt.git] / package / network / services / dnsmasq / patches / 020-Try-other-servers-if-first-returns-REFUSED-when-stri.patch
1 From 9396752c115b3ab733fa476b30da73237e12e7ba Mon Sep 17 00:00:00 2001
2 From: Hans Dedecker <dedeckeh@gmail.com>
3 Date: Tue, 27 Jun 2017 22:08:47 +0100
4 Subject: [PATCH] Try other servers if first returns REFUSED when
5 --strict-order active.
6
7 If a DNS server replies REFUSED for a given DNS query in strict order mode
8 no failover to the next DNS server is triggered as the failover logic only
9 covers non strict mode.
10 As a result the client will be returned the REFUSED reply without first
11 falling back to the secondary DNS server(s).
12
13 Make failover support work as well for strict mode config in case REFUSED is
14 replied by deleting the strict order check and rely only on forwardall being
15 equal to 0 which is the case in non strict mode when a single server has been
16 contacted or when strict order mode has been configured.
17 ---
18 CHANGELOG | 4 ++++
19 src/forward.c | 1 -
20 2 files changed, 4 insertions(+), 1 deletion(-)
21
22 --- a/src/forward.c
23 +++ b/src/forward.c
24 @@ -790,7 +790,6 @@ void reply_query(int fd, int family, tim
25 /* Note: if we send extra options in the EDNS0 header, we can't recreate
26 the query from the reply. */
27 if (RCODE(header) == REFUSED &&
28 - !option_bool(OPT_ORDER) &&
29 forward->forwardall == 0 &&
30 !(forward->flags & FREC_HAS_EXTRADATA))
31 /* for broken servers, attempt to send to another one. */