mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 06:55:30 +00:00
[master] Ensure consistent handling of -4/-6 command line options in all tools
4690. [bug] Command line options -4/-6 were handled inconsistently between tools. [RT #45632]
This commit is contained in:
3
CHANGES
3
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
|
4689. [cleanup] Turn on minimal responses for CDNSKEY and CDS in
|
||||||
addition to DNSKEY and DS. Thanks to Tony Finch.
|
addition to DNSKEY and DS. Thanks to Tony Finch.
|
||||||
[RT #45690]
|
[RT #45690]
|
||||||
|
@@ -1374,6 +1374,7 @@ dash_option(char *option, char *next, isc_boolean_t *open_type_class) {
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
preparse_args(int argc, char **argv) {
|
preparse_args(int argc, char **argv) {
|
||||||
|
isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE;
|
||||||
char *option;
|
char *option;
|
||||||
|
|
||||||
for (argc--, argv++; argc > 0; argc--, argv++) {
|
for (argc--, argv++; argc > 0; argc--, argv++) {
|
||||||
@@ -1381,10 +1382,23 @@ preparse_args(int argc, char **argv) {
|
|||||||
continue;
|
continue;
|
||||||
option = &argv[0][1];
|
option = &argv[0][1];
|
||||||
while (strpbrk(option, single_dash_opts) == &option[0]) {
|
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_debugging = ISC_MEM_DEBUGTRACE |
|
||||||
ISC_MEM_DEBUGRECORD;
|
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];
|
option = &option[1];
|
||||||
}
|
}
|
||||||
@@ -1572,8 +1586,8 @@ main(int argc, char *argv[]) {
|
|||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
preparse_args(argc, argv);
|
|
||||||
progname = argv[0];
|
progname = argv[0];
|
||||||
|
preparse_args(argc, argv);
|
||||||
|
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
|
@@ -43,8 +43,10 @@
|
|||||||
<cmdsynopsis sepchar=" ">
|
<cmdsynopsis sepchar=" ">
|
||||||
<command>delv</command>
|
<command>delv</command>
|
||||||
<arg choice="opt" rep="norepeat">@server</arg>
|
<arg choice="opt" rep="norepeat">@server</arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
<group choice="opt" rep="norepeat">
|
||||||
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
||||||
|
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
||||||
|
</group>
|
||||||
<arg choice="opt" rep="norepeat"><option>-a <replaceable class="parameter">anchor-file</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-a <replaceable class="parameter">anchor-file</replaceable></option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-b <replaceable class="parameter">address</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-b <replaceable class="parameter">address</replaceable></option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">class</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">class</replaceable></option></arg>
|
||||||
|
@@ -67,8 +67,10 @@
|
|||||||
<arg choice="opt" rep="norepeat"><option>-v</option></arg>
|
<arg choice="opt" rep="norepeat"><option>-v</option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-x <replaceable class="parameter">addr</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-x <replaceable class="parameter">addr</replaceable></option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-y <replaceable class="parameter"><optional>hmac:</optional>name:key</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-y <replaceable class="parameter"><optional>hmac:</optional>name:key</replaceable></option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
<group choice="opt" rep="norepeat">
|
||||||
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
||||||
|
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
||||||
|
</group>
|
||||||
<arg choice="opt" rep="norepeat">name</arg>
|
<arg choice="opt" rep="norepeat">name</arg>
|
||||||
<arg choice="opt" rep="norepeat">type</arg>
|
<arg choice="opt" rep="norepeat">type</arg>
|
||||||
<arg choice="opt" rep="norepeat">class</arg>
|
<arg choice="opt" rep="norepeat">class</arg>
|
||||||
|
@@ -57,8 +57,10 @@
|
|||||||
<arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">type</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">type</replaceable></option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-W <replaceable class="parameter">wait</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-W <replaceable class="parameter">wait</replaceable></option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-m <replaceable class="parameter">flag</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-m <replaceable class="parameter">flag</replaceable></option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
<group choice="opt" rep="norepeat">
|
||||||
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
||||||
|
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
||||||
|
</group>
|
||||||
<arg choice="opt" rep="norepeat"><option>-v</option></arg>
|
<arg choice="opt" rep="norepeat"><option>-v</option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-V</option></arg>
|
<arg choice="opt" rep="norepeat"><option>-V</option></arg>
|
||||||
<arg choice="req" rep="norepeat">name</arg>
|
<arg choice="req" rep="norepeat">name</arg>
|
||||||
|
@@ -60,8 +60,10 @@
|
|||||||
<arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">directory</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">directory</replaceable></option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-u <replaceable class="parameter">user</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-u <replaceable class="parameter">user</replaceable></option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-v</option></arg>
|
<arg choice="opt" rep="norepeat"><option>-v</option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
<group choice="opt" rep="norepeat">
|
||||||
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
||||||
|
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
||||||
|
</group>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
|
|
||||||
|
@@ -50,8 +50,10 @@
|
|||||||
<refsynopsisdiv>
|
<refsynopsisdiv>
|
||||||
<cmdsynopsis sepchar=" ">
|
<cmdsynopsis sepchar=" ">
|
||||||
<command>named</command>
|
<command>named</command>
|
||||||
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
<group choice="opt" rep="norepeat">
|
||||||
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
||||||
|
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
||||||
|
</group>
|
||||||
<arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">config-file</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">config-file</replaceable></option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-d <replaceable class="parameter">debug-level</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-d <replaceable class="parameter">debug-level</replaceable></option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-D <replaceable class="parameter">string</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-D <replaceable class="parameter">string</replaceable></option></arg>
|
||||||
|
@@ -490,6 +490,14 @@ if [ -x ${DELV} ] ; then
|
|||||||
if [ $ret != 0 ]; then echo "I:failed"; fi
|
if [ $ret != 0 ]; then echo "I:failed"; fi
|
||||||
status=`expr $status + $ret`
|
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`
|
n=`expr $n + 1`
|
||||||
echo "I:checking delv with IPv6 on IPv4 does not work ($n)"
|
echo "I:checking delv with IPv6 on IPv4 does not work ($n)"
|
||||||
if $TESTSOCK6 fd92:7065:b8e:ffff::3 2>/dev/null
|
if $TESTSOCK6 fd92:7065:b8e:ffff::3 2>/dev/null
|
||||||
|
@@ -51,5 +51,19 @@ diff refb outputb.mdig || ret=1
|
|||||||
if [ $ret != 0 ]; then echo "I:failed"; fi
|
if [ $ret != 0 ]; then echo "I:failed"; fi
|
||||||
status=`expr $status + $ret`
|
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"
|
echo "I:exit status: $status"
|
||||||
[ $status -eq 0 ] || exit 1
|
[ $status -eq 0 ] || exit 1
|
||||||
|
@@ -1714,6 +1714,7 @@ preparse_args(int argc, char **argv) {
|
|||||||
int rc;
|
int rc;
|
||||||
char **rv;
|
char **rv;
|
||||||
char *option;
|
char *option;
|
||||||
|
isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE;
|
||||||
|
|
||||||
rc = argc;
|
rc = argc;
|
||||||
rv = argv;
|
rv = argv;
|
||||||
@@ -1727,6 +1728,18 @@ preparse_args(int argc, char **argv) {
|
|||||||
isc_mem_debugging = ISC_MEM_DEBUGTRACE |
|
isc_mem_debugging = ISC_MEM_DEBUGTRACE |
|
||||||
ISC_MEM_DEBUGRECORD;
|
ISC_MEM_DEBUGRECORD;
|
||||||
break;
|
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];
|
option = &option[1];
|
||||||
}
|
}
|
||||||
@@ -1884,6 +1897,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv)
|
|||||||
int
|
int
|
||||||
main(int argc, char *argv[]) {
|
main(int argc, char *argv[]) {
|
||||||
struct query *query;
|
struct query *query;
|
||||||
|
isc_result_t result;
|
||||||
isc_sockaddr_t bind_any;
|
isc_sockaddr_t bind_any;
|
||||||
isc_log_t *lctx;
|
isc_log_t *lctx;
|
||||||
isc_logconfig_t *lcfg;
|
isc_logconfig_t *lcfg;
|
||||||
@@ -1932,7 +1946,12 @@ main(int argc, char *argv[]) {
|
|||||||
fatal("a server '@xxx' is required");
|
fatal("a server '@xxx' is required");
|
||||||
|
|
||||||
ns = 0;
|
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) {
|
if (isc_sockaddr_pf(&dstaddr) == PF_INET && have_ipv6) {
|
||||||
isc_net_disableipv6();
|
isc_net_disableipv6();
|
||||||
have_ipv6 = ISC_FALSE;
|
have_ipv6 = ISC_FALSE;
|
||||||
|
@@ -43,8 +43,10 @@
|
|||||||
<arg choice="opt" rep="norepeat"><option>-f <replaceable class="parameter">filename</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-f <replaceable class="parameter">filename</replaceable></option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-h</option></arg>
|
<arg choice="opt" rep="norepeat"><option>-h</option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-v</option></arg>
|
<arg choice="opt" rep="norepeat"><option>-v</option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
<group choice="opt" rep="norepeat">
|
||||||
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
||||||
|
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
||||||
|
</group>
|
||||||
<arg choice="opt" rep="norepeat"><option>-m</option></arg>
|
<arg choice="opt" rep="norepeat"><option>-m</option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-b <replaceable class="parameter">address</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-b <replaceable class="parameter">address</replaceable></option></arg>
|
||||||
<arg choice="opt" rep="norepeat"><option>-p <replaceable class="parameter">port#</replaceable></option></arg>
|
<arg choice="opt" rep="norepeat"><option>-p <replaceable class="parameter">port#</replaceable></option></arg>
|
||||||
|
Reference in New Issue
Block a user