diff --git a/CHANGES b/CHANGES index 2ded71a419..a45d476b46 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +4690. [bug] Command line options -4/-6 were handled inconsistently + between tools. [RT #45632] + 4689. [cleanup] Turn on minimal responses for CDNSKEY and CDS in addition to DNSKEY and DS. Thanks to Tony Finch. [RT #45690] diff --git a/bin/delv/delv.c b/bin/delv/delv.c index bc3cc04cc4..9b96154ec3 100644 --- a/bin/delv/delv.c +++ b/bin/delv/delv.c @@ -1374,6 +1374,7 @@ dash_option(char *option, char *next, isc_boolean_t *open_type_class) { */ static void preparse_args(int argc, char **argv) { + isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE; char *option; for (argc--, argv++; argc > 0; argc--, argv++) { @@ -1381,10 +1382,23 @@ preparse_args(int argc, char **argv) { continue; option = &argv[0][1]; while (strpbrk(option, single_dash_opts) == &option[0]) { - if (option[0] == 'm') { + switch (option[0]) { + case 'm': isc_mem_debugging = ISC_MEM_DEBUGTRACE | ISC_MEM_DEBUGRECORD; - return; + break; + case '4': + if (ipv6only) { + fatal("only one of -4 and -6 allowed"); + } + ipv4only = ISC_TRUE; + break; + case '6': + if (ipv4only) { + fatal("only one of -4 and -6 allowed"); + } + ipv6only = ISC_TRUE; + break; } option = &option[1]; } @@ -1572,8 +1586,8 @@ main(int argc, char *argv[]) { struct sigaction sa; #endif - preparse_args(argc, argv); progname = argv[0]; + preparse_args(argc, argv); argc--; argv++; diff --git a/bin/delv/delv.docbook b/bin/delv/delv.docbook index 9ef59db0b9..e2af68474f 100644 --- a/bin/delv/delv.docbook +++ b/bin/delv/delv.docbook @@ -43,8 +43,10 @@ delv @server - - + + + + diff --git a/bin/dig/dig.docbook b/bin/dig/dig.docbook index b3a70fb22d..29bf8335ff 100644 --- a/bin/dig/dig.docbook +++ b/bin/dig/dig.docbook @@ -67,8 +67,10 @@ - - + + + + name type class diff --git a/bin/dig/host.docbook b/bin/dig/host.docbook index 18fc605faf..9aa0ad3d55 100644 --- a/bin/dig/host.docbook +++ b/bin/dig/host.docbook @@ -57,8 +57,10 @@ - - + + + + name diff --git a/bin/named/lwresd.docbook b/bin/named/lwresd.docbook index 48dda31e69..81d0290060 100644 --- a/bin/named/lwresd.docbook +++ b/bin/named/lwresd.docbook @@ -60,8 +60,10 @@ - - + + + + diff --git a/bin/named/named.docbook b/bin/named/named.docbook index 79fe9f17da..311ddfd6e2 100644 --- a/bin/named/named.docbook +++ b/bin/named/named.docbook @@ -50,8 +50,10 @@ named - - + + + + diff --git a/bin/tests/system/digdelv/tests.sh b/bin/tests/system/digdelv/tests.sh index ffdb5714d5..71cce27e98 100644 --- a/bin/tests/system/digdelv/tests.sh +++ b/bin/tests/system/digdelv/tests.sh @@ -490,6 +490,14 @@ if [ -x ${DELV} ] ; then if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` + n=`expr $n + 1` + echo "I:checking delv -4 -6 ($n)" + ret=0 + $DELV $DELVOPTS @10.53.0.3 -4 -6 A a.example > delv.out.test$n 2>&1 && ret=1 + grep "only one of -4 and -6 allowed" < delv.out.test$n > /dev/null || ret=1 + if [ $ret != 0 ]; then echo "I:failed"; fi + status=`expr $status + $ret` + n=`expr $n + 1` echo "I:checking delv with IPv6 on IPv4 does not work ($n)" if $TESTSOCK6 fd92:7065:b8e:ffff::3 2>/dev/null diff --git a/bin/tests/system/pipelined/tests.sh b/bin/tests/system/pipelined/tests.sh index 0eb46a21ca..3ab9ad9f41 100644 --- a/bin/tests/system/pipelined/tests.sh +++ b/bin/tests/system/pipelined/tests.sh @@ -51,5 +51,19 @@ diff refb outputb.mdig || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` +echo "I:check mdig -4 -6" +ret=0 +$MDIG -4 -6 -f input @10.53.0.4 > output46.mdig 2>&1 && ret=1 +grep "only one of -4 and -6 allowed" output46.mdig > /dev/null || ret=1 +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` + +echo "I:check mdig -4 with an IPv6 server address" +ret=0 +$MDIG -4 -f input @fd92:7065:b8e:ffff::2 > output4.mdig 2>&1 && ret=1 +grep "address family not supported" output4.mdig > /dev/null || ret=1 +if [ $ret != 0 ]; then echo "I:failed"; fi +status=`expr $status + $ret` + echo "I:exit status: $status" [ $status -eq 0 ] || exit 1 diff --git a/bin/tools/mdig.c b/bin/tools/mdig.c index 2c9229f287..c1204495a2 100644 --- a/bin/tools/mdig.c +++ b/bin/tools/mdig.c @@ -1714,6 +1714,7 @@ preparse_args(int argc, char **argv) { int rc; char **rv; char *option; + isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE; rc = argc; rv = argv; @@ -1727,6 +1728,18 @@ preparse_args(int argc, char **argv) { isc_mem_debugging = ISC_MEM_DEBUGTRACE | ISC_MEM_DEBUGRECORD; break; + case '4': + if (ipv6only) { + fatal("only one of -4 and -6 allowed"); + } + ipv4only = ISC_TRUE; + break; + case '6': + if (ipv4only) { + fatal("only one of -4 and -6 allowed"); + } + ipv6only = ISC_TRUE; + break; } option = &option[1]; } @@ -1884,6 +1897,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) int main(int argc, char *argv[]) { struct query *query; + isc_result_t result; isc_sockaddr_t bind_any; isc_log_t *lctx; isc_logconfig_t *lcfg; @@ -1932,7 +1946,12 @@ main(int argc, char *argv[]) { fatal("a server '@xxx' is required"); ns = 0; - RUNCHECK(bind9_getaddresses(server, port, &dstaddr, 1, &ns)); + result = bind9_getaddresses(server, port, &dstaddr, 1, &ns); + if (result != ISC_R_SUCCESS) { + fatal("couldn't get address for '%s': %s", + server, isc_result_totext(result)); + } + if (isc_sockaddr_pf(&dstaddr) == PF_INET && have_ipv6) { isc_net_disableipv6(); have_ipv6 = ISC_FALSE; diff --git a/bin/tools/mdig.docbook b/bin/tools/mdig.docbook index 0d8dc025cf..587e097188 100644 --- a/bin/tools/mdig.docbook +++ b/bin/tools/mdig.docbook @@ -43,8 +43,10 @@ - - + + + +