]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Added documentation for dig's +unexpected command line option.
authorDiego dos Santos Fronza <diego@isc.org>
Thu, 1 Aug 2019 15:16:10 +0000 (12:16 -0300)
committerDiego dos Santos Fronza <diego@isc.org>
Tue, 3 Sep 2019 13:15:25 +0000 (10:15 -0300)
CHANGES
bin/dig/dig.c
bin/dig/dig.docbook
bin/dig/dighost.c
bin/tests/system/digdelv/ans6/ans.pl [changed mode: 0644->0755]
bin/tests/system/digdelv/tests.sh
doc/arm/notes.xml

diff --git a/CHANGES b/CHANGES
index c085f85a3ff145a9add276d4959fddc7fec3ffcf..2aca18860c1773af8779ba5048049e0fd115d1b1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+5284.  [func]          Added +unexpected command line option to dig. 
+                        By default, dig won't accept a reply from a source
+                        other than the one to which it sent the query.
+                        Invoking dig with +unexpected argument will allow it
+                        to process replies from unexpected sources.
+
 5283.  [bug]           When a response-policy zone expires, ensure that
                        its policies are removed from the RPZ summary
                        database. [GL #1146]
index d28bdb264e448858f38231686efcd19ec6f05b8f..d4dca378e6d4e113373bedfff5108ba85cecd06c 100644 (file)
@@ -1674,7 +1674,7 @@ plus_option(char *option, bool is_batchfile,
                        switch (cmd[2]) {
                        case 'e':
                                FULLCHECK("unexpected");
-                               lookup->accept_reply_unexpected_src = true;
+                               lookup->accept_reply_unexpected_src = state;
                                break;
                        case 'k':
                                FULLCHECK("unknownformat");
index 86125c6040a4ae2923130e148b19c6d4e8b24eed..7658128f6c3ff354884647ce160491d4489f388a 100644 (file)
          </listitem>
        </varlistentry>
 
+       <varlistentry>
+         <term><option>+[no]unexpected</option></term>
+         <listitem>
+           <para>
+             Accept [do not accept] answers from unexpected sources.  By
+             default, <command>dig</command> won't accept a reply from a
+             source other than the one to which it sent the query.
+           </para>
+         </listitem>
+       </varlistentry>
+
        <varlistentry>
          <term><option>+[no]unknownformat</option></term>
          <listitem>
index c273c497dc5f00a1d4a588097be0fe9250af4287..06169db44dd964cc7094ef4a2bf17966eb3a1533 100644 (file)
@@ -621,6 +621,7 @@ make_empty_lookup(void) {
        looknew->ttlunits = false;
        looknew->expandaaaa = false;
        looknew->qr = false;
+       looknew->accept_reply_unexpected_src = false;
 #ifdef HAVE_LIBIDN2
        looknew->idnin = isatty(1)?(getenv("IDN_DISABLE") == NULL):false;
        looknew->idnout = looknew->idnin;
@@ -766,6 +767,8 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
        looknew->ttlunits = lookold->ttlunits;
        looknew->expandaaaa = lookold->expandaaaa;
        looknew->qr = lookold->qr;
+       looknew->accept_reply_unexpected_src =
+               lookold->accept_reply_unexpected_src;
        looknew->idnin = lookold->idnin;
        looknew->idnout = lookold->idnout;
        looknew->udpsize = lookold->udpsize;
old mode 100644 (file)
new mode 100755 (executable)
index 90f9073..793f796
@@ -67,7 +67,7 @@ for (;;) {
                 my $sendsock =
                         IO::Socket::INET->new(LocalAddr => "10.53.1.2",
                                               PeerAddr => $sock->peerhost,
-                                              PeerPort => "5300",
+                                              PeerPort => $sock->peerport,
                                               Proto => "udp") or die "$!";
                 print "**** response from ", $sendsock->sockhost, " to " ,
                       $sendsock->peerhost, " port ", $sendsock->peerport, "\n";
index f87ece25982982a79f6bc1209387a841e3e25900..d67a50cd86a8669f8f341f0d9ab9f0d4b8808102 100644 (file)
@@ -68,6 +68,7 @@ if [ -n "$PYTHON" ] ; then
 fi
 
 if [ -x "$DIG" ] ; then
+
   n=$((n+1))
   echo_i "checking dig short form works ($n)"
   ret=0
@@ -723,6 +724,7 @@ if [ -x "$DIG" ] ; then
   status=$((status+ret))
 
   n=$((n+1))
+
   echo_i "check that dig +short +expandaaaa works ($n)"
   ret=0
   dig_with_opts @10.53.0.3 +short +expandaaaa AAAA ns2.example > dig.out.test$n 2>&1 || ret=1
@@ -744,6 +746,33 @@ if [ -x "$DIG" ] ; then
     if [ $ret -ne 0 ]; then echo_i "failed"; fi
     status=$((status+ret))
   fi
+
+  echo_i "check that dig +unexpected works ($n)"
+  ret=0
+  dig_with_opts @10.53.0.6 +unexpected a a.example > dig.out.test$n || ret=1
+  grep 'reply from unexpected source' dig.out.test$n > /dev/null || ret=1
+  grep 'status: NOERROR' dig.out.test$n > /dev/null || ret=1
+  if [ $ret -ne 0 ]; then echo_i "failed"; fi
+  status=$((status+ret))
+
+  n=$((n+1))
+  echo_i "check that dig +nounexpected works ($n)"
+  ret=0
+  dig_with_opts @10.53.0.6 +nounexpected +tries=1 +time=2 a a.example > dig.out.test$n && ret=1
+  grep 'reply from unexpected source' dig.out.test$n > /dev/null || ret=1
+  grep "status: NOERROR" < dig.out.test$n > /dev/null && ret=1
+  if [ $ret -ne 0 ]; then echo_i "failed"; fi
+  status=$((status+ret))
+
+  n=$((n+1))
+  echo_i "check that dig default for +[no]unexpected (+nounexpected) works ($n)"
+  ret=0
+  dig_with_opts @10.53.0.6 +tries=1 +time=2 a a.example > dig.out.test$n && ret=1
+  grep 'reply from unexpected source' dig.out.test$n > /dev/null || ret=1
+  grep "status: NOERROR" < dig.out.test$n > /dev/null && ret=1
+  if [ $ret -ne 0 ]; then echo_i "failed"; fi
+  status=$((status+ret))
+
 else
   echo_i "$DIG is needed, so skipping these dig tests"
 fi
index 62e8a4e2a3e98c05ae2f78e05b72c1007ac930a5..5796058a60fe2f840d5e291c63de92be1bec437b 100644 (file)
 
   <section xml:id="relnotes_features"><info><title>New Features</title></info>
     <itemizedlist>
+      <listitem>
+       <para>
+          Added a new command line option to <command>dig</command>:
+         <comand>+[no]unexpected</comand>. By default, <command>dig</command>
+         won't accept a reply from a source other than the one to which
+         it sent the query.  Add the <command>+unexpected</command> argument
+         to enable it to process replies from unexpected sources.
+        </para>
+      </listitem>
       <listitem>
        <para>
          The GeoIP2 API from MaxMind is now supported. Geolocation support