diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 51b52b6ba6..d28bdb264e 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -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"); diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 619bc0f9db..c273c497dc 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -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; + } } } diff --git a/bin/dig/include/dig/dig.h b/bin/dig/include/dig/dig.h index 35f1f30c8f..9a4689951e 100644 --- a/bin/dig/include/dig/dig.h +++ b/bin/dig/include/dig/dig.h @@ -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;