summaryrefslogtreecommitdiff
path: root/bin/dig/dig.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/dig/dig.c')
-rw-r--r--bin/dig/dig.c114
1 files changed, 64 insertions, 50 deletions
diff --git a/bin/dig/dig.c b/bin/dig/dig.c
index 07d8b0b7e14a..145e6107ad33 100644
--- a/bin/dig/dig.c
+++ b/bin/dig/dig.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -165,71 +165,75 @@ help(void) {
" q-type is one of (a,any,mx,ns,soa,hinfo,axfr,txt,...) [default:a]\n"
" (Use ixfr=version for type ixfr)\n"
" q-opt is one of:\n"
-" -x dot-notation (shortcut for reverse lookups)\n"
-" -i (use IP6.INT for IPv6 reverse lookups)\n"
-" -f filename (batch mode)\n"
+" -4 (use IPv4 query transport only)\n"
+" -6 (use IPv6 query transport only)\n"
" -b address[#port] (bind to source address/port)\n"
+" -c class (specify query class)\n"
+" -f filename (batch mode)\n"
+" -i (use IP6.INT for IPv6 reverse lookups)\n"
+" -k keyfile (specify tsig key file)\n"
+" -m (enable memory usage debugging)\n"
" -p port (specify port number)\n"
" -q name (specify query name)\n"
" -t type (specify query type)\n"
-" -c class (specify query class)\n"
-" -k keyfile (specify tsig key file)\n"
+" -x dot-notation (shortcut for reverse lookups)\n"
" -y [hmac:]name:key (specify named base64 tsig key)\n"
-" -4 (use IPv4 query transport only)\n"
-" -6 (use IPv6 query transport only)\n"
-" -m (enable memory usage debugging)\n"
" d-opt is of the form +keyword[=value], where keyword is:\n"
-" +[no]vc (TCP mode)\n"
-" +[no]tcp (TCP mode, alternate syntax)\n"
-" +time=### (Set query timeout) [5]\n"
-" +tries=### (Set number of UDP attempts) [3]\n"
-" +retry=### (Set number of UDP retries) [2]\n"
-" +domain=### (Set default domainname)\n"
-" +bufsize=### (Set EDNS0 Max UDP packet size)\n"
-" +ndots=### (Set NDOTS value)\n"
-" +[no]edns[=###] (Set EDNS version) [0]\n"
-" +[no]search (Set whether to use searchlist)\n"
-" +[no]showsearch (Search with intermediate results)\n"
-" +[no]defname (Ditto)\n"
-" +[no]recurse (Recursive mode)\n"
-" +[no]ignore (Don't revert to TCP for TC responses.)"
-"\n"
-" +[no]fail (Don't try next server on SERVFAIL)\n"
-" +[no]besteffort (Try to parse even illegal messages)\n"
" +[no]aaonly (Set AA flag in query (+[no]aaflag))\n"
-" +[no]adflag (Set AD flag in query)\n"
-" +[no]cdflag (Set CD flag in query)\n"
+" +[no]additional (Control display of additional section)\n"
+" +[no]adflag (Set AD flag in query (default on))\n"
+" +[no]all (Set or clear all display flags)\n"
+" +[no]answer (Control display of answer section)\n"
+" +[no]authority (Control display of authority section)\n"
+" +[no]besteffort (Try to parse even illegal messages)\n"
+" +bufsize=### (Set EDNS0 Max UDP packet size)\n"
+" +[no]cdflag (Set checking disabled flag in query)\n"
" +[no]cl (Control display of class in records)\n"
" +[no]cmd (Control display of command line)\n"
" +[no]comments (Control display of comment lines)\n"
+" +[no]defname (Use search list (+[no]search))\n"
+" +[no]dnssec (Request DNSSEC records)\n"
+" +domain=### (Set default domainname)\n"
+" +[no]edns[=###] (Set EDNS version) [0]\n"
+" +[no]fail (Don't try next server on SERVFAIL)\n"
+" +[no]identify (ID responders in short answers)\n"
+" +[no]ignore (Don't revert to TCP for TC responses.)"
+"\n"
+" +[no]keepopen (Keep the TCP socket open between queries)\n"
+" +[no]multiline (Print records in an expanded format)\n"
+" +ndots=### (Set search NDOTS value)\n"
+" +[no]nsid (Request Name Server ID)\n"
+" +[no]nssearch (Search all authoritative nameservers)\n"
+" +[no]onesoa (AXFR prints only one soa record)\n"
+" +[no]qr (Print question before sending)\n"
+" +[no]question (Control display of question section)\n"
+" +[no]recurse (Recursive mode)\n"
+" +retry=### (Set number of UDP retries) [2]\n"
" +[no]rrcomments (Control display of per-record "
"comments)\n"
-" +[no]question (Control display of question)\n"
-" +[no]answer (Control display of answer)\n"
-" +[no]authority (Control display of authority)\n"
-" +[no]additional (Control display of additional)\n"
-" +[no]stats (Control display of statistics)\n"
-" +[no]short (Disable everything except short\n"
+" +[no]search (Set whether to use searchlist)\n"
+" +[no]short (Display nothing except short\n"
" form of answer)\n"
-" +[no]ttlid (Control display of ttls in records)\n"
-" +[no]all (Set or clear all display flags)\n"
-" +[no]qr (Print question before sending)\n"
-" +[no]nssearch (Search all authoritative nameservers)\n"
-" +[no]identify (ID responders in short answers)\n"
-" +[no]trace (Trace delegation down from root [+dnssec])\n"
-" +[no]dnssec (Request DNSSEC records)\n"
-" +[no]nsid (Request Name Server ID)\n"
+" +[no]showsearch (Search with intermediate results)\n"
#ifdef DIG_SIGCHASE
" +[no]sigchase (Chase DNSSEC signatures)\n"
-" +trusted-key=#### (Trusted Key when chasing DNSSEC sigs)\n"
+#endif
+" +[no]split=## (Split hex/base64 fields into chunks)\n"
+" +[no]stats (Control display of statistics)\n"
+" +[no]tcp (TCP mode (+[no]vc))\n"
+" +time=### (Set query timeout) [5]\n"
+#ifdef DIG_SIGCHASE
#if DIG_SIGCHASE_TD
" +[no]topdown (Do DNSSEC validation top down mode)\n"
#endif
#endif
-" +[no]split=## (Split hex/base64 fields into chunks)\n"
-" +[no]multiline (Print records in an expanded format)\n"
-" +[no]onesoa (AXFR prints only one soa record)\n"
-" +[no]keepopen (Keep the TCP socket open between queries)\n"
+" +[no]trace (Trace delegation down from root [+dnssec])\n"
+" +tries=### (Set number of UDP attempts) [3]\n"
+#ifdef DIG_SIGCHASE
+" +trusted-key=#### (Trusted Key when chasing DNSSEC sigs)\n"
+#endif
+" +[no]ttlid (Control display of ttls in records)\n"
+" +[no]vc (TCP mode (+[no]tcp))\n"
" global d-opts and servers (before host name) affect all queries.\n"
" local d-opts and servers (after host name) affect only that lookup.\n"
" -h (print help and exit)\n"
@@ -306,6 +310,7 @@ say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
isc_result_t result;
isc_uint64_t diff;
char store[sizeof("12345678901234567890")];
+ unsigned int styleflags = 0;
if (query->lookup->trace || query->lookup->ns_search_only) {
result = dns_rdatatype_totext(rdata->type, buf);
@@ -313,7 +318,11 @@ say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
return (result);
ADD_STRING(buf, " ");
}
- result = dns_rdata_totext(rdata, NULL, buf);
+
+ if (rrcomments)
+ styleflags |= DNS_STYLEFLAG_RRCOMMENT;
+ result = dns_rdata_tofmttext(rdata, NULL, styleflags, 0,
+ splitwidth, " ", buf);
if (result == ISC_R_NOSPACE)
return (result);
check_result(result, "dns_rdata_totext");
@@ -831,8 +840,9 @@ plus_option(char *option, isc_boolean_t is_batchfile,
goto invalid_option;
}
break;
- case 'l': /* cl */
- FULLCHECK("cl");
+ case 'l': /* class */
+ /* keep +cl for backwards compatibility */
+ FULLCHECK2("cl", "class");
noclass = ISC_TF(!state);
break;
case 'm': /* cmd */
@@ -984,6 +994,10 @@ plus_option(char *option, isc_boolean_t is_batchfile,
break;
case 'r':
switch (cmd[1]) {
+ case 'd': /* rdflag */
+ FULLCHECK("rdflag");
+ lookup->recurse = state;
+ break;
case 'e':
switch (cmd[2]) {
case 'c': /* recurse */