]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1608. [func] dig and host now accept -4/-6 to select IP transport
authorMark Andrews <marka@isc.org>
Tue, 13 Apr 2004 01:09:37 +0000 (01:09 +0000)
committerMark Andrews <marka@isc.org>
Tue, 13 Apr 2004 01:09:37 +0000 (01:09 +0000)
                        to use when making queries.

CHANGES
bin/dig/dig.c
bin/dig/dig.docbook
bin/dig/host.c
bin/dig/host.docbook

diff --git a/CHANGES b/CHANGES
index b062f5b0ce6de7801342576e24b465851a406e92..e6068f4bd34345cd2a6f85cb8eea619935f42893 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+1608.  [func]          dig and host now accept -4/-6 to select IP transport
+                       to use when making queries.
+
 1607.  [bug]           dig, host and nslookup were still using random()
                        to generate query ids. [RT# 11013]
 
index ddf561f92094124cf0bed6893cf336a14cfe7f93..98c50168decd086f68b15a563d09917e110934f8 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: dig.c,v 1.186 2004/03/16 05:52:13 marka Exp $ */
+/* $Id: dig.c,v 1.187 2004/04/13 01:09:36 marka Exp $ */
 
 #include <config.h>
 #include <stdlib.h>
@@ -167,6 +167,8 @@ help(void) {
 "                 -c class            (specify query class)\n"
 "                 -k keyfile          (specify tsig key file)\n"
 "                 -y name:key         (specify named base64 tsig key)\n"
+"                 -4                  (use IPv4 query transport only)\n"
+"                 -6                  (use IPv6 query transport only)\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"
@@ -1022,6 +1024,20 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
        case 'n':
                /* deprecated */
                return (ISC_FALSE);
+       case '4':
+               if (have_ipv4) {
+                       isc_net_disableipv6();
+                       have_ipv6 = ISC_FALSE;
+               } else
+                       fatal("can't find IPv4 networking");
+               return (ISC_FALSE);
+       case '6':
+               if (have_ipv6) {
+                       isc_net_disableipv4();
+                       have_ipv4 = ISC_FALSE;
+               } else
+                       fatal("can't find IPv6 networking");
+               return (ISC_FALSE);
        case 'v':
                version();
                exit(0);
index 619bb237ce658ff12d84a314bf83b5441346de57..fbe3031a0c2bfb3129928e7b43bf70d4ccc11c74 100644 (file)
@@ -16,7 +16,7 @@
  - PERFORMANCE OF THIS SOFTWARE.
 -->
 
-<!-- $Id: dig.docbook,v 1.17 2004/03/05 04:57:30 marka Exp $ -->
+<!-- $Id: dig.docbook,v 1.18 2004/04/13 01:09:36 marka Exp $ -->
 
 <refentry>
 
@@ -47,6 +47,8 @@
 <arg><option>-t <replaceable class="parameter">type</replaceable></option></arg>
 <arg><option>-x <replaceable class="parameter">addr</replaceable></option></arg>
 <arg><option>-y <replaceable class="parameter">name:key</replaceable></option></arg>
+<arg><option>-4</option></arg>
+<arg><option>-6</option></arg>
 <arg choice=opt>name</arg>
 <arg choice=opt>type</arg>
 <arg choice=opt>class</arg>
@@ -181,6 +183,12 @@ to test a name server that has been configured to listen for queries
 on a non-standard port number.
 </para>
 
+<para>
+The <option>-4</option> option forces <command>dig</command> to only
+use IPv4 query transport.  The <option>-6</option> option forces
+<command>dig</command> to only use IPv6 query transport.
+</para>
+
 <para>
 The <option>-t</option> option sets the query type to
 <parameter>type</parameter>.  It can be any valid query type which is
index 7a9cb0747ff83f304cbbac4e32aef27d661b9705..b0a79611aa78380ee3610aee7385fcd4cea03429 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: host.c,v 1.94 2004/03/05 04:57:30 marka Exp $ */
+/* $Id: host.c,v 1.95 2004/04/13 01:09:37 marka Exp $ */
 
 #include <config.h>
 #include <limits.h>
@@ -44,6 +44,7 @@ extern ISC_LIST(dig_lookup_t) lookup_list;
 extern dig_serverlist_t server_list;
 extern ISC_LIST(dig_searchlist_t) search_list;
 
+extern isc_boolean_t have_ipv4, have_ipv6;
 extern isc_boolean_t usesearch;
 extern isc_boolean_t debugging;
 extern unsigned int timeout;
@@ -140,7 +141,9 @@ show_usage(void) {
 "       -T enables TCP/IP mode\n"
 "       -v enables verbose output\n"
 "       -w specifies to wait forever for a reply\n"
-"       -W specifies how long to wait for a reply\n", stderr);
+"       -W specifies how long to wait for a reply\n"
+"       -4 use IPv4 query transport only\n"
+"       -6 use IPv6 query transport only\n", stderr);
        exit(1);
 }
 
@@ -540,7 +543,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
 
        lookup = make_empty_lookup();
 
-       while ((c = isc_commandline_parse(argc, argv, "lvwrdt:c:aTCN:R:W:Dni"))
+       while ((c = isc_commandline_parse(argc, argv, "lvwrdt:c:aTCN:R:W:Dni46"))
               != EOF) {
                switch (c) {
                case 'l':
@@ -663,6 +666,20 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
                case 'D':
                        debugging = ISC_TRUE;
                        break;
+               case '4':
+                       if (have_ipv4) {
+                               isc_net_disableipv6();
+                               have_ipv6 = ISC_FALSE;
+                       } else
+                               fatal("can't find IPv4 networking");
+                       break;
+               case '6':
+                       if (have_ipv6) {
+                               isc_net_disableipv4();
+                               have_ipv4 = ISC_FALSE;
+                       } else
+                               fatal("can't find IPv6 networking");
+                       break;
                }
        }
 
index 4654ec11b8d237153f503b0b2f7316a8fc5c2383..a3442b878e2143ff751fa027d8bcc914c111633b 100644 (file)
@@ -16,7 +16,7 @@
  - PERFORMANCE OF THIS SOFTWARE.
 -->
 
-<!-- $Id: host.docbook,v 1.5 2004/03/05 04:57:30 marka Exp $ -->
+<!-- $Id: host.docbook,v 1.6 2004/04/13 01:09:37 marka Exp $ -->
 
 <refentry>
 
@@ -44,6 +44,8 @@
   <arg><option>-R <replaceable class="parameter">number</replaceable></option></arg>
   <arg><option>-t <replaceable class="parameter">type</replaceable></option></arg>
   <arg><option>-W <replaceable class="parameter">wait</replaceable></option></arg>
+  <arg><option>-4</option></arg>
+  <arg><option>-6</option></arg>
   <arg choice=req>name</arg>
   <arg choice=opt>server</arg>
 </cmdsynopsis>
@@ -154,6 +156,12 @@ the name server.  TCP will be automatically selected for queries that
 require it, such as zone transfer (AXFR) requests.
 </para>
 
+<para>
+The <option>-4</option> option forces <command>host</command> to only
+use IPv4 query transport.  The <option>-6</option> option forces
+<command>host</command> to only use IPv6 query transport.
+</para>
+
 <para>
 The <option>-t</option> option is used to select the query type.
 <parameter>type</parameter> can be any recognised query type: CNAME,