Add ability to set AD and CD flags in outgoing query.

This commit is contained in:
Michael Sawyer
2000-06-16 18:00:05 +00:00
parent 3238566d66
commit 518c9fea58
5 changed files with 54 additions and 8 deletions

View File

@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: dig.c,v 1.43 2000/06/07 00:13:54 mws Exp $ */
/* $Id: dig.c,v 1.44 2000/06/16 17:59:59 mws Exp $ */
#include <config.h>
@@ -81,7 +81,8 @@ isc_boolean_t identify = ISC_FALSE,
comments = ISC_TRUE, section_question = ISC_TRUE,
section_answer = ISC_TRUE, section_authority = ISC_TRUE,
section_additional = ISC_TRUE, recurse = ISC_TRUE,
defname = ISC_TRUE, aaonly = ISC_FALSE, tcpmode = ISC_FALSE;
defname = ISC_TRUE, aaonly = ISC_FALSE, tcpmode = ISC_FALSE,
adflag = ISC_FALSE, cdflag = ISC_FALSE;
static const char *opcodetext[] = {
@@ -164,10 +165,10 @@ show_usage(void) {
" +[no]short (Disable everything except short\n"
" form of answer)\n"
" +qr (Print question before sending)\n"
" Additional d-opts subject to removal before release:\n"
" +[no]cd (Set or clear CD flag in query)\n"
" +[no]ad (Set or clear AD flag in query)\n"
" +[no]nssearch (Search all authorative nameservers)\n"
" +[no]identify (ID responders in short answers)\n"
" Available but not yet completed:\n"
" +[no]trace (Trace delegation down from root)\n"
" global d-opts and servers (before host name) affect all queries.\n"
" local d-opts and servers (after host name) affect only that lookup.\n"
@@ -667,6 +668,26 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
lookup->aaonly = ISC_FALSE;
else
aaonly = ISC_FALSE;
} else if (strncmp(rv[0], "+ad", 3) == 0) {
if (have_host)
lookup->adflag = ISC_TRUE;
else
adflag = ISC_TRUE;
} else if (strncmp(rv[0], "+noad", 5) == 0) {
if (have_host)
lookup->adflag = ISC_FALSE;
else
adflag = ISC_FALSE;
} else if (strncmp(rv[0], "+cd", 3) == 0) {
if (have_host)
lookup->cdflag = ISC_TRUE;
else
cdflag = ISC_TRUE;
} else if (strncmp(rv[0], "+nocd", 5) == 0) {
if (have_host)
lookup->cdflag = ISC_FALSE;
else
cdflag = ISC_FALSE;
} else if (strncmp(rv[0], "+ns", 3) == 0) {
if (have_host) {
lookup->ns_search_only = ISC_TRUE;
@@ -996,6 +1017,8 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
lookup->identify = identify;
lookup->recurse = recurse;
lookup->aaonly = aaonly;
lookup->adflag = adflag;
lookup->cdflag = cdflag;
lookup->retries = tries;
lookup->udpsize = bufsize;
lookup->nsfound = 0;
@@ -1059,6 +1082,8 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
lookup->identify = identify;
lookup->recurse = recurse;
lookup->aaonly = aaonly;
lookup->adflag = adflag;
lookup->cdflag = cdflag;
lookup->retries = tries;
lookup->udpsize = bufsize;
lookup->nsfound = 0;
@@ -1134,6 +1159,8 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
lookup->identify = identify;
lookup->recurse = recurse;
lookup->aaonly = aaonly;
lookup->adflag = adflag;
lookup->cdflag = cdflag;
lookup->retries = tries;
lookup->udpsize = bufsize;
lookup->nsfound = 0;

View File

@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: dighost.c,v 1.52 2000/06/15 22:08:44 mws Exp $ */
/* $Id: dighost.c,v 1.53 2000/06/16 18:00:00 mws Exp $ */
/*
* Notice to programmers: Do not use this code as an example of how to
@@ -289,6 +289,8 @@ dig_lookup_t
looknew->udpsize = lookold->udpsize;
looknew->recurse = lookold->recurse;
looknew->aaonly = lookold->aaonly;
looknew->adflag = lookold->adflag;
looknew->cdflag = lookold->cdflag;
looknew->ns_search_only = lookold->ns_search_only;
looknew->origin = NULL;
looknew->querysig = NULL;
@@ -1047,6 +1049,16 @@ setup_lookup(dig_lookup_t *lookup) {
lookup->sendmsg->flags |= DNS_MESSAGEFLAG_AA;
}
if (lookup->adflag) {
debug ("AD query");
lookup->sendmsg->flags |= DNS_MESSAGEFLAG_AD;
}
if (lookup->cdflag) {
debug ("CD query");
lookup->sendmsg->flags |= DNS_MESSAGEFLAG_CD;
}
dns_message_addname(lookup->sendmsg, lookup->name,
DNS_SECTION_QUESTION);

View File

@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: host.c,v 1.25 2000/06/06 23:06:24 mws Exp $ */
/* $Id: host.c,v 1.26 2000/06/16 18:00:01 mws Exp $ */
#include <config.h>
@@ -673,6 +673,9 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
lookup->trace_root = ISC_FALSE;
lookup->tcp_mode = tcpmode;
lookup->new_search = ISC_TRUE;
lookup->aaonly = ISC_FALSE;
lookup->adflag = ISC_FALSE;
lookup->cdflag = ISC_FALSE;
ISC_LIST_INIT(lookup->q);
ISC_LIST_APPEND(lookup_list, lookup, link);
lookup->origin = NULL;

View File

@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: dig.h,v 1.22 2000/06/07 00:13:57 mws Exp $ */
/* $Id: dig.h,v 1.23 2000/06/16 18:00:05 mws Exp $ */
#ifndef DIG_H
#define DIG_H
@@ -69,6 +69,8 @@ struct dig_lookup {
identify,
recurse,
aaonly,
adflag,
cdflag,
trace,
trace_root,
defname,

View File

@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: nslookup.c,v 1.15 2000/06/15 18:24:08 mws Exp $ */
/* $Id: nslookup.c,v 1.16 2000/06/16 18:00:03 mws Exp $ */
#include <config.h>
@@ -656,6 +656,8 @@ addlookup(char *opt) {
lookup->identify = identify;
lookup->recurse = recurse;
lookup->aaonly = aaonly;
lookup->adflag = ISC_FALSE;
lookup->cdflag = ISC_FALSE;
lookup->retries = tries;
lookup->udpsize = bufsize;
lookup->nsfound = 0;