dig.c revision 8f56f93547c0be53351ba2bf096e5c82de4dae25
ddad35552931651426ad70912d29d9ab7d2a8d80Automatic Updater * Copyright (C) 2000 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * Permission to use, copy, modify, and distribute this software for any
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater * purpose with or without fee is hereby granted, provided that the above
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff * copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
321b1c0501d6d97c852ae02e13bdfef6f0bbe776Automatic Updater/* $Id: dig.c,v 1.64 2000/07/13 21:00:58 mws Exp $ */
e21d199dca95aff5d50f133d6b064309e209af00Brian Wellington#define ADD_STRING(b, s) { \
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff if (strlen(s) >= isc_buffer_availablelength(b)) \
ca9739800f045cd4d39014f98b920d4354b5bd14Michael Graffextern isc_boolean_t have_ipv6, show_details, specified_source,
a7c76f1924d5fc914c579fd3b0276ffbddd2f65aMark Andrewsextern unsigned int timeout;
ca9739800f045cd4d39014f98b920d4354b5bd14Michael Graffisc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE;
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austeinstatic const char *opcodetext[] = {
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "RESERVED6",
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "RESERVED7",
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉static const char *rcodetext[] = {
ca9739800f045cd4d39014f98b920d4354b5bd14Michael Graff "RESERVED11",
ca9739800f045cd4d39014f98b920d4354b5bd14Michael Graff "RESERVED12",
ca9739800f045cd4d39014f98b920d4354b5bd14Michael Graff "RESERVED13",
ca9739800f045cd4d39014f98b920d4354b5bd14Michael Graff "RESERVED14",
ca9739800f045cd4d39014f98b920d4354b5bd14Michael Graff "RESERVED15",
a8dcebd0419f27234664e89b9cd48bc54cad08a7Michael Graff"Usage: dig [@global-server] [domain] [q-type] [q-class] {q-opt}\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" {global-d-opt} host [@local-server] {local-d-opt}\n"
ab0e5066083abcbec62513a3cc041d1f1eb9098aMichael Graff" [ host [@local-server] {local-d-opt} [...]]\n"
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff"Where: domain are in the Domain Name System\n"
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff" q-class is one of (in,chaos,...) [default: in]\n"
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff" q-type is one of (a,any,mx,ns,soa,hinfo,axfr,txt,...) [default:a]\n"
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff" (Use ixfr=version for type ixfr)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" q-opt is one of:\n"
ab0e5066083abcbec62513a3cc041d1f1eb9098aMichael Graff" -x dot-notation (shortcut for in-addr lookups)\n"
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff" -f filename (batch mode)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" -p port (specify port number)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" -t type (specify query type)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" -c class (specify query class)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" -y name:key (specify named base64 tsig key)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" d-opt is of the form +keyword[=value], where keyword is:\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]vc (TCP mode)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]tcp (TCP mode, alternate syntax)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +time=### (Set query timeout) [5]\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +tries=### (Set number of UDP attempts) [3]\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +domain=### (Set default domainname)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +bufsize=### (Set EDNS0 Max UDP packet size)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]search (Set whether to use searchlist)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]defname (Set whether to use default domain)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]recursive (Recursive mode)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]adflag (Set AD flag in query)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]cdflag (Set CD flag in query)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]details (Show details of all requests)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +ndots=### (Set NDOTS value)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]comments (Control display of comment lines)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]question (Control display of question)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]answer (Control display of answer)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]authority (Control display of authority)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]additional (Control display of additional)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]short (Disable everything except short\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" form of answer)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]all (Set or clear all display flags)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +qr (Print question before sending)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]cdflag (Set or clear CD flag in query)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]adflag (Set or clear AD flag in query)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]nssearch (Search all authorative nameservers)\n"
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉" +[no]identify (ID responders in short answers)\n"
83f8c56f43852bf9a9c6964eae285284b23f9d8dMichael Graff" +[no]trace (Trace delegation down from root)\n"
ab0e5066083abcbec62513a3cc041d1f1eb9098aMichael Graff" global d-opts and servers (before host name) affect all queries.\n"
607dc8013a8cb34cd03b59292aa1ac01e008c9c1Michael Graff" local d-opts and servers (after host name) affect only that lookup.\n"
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austeinreceived(int bytes, int frmsize, char *frm, dig_query_t *query) {
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein diff = isc_time_microdiff(&now, &query->time_sent);
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 printf(";; Query time: %ld msec\n", (long int)diff/1000);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "be validated");
46993e1d9d18410a5852b7d990338b70b158855cMichael Graff } else if (query->lookup->identify && !short_form) {
46993e1d9d18410a5852b7d990338b70b158855cMichael Graff diff = isc_time_microdiff(&now, &query->time_sent);
f98d6edb191348477c9c5a156003df627d9bc42cBrian Wellington printf(";; Received %u bytes from %.*s(%s) in %d ms\n\n",
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austeintrying(int frmsize, char *frm, dig_lookup_t *lookup) {
a7c76f1924d5fc914c579fd3b0276ffbddd2f65aMark Andrewssay_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 if (query->lookup->trace || query->lookup->ns_search_only) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 result = dns_rdatatype_totext(rdata->type, buf);
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 diff = isc_time_microdiff(&now, &query->time_sent);
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 snprintf(store, 19, " in %d ms.", (int)diff/1000);
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graffshort_answer(dns_message_t *msg, dns_messagetextflag_t flags,
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 result = dns_message_firstname(msg, DNS_SECTION_ANSWER);
a7c76f1924d5fc914c579fd3b0276ffbddd2f65aMark Andrews dns_message_currentname(msg, DNS_SECTION_ANSWER, &name);
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 for (rdataset = ISC_LIST_HEAD(name->list);
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 rdataset = ISC_LIST_NEXT(rdataset, link)) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 loopresult = dns_rdataset_first(rdataset);
46993e1d9d18410a5852b7d990338b70b158855cMichael Graff result = dns_message_nextname(msg, DNS_SECTION_ANSWER);
46993e1d9d18410a5852b7d990338b70b158855cMichael Graffprintmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
20c266cbc999c724e03e6edd437fb4181b92f095Michael Graff debug("printmessage(%s)", headers ? "headers" : "noheaders");
f6579931b38b357013736ce3efc79a34480af5ceBrian Wellington * Exitcode 9 means we timed out, but if we're printing a message,
f6579931b38b357013736ce3efc79a34480af5ceBrian Wellington * we must have recovered. Go ahead and reset it to code 0, and
20c266cbc999c724e03e6edd437fb4181b92f095Michael Graff * call this a success.
46993e1d9d18410a5852b7d990338b70b158855cMichael Graff result = isc_buffer_allocate(mctx, &buf, len);
9317787889b6d2437b2f8e77583b49246f7511feAndreas Gustafsson if (query->lookup->comments && !short_form) {
46993e1d9d18410a5852b7d990338b70b158855cMichael Graff printf(";; ->>HEADER<<- opcode: %s, status: %s, "
20c266cbc999c724e03e6edd437fb4181b92f095Michael Graff opcodetext[msg->opcode], rcodetext[msg->rcode],
76c8294c81fb48b1da6e1fc5b83322a4cedb8e58Andreas Gustafsson if ((msg->flags & DNS_MESSAGEFLAG_QR) != 0) {
f6579931b38b357013736ce3efc79a34480af5ceBrian Wellington if ((msg->flags & DNS_MESSAGEFLAG_RD) != 0) {
f3ca27e9fe307b55e35ea8d7b37351650630e5a3Andreas Gustafsson if ((msg->flags & DNS_MESSAGEFLAG_AD) != 0) {
20c266cbc999c724e03e6edd437fb4181b92f095Michael Graff "AUTHORITY: %u, ADDITIONAL: %u\n",
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 result = dns_message_pseudosectiontotext(msg,
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 "dns_message_pseudosectiontotext");
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 if (query->lookup->section_question && headers) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 result = isc_buffer_allocate(mctx, &buf, len);
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 check_result(result, "dns_message_sectiontotext");
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 result = isc_buffer_allocate(mctx, &buf, len);
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 check_result(result, "dns_message_sectiontotext");
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 result = short_answer(msg, flags, buf, query);
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 result = isc_buffer_allocate(mctx, &buf, len);
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 check_result(result, "dns_message_sectiontotext");
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 result = isc_buffer_allocate(mctx, &buf, len);
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 check_result(result, "dns_message_sectiontotext");
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 * Only print the signature on the first record.
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 result = dns_message_pseudosectiontotext(
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 "dns_message_pseudosectiontotext");
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 result = dns_message_pseudosectiontotext(
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 "dns_message_pseudosectiontotext");
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 if (headers && query->lookup->comments && !short_form)
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 printf("%.*s", (int)isc_buffer_usedlength(buf),
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 * Reorder an argument list so that server names all come at the end.
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 * This is a bit of a hack, to allow batch-mode processing to properly
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * handle the server options.
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 debug("Moving %s to %d", argv[j], j - 1);
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 debug("moving %s to end, %d", ptr, end - 1);
0a9fedafec59fd3ec2eeadc3f123db163e71c0fbMichael Graff * We're not using isc_commandline_parse() here since the command line
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * syntax of dig is quite a bit different from that which can be described
0941f35ad9b4f48a5324af405a730c3cb3e0aad8Michael Graff * that routine. There is a portability issue here.
0941f35ad9b4f48a5324af405a730c3cb3e0aad8Michael Graffparse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * The semantics for parsing the args is a bit complex; if
a7c76f1924d5fc914c579fd3b0276ffbddd2f65aMark Andrews * we don't have a host yet, make the arg apply globally,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * otherwise make it apply to the latest host. This is
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * a bit different than the previous versions, but should
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * form a consistent user interface.
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * First, create a "default lookup" which won't actually be used
a7c76f1924d5fc914c579fd3b0276ffbddd2f65aMark Andrews * anywhere, except for cloning into new lookups
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff sizeof(struct dig_server));
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff strncpy(srv->servername, &rv[0][1], MXNAME-1);
46993e1d9d18410a5852b7d990338b70b158855cMichael Graff } else if (strncmp(rv[0], "+domain=", 8) == 0) {
46993e1d9d18410a5852b7d990338b70b158855cMichael Graff /* Global option always */
f98d6edb191348477c9c5a156003df627d9bc42cBrian Wellington /* Global option always */
46993e1d9d18410a5852b7d990338b70b158855cMichael Graff } else if (strncmp(rv[0], "+nosea", 6) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+defn", 5) == 0) {
46993e1d9d18410a5852b7d990338b70b158855cMichael Graff } else if (strncmp(rv[0], "+nodefn", 7) == 0) {
46993e1d9d18410a5852b7d990338b70b158855cMichael Graff } else if (strncmp(rv[0], "+time=", 6) == 0) {
46993e1d9d18410a5852b7d990338b70b158855cMichael Graff /* Global option always */
ca9739800f045cd4d39014f98b920d4354b5bd14Michael Graff } else if (strncmp(rv[0], "+timeout=", 9) == 0) {
46993e1d9d18410a5852b7d990338b70b158855cMichael Graff /* Global option always */
46993e1d9d18410a5852b7d990338b70b158855cMichael Graff } else if (strncmp(rv[0], "+tries=", 7) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+buf=", 5) == 0) {
35f06ab0e6d5ad26176b7584de7b4d405272ba68Brian Wellington } else if (strncmp(rv[0], "+bufsize=", 9) == 0) {
20c266cbc999c724e03e6edd437fb4181b92f095Michael Graff } else if (strncmp(rv[0], "+ndots=", 7) == 0) {
20c266cbc999c724e03e6edd437fb4181b92f095Michael Graff /* Global option always */
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+rec", 4) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+norec", 6) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+adf", 4) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+noadf", 6) == 0) {
35f06ab0e6d5ad26176b7584de7b4d405272ba68Brian Wellington } else if (strncmp(rv[0], "+nocd", 5) == 0) {
35f06ab0e6d5ad26176b7584de7b4d405272ba68Brian Wellington } else if (strncmp(rv[0], "+ns", 3) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+nons", 6) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+tr", 3) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+notr", 6) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+det", 4) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+nodet", 6) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+cmd", 4) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+nocmd", 6) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+sho", 4) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+nosho", 6) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+id", 3) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+noid", 5) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+com", 4) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+nocom", 6) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+sta", 4) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+nosta", 6) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+qr", 3) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+noqr", 5) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+que", 4) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+noque", 6) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+ans", 4) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+noans", 6) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+add", 4) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+noadd", 6) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+aut", 4) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+noaut", 6) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+all", 4) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "+noall", 6) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "-c", 2) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "-t", 2) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "-f", 2) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "-y", 2) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strncmp(rv[0], "-p", 2) == 0) {
3530e10080e5a7d95c7d13abdc02c1d8bd12ec18Andreas Gustafsson } else if (strncmp(rv[0], "-h", 2) == 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 } else if (strcmp(rv[0], "-memdebug") == 0) {
bd7237e653e15bfb7f202a1c0914271912597ef4Michael Graff * XXXMWS Only works for ipv4 now.
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 * Can't use inet_pton here, since we allow
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff * partial addresses.
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 n = sscanf(rv[1], "%d.%d.%d.%d", &adrs[0], &adrs[1],
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff lookup = clone_lookup(default_lookup, ISC_TRUE);
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff for (i = n - 1; i >= 0; i--) {
ce5bd92088923d1c76e26d313d1d8c0b8bbe38feMichael Graff strncat(lookup->textname, "in-addr.arpa.", MXNAME);
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * If we decide to allow query type and class
6f1422b81ed2c5142092e2ced8e3faf0e61f3ba0Michael Graff * to be specified (without -t and -c options)
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * before a host is given, all that needs to
c6066a8e67f40c7c12925c5634485f55713c06d6Michael Graff * happen is the have_host test here get removed.
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * Nothing should break by doing this.
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff lookup=clone_lookup(default_lookup, ISC_TRUE);
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff while (fgets(batchline, sizeof(batchline), fp) != 0) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 while ((bargv[bargc] != NULL) && (bargc < 14 )) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 parse_args(ISC_TRUE, bargc, (char **)bargv);
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 lookup=clone_lookup(default_lookup, ISC_TRUE);
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 lookup->trace_root = ISC_TF(lookup->trace ||
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 ISC_LIST_APPEND(lookup_list, lookup, link);
8d1943e8ffa991d54c5406342e44d7134762e7eaMichael Graff result = isc_app_onrun(mctx, global_task, onrun_callback, NULL);
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 * XXXMWS This code should really NOT be bypassed. However,
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * until the proper code can be added to handle SIGTERM/INT
1ec39fc7a8b6ad92de3363d4c50b75e24fcd6accMichael Graff * correctly, just exit out "hard" and deal as best we can.