1 From a5efddbe9151e9ad99279e59566c86f8bc27d3a9 Mon Sep 17 00:00:00 2001
2 From: George Joseph <gjoseph@digium.com>
3 Date: Wed, 7 Sep 2016 13:10:57 -0600
4 Subject: [PATCH] resolver.c: Prevent SERVFAIL from marking name server bad
6 A name server that returns "Server Failure" is indicating only that
7 the server couldn't process that particular request. We should NOT
8 assume that the name server is incapable of serving other requests.
10 Here's the scenario we've been encountering...
12 * 2 local name servers configured in resolv.conf.
13 * An OPTIONS request causes a request for A and AAAA records to go out
15 * The A responses both come back successfully resolved.
16 * Because of an issue at some upstream nameserver, the AAAA responses
17 for that particular query come back as "SERVFAIL" from both local
19 * Both local servers are marked as bad and no further queries can be
20 sent until the 60 second ttl expires. Only previously cached results
22 * In this case, 60 seconds is just enough time for another OPTIONS
23 request to go out to the same host so the cycle repeats.
25 We could set the bad ttl really low but that also affects REFUSED and
26 NOTAUTH which probably DO signal a real server issue. Besides, even
27 a really low bad ttl would be an issue on a pbx.
29 pjlib-util/src/pjlib-util/resolver.c | 3 +--
30 1 file changed, 1 insertion(+), 2 deletions(-)
32 diff --git a/pjlib-util/src/pjlib-util/resolver.c b/pjlib-util/src/pjlib-util/resolver.c
33 index d277e4f..540f88f 100644
34 --- a/pjlib-util/src/pjlib-util/resolver.c
35 +++ b/pjlib-util/src/pjlib-util/resolver.c
36 @@ -1384,8 +1384,7 @@ static void report_nameserver_status(pj_dns_resolver *resolver,
37 q_id = (pj_uint32_t)-1;
40 - if (!pkt || rcode == PJ_DNS_RCODE_SERVFAIL ||
41 - rcode == PJ_DNS_RCODE_REFUSED ||
42 + if (!pkt || rcode == PJ_DNS_RCODE_REFUSED ||
43 rcode == PJ_DNS_RCODE_NOTAUTH)