1608. [func] dig and host now accept -4/-6 to select IP transport

to use when making queries.
This commit is contained in:
Mark Andrews
2004-04-13 01:09:37 +00:00
parent 7b18445dd6
commit ea17e96977
5 changed files with 58 additions and 6 deletions

View File

@@ -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]

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

View 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

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

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