Jesse Glick | fd37227 | 2014-02-04 20:20:35 +0000 | [diff] [blame] | 1 | From: Jesse Glick <jglick@cloudbees.com> |
| 2 | To: dnsmasq-discuss@lists.thekelleys.org.uk |
| 3 | Subject: Re: [Dnsmasq-discuss] Ability to delegate to one server but fall |
| 4 | back to another after NXDOMAIN? |
| 5 | |
| 6 | |
| 7 | On 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 |
| 9 | This does not apply against trunk, so I tried to rework it. The |
| 10 | following appears to do what I expect: |
| 11 | |
| 12 | diff --git a/src/forward.c b/src/forward.c |
| 13 | index 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 | |