2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-04 00:25:29 +00:00

Added +unexpected option so dig will print replies from unexpected

sources.
This commit is contained in:
Diego dos Santos Fronza
2019-07-25 11:35:36 -03:00
parent 582ba39bb6
commit 460d4d63ee
3 changed files with 27 additions and 4 deletions

View 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':
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");

View File

@@ -3602,9 +3602,11 @@ recv_done(isc_task_t *task, isc_event_t *event) {
sizeof(buf2));
printf(";; reply from unexpected source: %s,"
" expected %s\n", buf1, buf2);
if (!l->accept_reply_unexpected_src) {
match = false;
}
}
}
result = dns_message_peekheader(&b, &id, &msgflags);
if (result != ISC_R_SUCCESS || l->sendmsg->id != id) {

View 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;