]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3992. [func] DiG can now send queries without questions
authorMark Andrews <marka@isc.org>
Thu, 30 Oct 2014 00:42:02 +0000 (11:42 +1100)
committerMark Andrews <marka@isc.org>
Thu, 30 Oct 2014 00:42:02 +0000 (11:42 +1100)
                        (dig +header-only). [RT #37599]

CHANGES
bin/dig/dig.c
bin/dig/dig.docbook
bin/dig/dighost.c
bin/dig/include/dig/dig.h
doc/arm/notes.xml

diff --git a/CHANGES b/CHANGES
index c7301607f1bba451a8162100c6689a8dc993df6c..0b5a2de328ab48d7bd0886aa4ba4279da300c726 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3992.  [func]          DiG can now send queries without questions
+                       (dig +header-only). [RT #37599]
+
 3991.  [func]          Add the ability to buffer logging output by specifying
                        "buffered yes;" when defining a channel. [RT #26561]
 
index 0b4045e3389fd8751167c7d84083e09b88b291e3..2a00b058d889318c145a28c720ed2b7fa950cbec 100644 (file)
@@ -230,6 +230,7 @@ help(void) {
 "                 +[no]dnssec         (Request DNSSEC records)\n"
 "                 +[no]expire         (Request time to expire)\n"
 "                 +[no]nsid           (Request Name Server ID)\n"
+"                 +[no]header-only    (Send query without a question section)\n"
 #ifdef ISC_PLATFORM_USESIT
 "                 +[no]sit            (Request a Source Identity Token)\n"
 #endif
@@ -1017,6 +1018,10 @@ plus_option(char *option, isc_boolean_t is_batchfile,
                FULLCHECK("fail");
                lookup->servfail_stops = state;
                break;
+       case 'h':
+               FULLCHECK("header-only");
+               lookup->header_only = state;
+               break;
        case 'i':
                switch (cmd[1]) {
                case 'd': /* identify */
index 5dfbe212df4cf176ef1abb203e293b7973aef65a..24fba64ee21659e02e5f220cd4459cdf5c9ba64b 100644 (file)
          </listitem>
        </varlistentry>
 
+       <varlistentry>
+         <term><option>+[no]header-only</option></term>
+         <listitem>
+           <para>
+             Send a query with a DNS header without a question section.
+             The default is to add a question section.  The query type
+             and query name are ignored when this is set.
+           </para>
+         </listitem>
+       </varlistentry>
+
        <varlistentry>
          <term><option>+[no]identify</option></term>
          <listitem>
index c9e048e20a96b4f32e9c4752311087bb7d80fbbe..7d418804fd22aa1c0ba822a45625543b88c81b8f 100644 (file)
@@ -786,6 +786,7 @@ make_empty_lookup(void) {
        looknew->ednsflags = 0;
        looknew->expire = ISC_FALSE;
        looknew->nsid = ISC_FALSE;
+       looknew->header_only = ISC_FALSE;
 #ifdef ISC_PLATFORM_USESIT
        looknew->sit = ISC_FALSE;
 #endif
@@ -881,6 +882,7 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
        looknew->ednsflags = lookold->ednsflags;
        looknew->expire = lookold->expire;
        looknew->nsid = lookold->nsid;
+       looknew->header_only = lookold->header_only;
 #ifdef ISC_PLATFORM_USESIT
        looknew->sit = lookold->sit;
        looknew->sitvalue = lookold->sitvalue;
@@ -2431,8 +2433,9 @@ setup_lookup(dig_lookup_t *lookup) {
                }
        }
 
-       add_question(lookup->sendmsg, lookup->name, lookup->rdclass,
-                    lookup->rdtype);
+       if (!lookup->header_only)
+               add_question(lookup->sendmsg, lookup->name, lookup->rdclass,
+                            lookup->rdtype);
 
        /* add_soa */
        if (lookup->rdtype == dns_rdatatype_ixfr)
index 97e1e7b00c4beddc2d326d530e52abf8e192a45d..435e8d539c24182ad7f0cf2b82b334194a44c4a9 100644 (file)
@@ -135,7 +135,8 @@ struct dig_lookup {
 #ifdef ISC_PLATFORM_USESIT
                sit,
 #endif
-               nsid;   /*% Name Server ID (RFC 5001) */
+               nsid,   /*% Name Server ID (RFC 5001) */
+               header_only;
 #ifdef DIG_SIGCHASE
 isc_boolean_t  sigchase;
 #if DIG_SIGCHASE_TD
index bf1c982b214e9c2416c270db37b56b821e6eb4ad..52480d4e045ccff74a413feb6fa017e8e0995a93 100644 (file)
           yet-to-be-defined EDNS flags in DNS requests.
        </para>
       </listitem>
+      <listitem>
+       <para>
+          <command>dig +header-only</command> can now be used to send
+         queries without a question section.
+       </para>
+      </listitem>
       <listitem>
        <para>
           <command>dig +ttlunits</command> causes <command>dig</command>