]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
move provide-ixfr testing after the serial has been checked
authorMark Andrews <marka@isc.org>
Mon, 30 Mar 2020 03:21:48 +0000 (14:21 +1100)
committerMark Andrews <marka@isc.org>
Fri, 15 May 2020 04:29:12 +0000 (14:29 +1000)
(cherry picked from commit c7cdc47cc5ff64bef5a6ed53824206d524ea78ec)

bin/tests/system/ixfr/ns3/mytest2.db
bin/tests/system/ixfr/tests.sh
lib/ns/xfrout.c

index 080f3358b10c3369b50463efcd64cf568eabe4fb..6ea7cf94660742c64d724f4e53afdd0e995ed4d0 100644 (file)
@@ -10,7 +10,7 @@
 $ORIGIN test.
 $TTL    15
 test.  15  IN        SOA ns1.test.  hostmaster.test. (
-                              4 ; serial
+                              3 ; serial
                               3H ; refresh
                               15 ; retry
                               1w ; expire
index c07251d4d0aa74ea62ccf7d24e9e40e1aa313e37..39c4afd8a6637f4e6a3625d3ae62a973dab57fa2 100644 (file)
@@ -310,7 +310,7 @@ $DIG $DIGOPTS +notcp ixfr=1 test @10.53.0.4 > dig.out1.test$n || ret=1
 $DIG $DIGOPTS ixfr=1 +notcp test @10.53.0.4 > dig.out2.test$n || ret=1
 digcomp dig.out1.test$n dig.out2.test$n || ret=1
 awk '$4 == "SOA" { soacnt++} END {if (soacnt == 1) exit(0); else exit(1);}' dig.out1.test$n || ret=1
-awk '$4 == "SOA" { if ($7 == 4) exit(0); else exit(1);}' dig.out1.test$n || ret=1
+awk '$4 == "SOA" { if ($7 == 3) exit(0); else exit(1);}' dig.out1.test$n || ret=1
 # Should be incremental transfer.
 $DIG $DIGOPTS ixfr=1 test @10.53.0.4 > dig.out3.test$n || ret=1
 awk '$4 == "SOA" { soacnt++} END { if (soacnt == 6) exit(0); else exit(1);}' dig.out3.test$n || ret=1
@@ -333,18 +333,43 @@ do
 done
 
 n=$((n+1))
-echo_i "test 'provide-ixfr no;' ($n)"
+echo_i "test 'provide-ixfr no;' (serial < current) ($n)"
 ret=0
+nextpart ns5/named.run > /dev/null
 # Should be "AXFR style" response
 $DIG $DIGOPTS ixfr=1 test @10.53.0.5 > dig.out1.test$n || ret=1
 # Should be "switch to TCP" response
 $DIG $DIGOPTS ixfr=1 +notcp test @10.53.0.5 > dig.out2.test$n || ret=1
 awk '$4 == "SOA" { soacnt++} END {if (soacnt == 2) exit(0); else exit(1);}' dig.out1.test$n || ret=1
 awk '$4 == "SOA" { soacnt++} END {if (soacnt == 1) exit(0); else exit(1);}' dig.out2.test$n || ret=1
-if [ ${ret} != 0 ]; then
-       echo_i "failed"
-       status=1
-fi
+msg="IXFR delta response disabled due to 'provide-ixfr no;' being set"
+nextpart ns5/named.run | grep "$msg" > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
+n=$((n+1))
+echo_i "test 'provide-ixfr no;' (serial = current) ($n)"
+ret=0
+# Should be "AXFR style" response
+$DIG $DIGOPTS ixfr=3 test @10.53.0.5 > dig.out1.test$n || ret=1
+# Should be "switch to TCP" response
+$DIG $DIGOPTS ixfr=3 +notcp test @10.53.0.5 > dig.out2.test$n || ret=1
+awk '$4 == "SOA" { soacnt++} END {if (soacnt == 1) exit(0); else exit(1);}' dig.out1.test$n || ret=1
+awk '$4 == "SOA" { soacnt++} END {if (soacnt == 1) exit(0); else exit(1);}' dig.out2.test$n || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
+n=$((n+1))
+echo_i "test 'provide-ixfr no;' (serial > current) ($n)"
+ret=0
+# Should be "AXFR style" response
+$DIG $DIGOPTS ixfr=4 test @10.53.0.5 > dig.out1.test$n || ret=1
+# Should be "switch to TCP" response
+$DIG $DIGOPTS ixfr=4 +notcp test @10.53.0.5 > dig.out2.test$n || ret=1
+awk '$4 == "SOA" { soacnt++} END {if (soacnt == 1) exit(0); else exit(1);}' dig.out1.test$n || ret=1
+awk '$4 == "SOA" { soacnt++} END {if (soacnt == 1) exit(0); else exit(1);}' dig.out2.test$n || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
 
 n=$((n+1))
 echo_i "checking whether dig calculates IXFR statistics correctly ($n)"
index a92783cf1bb55e78082e7c955a860cfb068c059b..c91e992bceb7963d805c81a543c0b6982c3c5f0f 100644 (file)
@@ -962,23 +962,6 @@ got_soa:
 
        current_serial = dns_soa_getserial(&current_soa_tuple->rdata);
        if (reqtype == dns_rdatatype_ixfr) {
-               /*
-                * Outgoing IXFR may have been disabled for this peer
-                * or globally.
-                */
-               if ((client->attributes & NS_CLIENTATTR_TCP) != 0) {
-                       bool provide_ixfr;
-
-                       provide_ixfr = client->view->provideixfr;
-                       if (peer != NULL) {
-                               (void)dns_peer_getprovideixfr(peer,
-                                                             &provide_ixfr);
-                       }
-                       if (provide_ixfr == false) {
-                               goto axfr_fallback;
-                       }
-               }
-
                if (!have_soa) {
                        FAILC(DNS_R_FORMERR, "IXFR request missing SOA");
                }
@@ -1003,6 +986,29 @@ got_soa:
                        is_poll = true;
                        goto have_stream;
                }
+
+               /*
+                * Outgoing IXFR may have been disabled for this peer
+                * or globally.
+                */
+               if ((client->attributes & NS_CLIENTATTR_TCP) != 0) {
+                       bool provide_ixfr;
+
+                       provide_ixfr = client->view->provideixfr;
+                       if (peer != NULL) {
+                               (void)dns_peer_getprovideixfr(peer,
+                                                             &provide_ixfr);
+                       }
+                       if (!provide_ixfr) {
+                               xfrout_log1(client, question_name,
+                                           question_class, ISC_LOG_DEBUG(4),
+                                           "IXFR delta response disabled due "
+                                           "to 'provide-ixfr no;' being set");
+                               mnemonic = "AXFR-style IXFR";
+                               goto axfr_fallback;
+                       }
+               }
+
                journalfile = is_dlz ? NULL : dns_zone_getjournal(zone);
                if (journalfile != NULL) {
                        result = ixfr_rrstream_create(