Commit 58c103e0 authored by Mark Andrews's avatar Mark Andrews Committed by Evan Hunt
Browse files

dig: add the ability to set RA and TC in queries

parent 529d8625
Pipeline #1319 passed with stages
in 6 minutes and 45 seconds
4929. [func] Add the ability to set RA and TC in queries made by
dig (+[no]raflag, +[no]tcflag). [GL #213]
4928. [func] The "dnskey-sig-validity" option allows
"sig-validity-interval" to be overriden for signatures
covering DNSKEY RRsets. [GL #145]
......
......@@ -205,6 +205,7 @@ help(void) {
" +padding=### (Set padding block size [0])\n"
" +[no]qr (Print question before sending)\n"
" +[no]question (Control display of question section)\n"
" +[no]raflag (Set RA flag in query (+[no]raflag))\n"
" +[no]rdflag (Recursive mode (+[no]recurse))\n"
" +[no]recurse (Recursive mode (+[no]rdflag))\n"
" +retry=### (Set number of UDP retries) [2]\n"
......@@ -217,6 +218,7 @@ help(void) {
" +[no]split=## (Split hex/base64 fields into chunks)\n"
" +[no]stats (Control display of statistics)\n"
" +subnet=addr (Set edns-client-subnet option)\n"
" +[no]tcflag (Set TC flag in query (+[no]tcflag))\n"
" +[no]tcp (TCP mode (+[no]vc))\n"
" +timeout=### (Set query timeout) [5]\n"
" +[no]trace (Trace delegation down from root [+dnssec])\n"
......@@ -1240,6 +1242,10 @@ plus_option(char *option, isc_boolean_t is_batchfile,
break;
case 'r':
switch (cmd[1]) {
case 'a': /* raflag */
FULLCHECK("raflag");
lookup->raflag = state;
break;
case 'd': /* rdflag */
FULLCHECK("rdflag");
lookup->recurse = state;
......@@ -1383,10 +1389,20 @@ plus_option(char *option, isc_boolean_t is_batchfile,
case 't':
switch (cmd[1]) {
case 'c': /* tcp */
FULLCHECK("tcp");
if (!is_batchfile) {
lookup->tcp_mode = state;
lookup->tcp_mode_set = ISC_TRUE;
switch (cmd[2]) {
case 'f':
FULLCHECK("tcflag");
lookup->tcflag = state;
break;
case 'p':
FULLCHECK("tcp");
if (!is_batchfile) {
lookup->tcp_mode = state;
lookup->tcp_mode_set = ISC_TRUE;
}
break;
default:
goto invalid_option;
}
break;
case 'i': /* timeout */
......
......@@ -953,6 +953,17 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]raflag</option></term>
<listitem>
<para>
Set [do not set] the RA (Recursion Available) bit in
the query. The default is +noraflag. This bit should
be ignored by the server for QUERY.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]rdflag</option></term>
<listitem>
......@@ -1096,6 +1107,17 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]tcflag</option></term>
<listitem>
<para>
Set [do not set] the TC (TrunCation) bit in the query.
The default is +notcflag. This bit should be ignored
by the server for QUERY.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>+[no]tcp</option></term>
<listitem>
......
......@@ -655,6 +655,8 @@ make_empty_lookup(void) {
looknew->aaonly = ISC_FALSE;
looknew->adflag = ISC_FALSE;
looknew->cdflag = ISC_FALSE;
looknew->raflag = ISC_FALSE;
looknew->tcflag = ISC_FALSE;
looknew->print_unknown_format = ISC_FALSE;
looknew->zflag = ISC_FALSE;
looknew->ns_search_only = ISC_FALSE;
......@@ -797,6 +799,8 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
looknew->aaonly = lookold->aaonly;
looknew->adflag = lookold->adflag;
looknew->cdflag = lookold->cdflag;
looknew->raflag = lookold->raflag;
looknew->tcflag = lookold->tcflag;
looknew->print_unknown_format = lookold->print_unknown_format;
looknew->zflag = lookold->zflag;
looknew->ns_search_only = lookold->ns_search_only;
......@@ -2235,6 +2239,16 @@ setup_lookup(dig_lookup_t *lookup) {
lookup->sendmsg->flags |= DNS_MESSAGEFLAG_CD;
}
if (lookup->raflag) {
debug("RA query");
lookup->sendmsg->flags |= DNS_MESSAGEFLAG_RA;
}
if (lookup->tcflag) {
debug("TC query");
lookup->sendmsg->flags |= DNS_MESSAGEFLAG_TC;
}
if (lookup->zflag) {
debug("Z query");
lookup->sendmsg->flags |= 0x0040U;
......
......@@ -94,6 +94,8 @@ struct dig_lookup {
aaonly,
adflag,
cdflag,
raflag,
tcflag,
zflag,
trace, /*% dig +trace */
trace_root, /*% initial query for either +trace or +nssearch */
......
......@@ -140,6 +140,7 @@ if [ -x ${DIG} ] ; then
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "checking dig +header-only works ($n)"
ret=0
$DIG $DIGOPTS +tcp @10.53.0.3 +header-only example > dig.out.test$n || ret=1
......@@ -148,6 +149,24 @@ if [ -x ${DIG} ] ; then
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "checking dig +raflag works ($n)"
ret=0
$DIG $DIGOPTS +tcp @10.53.0.3 +raflag +qr example > dig.out.test$n || ret=1
grep "^;; flags: rd ra ad; QUERY: 1, ANSWER: 0," < dig.out.test$n > /dev/null || ret=1
grep "^;; flags: qr rd ra; QUERY: 1, ANSWER: 0," < dig.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 dig +tcflag works ($n)"
ret=0
$DIG $DIGOPTS +tcp @10.53.0.3 +tcflag +qr example > dig.out.test$n || ret=1
grep "^;; flags: tc rd ad; QUERY: 1, ANSWER: 0" < dig.out.test$n > /dev/null || ret=1
grep "^;; flags: qr rd ra; QUERY: 1, ANSWER: 0," < dig.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 dig +header-only works (with class and type set) ($n)"
ret=0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment