1
0

0009-Revert-68f6312d4bae30b78daafcd6f51dc441b8685b1e.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From 122392e0b352507cabb9e982208d35d2e56902e0 Mon Sep 17 00:00:00 2001
  2. From: Simon Kelley <simon@thekelleys.org.uk>
  3. Date: Wed, 31 Oct 2018 22:24:02 +0000
  4. Subject: [PATCH 09/32] Revert 68f6312d4bae30b78daafcd6f51dc441b8685b1e
  5. The above is intended to increase robustness, but actually does the
  6. opposite. The problem is that by ignoring SERVFAIL messages and hoping
  7. for a better answer from another of the servers we've forwarded to,
  8. we become vulnerable in the case that one or more of the configured
  9. servers is down or not responding.
  10. Consider the case that a domain is indeed BOGUS, and we've send the
  11. query to n servers. With 68f6312d4bae30b78daafcd6f51dc441b8685b1e
  12. we ignore the first n-1 SERVFAIL replies, and only return the
  13. final n'th answer to the client. Now, if one of the servers we are
  14. forwarding to is down, then we won't get all n replies, and the
  15. client will never get an answer! This is a far more likely scenario
  16. than a temporary SERVFAIL from only one of a set of notionally identical
  17. servers, so, on the ground of robustness, we have to believe
  18. any SERVFAIL answers we get, and return them to the client.
  19. The client could be using the same recursive servers we are,
  20. so it should, in theory, retry on SERVFAIL anyway.
  21. Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
  22. ---
  23. src/forward.c | 3 +--
  24. 1 file changed, 1 insertion(+), 2 deletions(-)
  25. --- a/src/forward.c
  26. +++ b/src/forward.c
  27. @@ -957,8 +957,7 @@ void reply_query(int fd, int family, tim
  28. we get a good reply from another server. Kill it when we've
  29. had replies from all to avoid filling the forwarding table when
  30. everything is broken */
  31. - if (forward->forwardall == 0 || --forward->forwardall == 1 ||
  32. - (RCODE(header) != REFUSED && RCODE(header) != SERVFAIL))
  33. + if (forward->forwardall == 0 || --forward->forwardall == 1 || RCODE(header) != REFUSED)
  34. {
  35. int check_rebind = 0, no_cache_dnssec = 0, cache_secure = 0, bogusanswer = 0;