From: Mark Andrews Date: Tue, 13 Apr 2004 01:09:37 +0000 (+0000) Subject: 1608. [func] dig and host now accept -4/-6 to select IP transport X-Git-Tag: v9.2.3rc4^3~81 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=ea17e969771f19485dc7ab2f731d641128a9ee3b;p=thirdparty%2Fbind9.git 1608. [func] dig and host now accept -4/-6 to select IP transport to use when making queries. --- diff --git a/CHANGES b/CHANGES index b062f5b0ce6..e6068f4bd34 100644 --- 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] diff --git a/bin/dig/dig.c b/bin/dig/dig.c index ddf561f9209..98c50168dec 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -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 #include @@ -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); diff --git a/bin/dig/dig.docbook b/bin/dig/dig.docbook index 619bb237ce6..fbe3031a0c2 100644 --- a/bin/dig/dig.docbook +++ b/bin/dig/dig.docbook @@ -16,7 +16,7 @@ - PERFORMANCE OF THIS SOFTWARE. --> - + @@ -47,6 +47,8 @@ + + name type class @@ -181,6 +183,12 @@ to test a name server that has been configured to listen for queries on a non-standard port number. + +The option forces dig to only +use IPv4 query transport. The option forces +dig to only use IPv6 query transport. + + The option sets the query type to type. It can be any valid query type which is diff --git a/bin/dig/host.c b/bin/dig/host.c index 7a9cb0747ff..b0a79611aa7 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -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 #include @@ -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; } } diff --git a/bin/dig/host.docbook b/bin/dig/host.docbook index 4654ec11b8d..a3442b878e2 100644 --- a/bin/dig/host.docbook +++ b/bin/dig/host.docbook @@ -16,7 +16,7 @@ - PERFORMANCE OF THIS SOFTWARE. --> - + @@ -44,6 +44,8 @@ + + name server @@ -154,6 +156,12 @@ the name server. TCP will be automatically selected for queries that require it, such as zone transfer (AXFR) requests. + +The option forces host to only +use IPv4 query transport. The option forces +host to only use IPv6 query transport. + + The option is used to select the query type. type can be any recognised query type: CNAME,