]> 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:30:16 +0000 (00:30 +0000)
committerMark Andrews <marka@isc.org>
Wed, 12 Oct 2011 00:30:16 +0000 (00:30 +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 995405762b9299aaf2731d04c06e765d64887d4e..3df0fdde8ccf04214029ead30d7e22d2f96d6c94 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]
+
 3162.   [test]          start.pl: modified to allow for "named.args" in
                         ns*/ subdirectory to override stock arguments to
                         named. Largely from RT#26044, but no separate ticket.
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..1f366c9
--- /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.6.2 2011/10/12 00:30:15 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..97452b9
--- /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.6.2 2011/10/12 00:30:15 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..546bd46727d0ff2b6e8061c5c3bdfa8c55dda82c 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.7.332.1 2011/10/12 00:30:15 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 96c12ca3c0bb3b5eeac41f690e98458aae0707cf..f12f61b8723832a121d97236b56c1e77e69aa73f 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: resolver.c,v 1.384.14.32 2011/06/09 00:16:36 each Exp $ */
+/* $Id: resolver.c,v 1.384.14.33 2011/10/12 00:30:16 marka Exp $ */
 
 /*! \file */
 
@@ -5326,6 +5326,15 @@ 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 if (ISFORWARDER(fctx->addrinfo))
+                                               rdataset->trust =
+                                                       dns_trust_answer;
+                                       else if (ISFORWARDER(fctx->addrinfo))
+                                               rdataset->trust =
+                                                       dns_trust_answer;
                                        else
                                                rdataset->trust =
                                                        dns_trust_additional;