blob: 66a41f6107eb8c15a755bbc013eeb2eeba02c765 [file] [log] [blame]
Jesse Glickfd372272014-02-04 20:20:35 +00001From: Jesse Glick <jglick@cloudbees.com>
2To: dnsmasq-discuss@lists.thekelleys.org.uk
3Subject: Re: [Dnsmasq-discuss] Ability to delegate to one server but fall
4 back to another after NXDOMAIN?
5
6
7On Wed, Jan 15, 2014 at 12:30 PM, Simon Kelley <simon@thekelleys.org.uk> wrote:
8> > There's a (very old) patch in contrib/try-all-ns that would make a starting point
9This does not apply against trunk, so I tried to rework it. The
10following appears to do what I expect:
11
12diff --git a/src/forward.c b/src/forward.c
13index 8167229..76070b5 100644
14--- a/src/forward.c
15+++ b/src/forward.c
16@@ -610,7 +610,11 @@ void reply_query(int fd, int family, time_t now)
17
18 if ((RCODE(header) == SERVFAIL || RCODE(header) == REFUSED) &&
19 !option_bool(OPT_ORDER) &&
20- forward->forwardall == 0)
21+ forward->forwardall == 0 ||
22+ /* try each in turn */
23+ RCODE(header) == NXDOMAIN &&
24+ option_bool(OPT_ORDER) &&
25+ server->next != NULL)
26 /* for broken servers, attempt to send to another one. */
27 {
28 unsigned char *pheader;
29