]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Added +unexpected option so dig will print replies from unexpected
authorDiego dos Santos Fronza <diego@isc.org>
Thu, 25 Jul 2019 14:35:36 +0000 (11:35 -0300)
committerDiego dos Santos Fronza <diego@isc.org>
Tue, 3 Sep 2019 13:14:15 +0000 (10:14 -0300)
sources.

bin/dig/dig.c
bin/dig/dighost.c
bin/dig/include/dig/dig.h

index 51b52b6ba6b56a9075a1dddb010fcca2e25ca793..d28bdb264e448858f38231686efcd19ec6f05b8f 100644 (file)
@@ -235,6 +235,8 @@ help(void) {
 "                 +tries=###          (Set number of UDP attempts) [3]\n"
 "                 +[no]ttlid          (Control display of ttls in records)\n"
 "                 +[no]ttlunits       (Display TTLs in human-readable units)\n"
+"                 +[no]unexpected     (Print replies from unexpected sources\n"
+"                                      default=off)\n"
 "                 +[no]unknownformat  (Print RDATA in RFC 3597 \"unknown\" "
                                        "format)\n"
 "                 +[no]vc             (TCP mode (+[no]tcp))\n"
@@ -1667,8 +1669,25 @@ plus_option(char *option, bool is_batchfile,
                }
                break;
        case 'u':
-               FULLCHECK("unknownformat");
-               lookup->print_unknown_format = state;
+               switch (cmd[1]) {
+               case 'n':
+                       switch (cmd[2]) {
+                       case 'e':
+                               FULLCHECK("unexpected");
+                               lookup->accept_reply_unexpected_src = true;
+                               break;
+                       case 'k':
+                               FULLCHECK("unknownformat");
+                               lookup->print_unknown_format = state;
+                               break;
+                       default:
+                               goto invalid_option;
+                       }
+                       break;
+               default:
+                       goto invalid_option;
+               }
+
                break;
        case 'v':
                FULLCHECK("vc");
index 619bc0f9db3152b2cb5f3c087328fbecff8a60c6..c273c497dc5f00a1d4a588097be0fe9250af4287 100644 (file)
@@ -3602,7 +3602,9 @@ recv_done(isc_task_t *task, isc_event_t *event) {
                        sizeof(buf2));
                        printf(";; reply from unexpected source: %s,"
                        " expected %s\n", buf1, buf2);
-                       match = false;
+                       if (!l->accept_reply_unexpected_src) {
+                               match = false;
+                       }
                }
        }
 
index 35f1f30c8fcea8fcd87b77860fdb9fd69d256ff6..9a4689951ef1bdd1928b77020d4cf9c37152c4d9 100644 (file)
@@ -141,7 +141,9 @@ struct dig_lookup {
                idnin,
                idnout,
                expandaaaa,
-               qr;
+               qr,
+               accept_reply_unexpected_src;  /*%  print replies from unexpected 
+                                                  sources. */
        char textname[MXNAME]; /*% Name we're going to be looking up */
        char cmdline[MXNAME];
        dns_rdatatype_t rdtype;