diff --git a/bin/tests/system/digdelv/tests.sh b/bin/tests/system/digdelv/tests.sh index 9dfd9de475..b0f655b739 100644 --- a/bin/tests/system/digdelv/tests.sh +++ b/bin/tests/system/digdelv/tests.sh @@ -109,19 +109,19 @@ if [ -x "$DIG" ] ; then status=$((status+ret)) n=$((n+1)) - echo_i "checking dig +multi +norrcomments works for dnskey (when default is rrcomments)($n)" + echo_i "checking dig +multi +norrcomments works for DNSKEY (when default is rrcomments)($n)" ret=0 - dig_with_opts +tcp @10.53.0.3 +multi +norrcomments DNSKEY dnskey.example > dig.out.test$n || ret=1 - grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < dig.out.test$n > /dev/null && ret=1 + dig_with_opts +tcp @10.53.0.3 +multi +norrcomments -t DNSKEY dnskey.example > dig.out.test$n || ret=1 + grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" dig.out.test$n > /dev/null && ret=1 check_ttl_range dig.out.test$n "DNSKEY" 300 || ret=1 if [ $ret -ne 0 ]; then echo_i "failed"; fi status=$((status+ret)) n=$((n+1)) - echo_i "checking dig +multi +norrcomments works for soa (when default is rrcomments)($n)" + echo_i "checking dig +multi +norrcomments works for SOA (when default is rrcomments)($n)" ret=0 - dig_with_opts +tcp @10.53.0.3 +multi +norrcomments SOA example > dig.out.test$n || ret=1 - grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < dig.out.test$n > /dev/null && ret=1 + dig_with_opts +tcp @10.53.0.3 +multi +norrcomments -t SOA example > dig.out.test$n || ret=1 + grep "; serial" dig.out.test$n > /dev/null && ret=1 check_ttl_range dig.out.test$n "SOA" 300 || ret=1 if [ $ret -ne 0 ]; then echo_i "failed"; fi status=$((status+ret)) @@ -728,6 +728,22 @@ if [ -x "$MDIG" ] ; then grep "ednsopt no code point specified" dig.out.test$n > /dev/null || ret=1 if [ $ret -ne 0 ]; then echo_i "failed"; fi status=$((status+ret)) + + n=$((n+1)) + echo_i "checking mdig +multi +norrcomments works for DNSKEY (when default is rrcomments)($n)" + ret=0 + mdig_with_opts +tcp @10.53.0.3 +multi +norrcomments -t DNSKEY dnskey.example > dig.out.test$n || ret=1 + grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" dig.out.test$n && ret=1 + if [ $ret -ne 0 ]; then echo_i "failed"; fi + status=$((status+ret)) + + n=$((n+1)) + echo_i "checking mdig +multi +norrcomments works for SOA (when default is rrcomments)($n)" + ret=0 + mdig_with_opts +tcp @10.53.0.3 +multi +norrcomments -t SOA example > dig.out.test$n || ret=1 + grep "; serial" < dig.out.test$n > /dev/null && ret=1 + if [ $ret -ne 0 ]; then echo_i "failed"; fi + status=$((status+ret)) else echo_i "$MDIG is needed, so skipping these mdig tests" fi @@ -823,7 +839,7 @@ if [ -x "$DELV" ] ; then status=$((status+ret)) n=$((n+1)) - echo_i "checking delv +multi +norrcomments works for dnskey (when default is rrcomments)($n)" + echo_i "checking delv +multi +norrcomments works for DNSKEY (when default is rrcomments)($n)" ret=0 delv_with_opts +tcp @10.53.0.3 +multi +norrcomments DNSKEY dnskey.example > delv.out.test$n || ret=1 grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < delv.out.test$n > /dev/null && ret=1 @@ -832,7 +848,7 @@ if [ -x "$DELV" ] ; then status=$((status+ret)) n=$((n+1)) - echo_i "checking delv +multi +norrcomments works for soa (when default is rrcomments)($n)" + echo_i "checking delv +multi +norrcomments works for SOA (when default is rrcomments)($n)" ret=0 delv_with_opts +tcp @10.53.0.3 +multi +norrcomments SOA example > delv.out.test$n || ret=1 grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < delv.out.test$n > /dev/null && ret=1 diff --git a/bin/tools/mdig.c b/bin/tools/mdig.c index 3c065af7b8..0b796d1717 100644 --- a/bin/tools/mdig.c +++ b/bin/tools/mdig.c @@ -94,7 +94,7 @@ static bool besteffort = true; static bool display_short_form = false; static bool display_headers = true; static bool display_comments = true; -static bool display_rrcomments = true; +static int display_rrcomments = 0; static bool display_ttlunits = true; static bool display_ttl = true; static bool display_class = true; @@ -247,7 +247,7 @@ recvresponse(isc_task_t *task, isc_event_t *event) { styleflags |= DNS_STYLEFLAG_COMMENT; if (display_unknown_format) styleflags |= DNS_STYLEFLAG_UNKNOWNFORMAT; - if (display_rrcomments) + if (display_rrcomments > 0) styleflags |= DNS_STYLEFLAG_RRCOMMENT; if (display_ttlunits) styleflags |= DNS_STYLEFLAG_TTL_UNITS; @@ -265,7 +265,10 @@ recvresponse(isc_task_t *task, isc_event_t *event) { styleflags |= DNS_STYLEFLAG_TTL; styleflags |= DNS_STYLEFLAG_MULTILINE; styleflags |= DNS_STYLEFLAG_COMMENT; - styleflags |= DNS_STYLEFLAG_RRCOMMENT; + /* Turn on rrcomments unless explicitly disabled */ + if (display_rrcomments >= 0) { + styleflags |= DNS_STYLEFLAG_RRCOMMENT; + } } if (display_multiline || (!display_ttl && !display_class)) result = dns_master_stylecreate(&style, styleflags, @@ -1100,7 +1103,7 @@ plus_option(char *option, struct query *query, bool global) display_authority = state; display_additional = state; display_comments = state; - display_rrcomments = state; + display_rrcomments = state ? 1 : -1; break; case 'n': /* answer */ FULLCHECK("answer"); @@ -1349,7 +1352,7 @@ plus_option(char *option, struct query *query, bool global) case 'r': FULLCHECK("rrcomments"); GLOBAL(); - display_rrcomments = state; + display_rrcomments = state ? 1 : -1; break; default: goto invalid_option; @@ -1367,7 +1370,7 @@ plus_option(char *option, struct query *query, bool global) display_authority = false; display_additional = false; display_comments = false; - display_rrcomments = false; + display_rrcomments = -1; } break; case 'p': /* split */