]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3167. [bug] Negative answers from forwarders were not being
authorMark Andrews <marka@isc.org>
Wed, 12 Oct 2011 00:18:11 +0000 (00:18 +0000)
committerMark Andrews <marka@isc.org>
Wed, 12 Oct 2011 00:18:11 +0000 (00:18 +0000)
                        correctly tagged making them appear to not be cached.
                        [RT #25380]

CHANGES
bin/tests/system/forward/ns5/named.conf [new file with mode: 0644]
bin/tests/system/forward/ns5/root.db [new file with mode: 0644]
bin/tests/system/forward/tests.sh
lib/dns/resolver.c

diff --git a/CHANGES b/CHANGES
index 21956e69ab67f236857155da1b0dffc6c30bc319..cdf72adaf9136e840c3d64d0967d093268faf166 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+3167.  [bug]           Negative answers from forwarders were not being
+                       correctly tagged making them appear to not be cached.
+                       [RT #25380]
+
 3166.  [bug]           Upgrading a zone to support inline-signing failed.
                        [RT #26014]
 
diff --git a/bin/tests/system/forward/ns5/named.conf b/bin/tests/system/forward/ns5/named.conf
new file mode 100644 (file)
index 0000000..90f5609
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2004, 2007  Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 2001  Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: named.conf,v 1.2 2011/10/12 00:18:11 marka Exp $ */
+
+controls { /* empty */ };
+
+options {
+       query-source address 10.53.0.5;
+       notify-source 10.53.0.5;
+       transfer-source 10.53.0.5;
+       port 5300;
+       pid-file "named.pid";
+       listen-on { 10.53.0.5; };
+       listen-on-v6 { none; };
+       forward only;
+       forwarders { 10.53.0.4; };
+};
+
+zone "." {
+       type hint;
+       file "root.db";
+};
diff --git a/bin/tests/system/forward/ns5/root.db b/bin/tests/system/forward/ns5/root.db
new file mode 100644 (file)
index 0000000..8a60eab
--- /dev/null
@@ -0,0 +1,36 @@
+; Copyright (C) 2004, 2007  Internet Systems Consortium, Inc. ("ISC")
+; Copyright (C) 2000, 2001  Internet Software Consortium.
+;
+; Permission to use, copy, modify, and/or distribute this software for any
+; purpose with or without fee is hereby granted, provided that the above
+; copyright notice and this permission notice appear in all copies.
+;
+; THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+; AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+; PERFORMANCE OF THIS SOFTWARE.
+
+; $Id: root.db,v 1.2 2011/10/12 00:18:11 marka Exp $
+
+$TTL 300
+.                      IN SOA  gson.nominum.com. a.root.servers.nil. (
+                               2000042100      ; serial
+                               600             ; refresh
+                               600             ; retry
+                               1200            ; expire
+                               600             ; minimum
+                               )
+.                      NS      a.root-servers.nil.
+a.root-servers.nil.    A       10.53.0.1
+
+example1               NS      ns.example1
+ns.example1            A       10.53.0.1
+
+example2               NS      ns.example2
+ns.example2            A       10.53.0.1
+
+example3               NS      ns.example3
+ns.example3            A       10.53.0.1
index c3c0bf30aaaf2acb67846e785117f2beae0f8c67..2c47971f1ffa2b00d9a020251805983ce1cd116f 100644 (file)
@@ -13,7 +13,7 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: tests.sh,v 1.7 2007/06/19 23:47:03 tbox Exp $
+# $Id: tests.sh,v 1.8 2011/10/12 00:18:11 marka Exp $
 
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
@@ -88,5 +88,18 @@ grep "SERVFAIL" dig.out.f2 > /dev/null || ret=1
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
+echo "I:checking for negative caching of forwarder response"
+# prime the cache, shutdown the forwarder then check that we can
+# get the answer from the cache.  restart forwarder.
+ret=0
+$DIG nonexist. txt @10.53.0.5 -p 5300 > dig.out.f2 || ret=1
+grep "status: NXDOMAIN" dig.out.f2 > /dev/null || ret=1
+$PERL ../stop.pl . ns4 || ret=1
+$DIG nonexist. txt @10.53.0.5 -p 5300 > dig.out.f2 || ret=1
+grep "status: NXDOMAIN" dig.out.f2 > /dev/null || ret=1
+$PERL ../start.pl --restart --noclean . ns4 || ret=1
+if [ $ret != 0 ]; then echo "I:failed"; fi
+status=`expr $status + $ret`
+
 echo "I:exit status: $status"
 exit $status
index 077f02ef5bfb6870c74352114fd44d5680b29d32..af73e22336b55086efa43ee6ad88dccf97493b73 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: resolver.c,v 1.434 2011/06/08 22:13:50 each Exp $ */
+/* $Id: resolver.c,v 1.435 2011/10/12 00:18:11 marka Exp $ */
 
 /*! \file */
 
@@ -5418,6 +5418,9 @@ noanswer_response(fetchctx_t *fctx, dns_name_t *oqname,
                                        if (aa)
                                                rdataset->trust =
                                                    dns_trust_authauthority;
+                                       else if (ISFORWARDER(fctx->addrinfo))
+                                               rdataset->trust =
+                                                       dns_trust_answer;
                                        else
                                                rdataset->trust =
                                                        dns_trust_additional;
@@ -5471,6 +5474,9 @@ noanswer_response(fetchctx_t *fctx, dns_name_t *oqname,
                                        if (aa)
                                                rdataset->trust =
                                                    dns_trust_authauthority;
+                                       else if (ISFORWARDER(fctx->addrinfo))
+                                               rdataset->trust =
+                                                       dns_trust_answer;
                                        else
                                                rdataset->trust =
                                                        dns_trust_additional;
@@ -5512,6 +5518,9 @@ noanswer_response(fetchctx_t *fctx, dns_name_t *oqname,
                                        if (aa)
                                                rdataset->trust =
                                                    dns_trust_authauthority;
+                                       else if (ISFORWARDER(fctx->addrinfo))
+                                               rdataset->trust =
+                                                       dns_trust_answer;
                                        else
                                                rdataset->trust =
                                                        dns_trust_additional;