mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-12 16:59:59 -04:00
[v9_10] 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]
(cherry picked from commit d6814700de)
This commit is contained in:
parent
459256b06e
commit
16650c6fa2
8 changed files with 48 additions and 13 deletions
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
|
||||
addition to DNSKEY and DS. Thanks to Tony Finch.
|
||||
[RT #45690]
|
||||
|
|
|
|||
|
|
@ -1367,6 +1367,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++) {
|
||||
|
|
@ -1374,10 +1375,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];
|
||||
}
|
||||
|
|
@ -1565,8 +1579,8 @@ main(int argc, char *argv[]) {
|
|||
struct sigaction sa;
|
||||
#endif
|
||||
|
||||
preparse_args(argc, argv);
|
||||
progname = argv[0];
|
||||
preparse_args(argc, argv);
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
|
|
|
|||
|
|
@ -51,8 +51,10 @@
|
|||
<cmdsynopsis sepchar=" ">
|
||||
<command>delv</command>
|
||||
<arg choice="opt" rep="norepeat">@server</arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
||||
<group choice="opt" rep="norepeat">
|
||||
<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>-b <replaceable class="parameter">address</replaceable></option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-c <replaceable class="parameter">class</replaceable></option></arg>
|
||||
|
|
|
|||
|
|
@ -79,8 +79,10 @@
|
|||
<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>-y <replaceable class="parameter"><optional>hmac:</optional>name:key</replaceable></option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
||||
<group choice="opt" rep="norepeat">
|
||||
<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">type</arg>
|
||||
<arg choice="opt" rep="norepeat">class</arg>
|
||||
|
|
|
|||
|
|
@ -68,8 +68,10 @@
|
|||
<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>-m <replaceable class="parameter">flag</replaceable></option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
||||
<group choice="opt" rep="norepeat">
|
||||
<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="req" rep="norepeat">name</arg>
|
||||
|
|
|
|||
|
|
@ -72,8 +72,10 @@
|
|||
<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>-v</option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
||||
<group choice="opt" rep="norepeat">
|
||||
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
||||
</group>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
|
|
|
|||
|
|
@ -62,8 +62,10 @@
|
|||
<refsynopsisdiv>
|
||||
<cmdsynopsis sepchar=" ">
|
||||
<command>named</command>
|
||||
<arg choice="opt" rep="norepeat"><option>-4</option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-6</option></arg>
|
||||
<group choice="opt" rep="norepeat">
|
||||
<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>-d <replaceable class="parameter">debug-level</replaceable></option></arg>
|
||||
<arg choice="opt" rep="norepeat"><option>-D <replaceable class="parameter">string</replaceable></option></arg>
|
||||
|
|
|
|||
|
|
@ -337,6 +337,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
|
||||
|
|
|
|||
Loading…
Reference in a new issue