2000-04-26 18:34:17 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2000 Internet Software Consortium.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
|
|
|
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
|
|
|
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
|
|
|
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
|
|
|
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
|
|
* SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2000-05-08 22:51:08 +00:00
|
|
|
/*
|
|
|
|
* Notice to programmers: Do not use this code as an example of how to
|
|
|
|
* use the ISC library to perform DNS lookups. Dig and Host both operate
|
|
|
|
* on the request level, since they allow fine-tuning of output and are
|
|
|
|
* intended as debugging tools. As a result, they perform many of the
|
|
|
|
* functions which could be better handled using the dns_resolver
|
|
|
|
* functions in most applications.
|
|
|
|
*/
|
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
extern int h_errno;
|
|
|
|
|
|
|
|
#include <isc/app.h>
|
|
|
|
#include <isc/netdb.h>
|
2000-05-08 14:38:29 +00:00
|
|
|
#include <isc/string.h>
|
2000-04-26 18:34:17 +00:00
|
|
|
#include <isc/task.h>
|
|
|
|
#include <isc/timer.h>
|
|
|
|
#include <isc/util.h>
|
|
|
|
|
|
|
|
#include <dns/message.h>
|
|
|
|
#include <dns/rdata.h>
|
|
|
|
#include <dns/rdataclass.h>
|
2000-05-08 14:38:29 +00:00
|
|
|
#include <dns/rdataset.h>
|
2000-04-26 18:34:17 +00:00
|
|
|
#include <dns/rdatatype.h>
|
2000-05-08 22:51:08 +00:00
|
|
|
#include <dns/rdatalist.h>
|
2000-04-26 18:34:17 +00:00
|
|
|
#include <dns/result.h>
|
|
|
|
|
|
|
|
#include <dig/dig.h>
|
|
|
|
|
|
|
|
ISC_LIST(dig_lookup_t) lookup_list;
|
|
|
|
ISC_LIST(dig_server_t) server_list;
|
2000-05-02 23:23:12 +00:00
|
|
|
ISC_LIST(dig_searchlist_t) search_list;
|
2000-04-26 18:34:17 +00:00
|
|
|
|
2000-05-19 17:54:04 +00:00
|
|
|
isc_boolean_t have_ipv6 = ISC_FALSE, specified_source = ISC_FALSE,
|
2000-05-08 22:51:08 +00:00
|
|
|
free_now = ISC_FALSE, show_details = ISC_FALSE, usesearch=ISC_TRUE,
|
|
|
|
qr = ISC_FALSE;
|
2000-04-29 01:39:32 +00:00
|
|
|
#ifdef TWIDDLE
|
|
|
|
isc_boolean_t twiddle = ISC_FALSE;
|
|
|
|
#endif
|
2000-05-03 20:27:13 +00:00
|
|
|
in_port_t port = 53;
|
|
|
|
unsigned int timeout = 5;
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_mem_t *mctx = NULL;
|
|
|
|
isc_taskmgr_t *taskmgr = NULL;
|
2000-05-26 22:03:00 +00:00
|
|
|
isc_task_t *global_task = NULL;
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_timermgr_t *timermgr = NULL;
|
|
|
|
isc_socketmgr_t *socketmgr = NULL;
|
2000-05-19 17:54:04 +00:00
|
|
|
isc_sockaddr_t bind_address;
|
2000-04-26 18:34:17 +00:00
|
|
|
char *rootspace[BUFSIZE];
|
|
|
|
isc_buffer_t rootbuf;
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
int sendcount = 0;
|
2000-05-24 23:39:30 +00:00
|
|
|
int sockcount = 0;
|
2000-05-02 23:23:12 +00:00
|
|
|
int ndots = -1;
|
2000-05-03 20:27:13 +00:00
|
|
|
int tries = 3;
|
2000-05-06 01:16:07 +00:00
|
|
|
int lookup_counter = 0;
|
2000-05-03 20:27:13 +00:00
|
|
|
char fixeddomain[MXNAME]="";
|
2000-05-08 22:51:08 +00:00
|
|
|
int exitcode = 9;
|
2000-04-26 18:34:17 +00:00
|
|
|
|
2000-05-12 01:02:37 +00:00
|
|
|
static void
|
|
|
|
cancel_lookup(dig_lookup_t *lookup);
|
|
|
|
|
2000-05-02 23:23:12 +00:00
|
|
|
static int
|
|
|
|
count_dots(char *string) {
|
|
|
|
char *s;
|
|
|
|
int i=0;
|
|
|
|
|
|
|
|
s = string;
|
|
|
|
while (*s != 0) {
|
|
|
|
if (*s == '.')
|
|
|
|
i++;
|
|
|
|
s++;
|
|
|
|
}
|
|
|
|
return (i);
|
|
|
|
}
|
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
static void
|
2000-04-26 19:36:40 +00:00
|
|
|
hex_dump(isc_buffer_t *b) {
|
2000-04-26 18:34:17 +00:00
|
|
|
unsigned int len;
|
|
|
|
isc_region_t r;
|
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_buffer_remainingregion(b, &r);
|
2000-04-26 18:34:17 +00:00
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
printf("Printing a buffer with length %d\n", r.length);
|
2000-04-26 18:34:17 +00:00
|
|
|
for (len = 0 ; len < r.length ; len++) {
|
|
|
|
printf("%02x ", r.base[len]);
|
|
|
|
if (len != 0 && len % 16 == 0)
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
if (len % 16 != 0)
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
fatal(char *format, ...) {
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start(args, format);
|
|
|
|
vfprintf(stderr, format, args);
|
|
|
|
va_end(args);
|
|
|
|
fprintf(stderr, "\n");
|
2000-05-09 18:05:13 +00:00
|
|
|
if (exitcode == 0)
|
|
|
|
exitcode = 8;
|
2000-05-02 23:23:12 +00:00
|
|
|
#ifdef NEVER
|
2000-05-12 01:02:37 +00:00
|
|
|
dighost_shutdown();
|
2000-05-09 18:05:13 +00:00
|
|
|
free_lists(exitcode);
|
2000-05-02 23:23:12 +00:00
|
|
|
if (mctx != NULL) {
|
|
|
|
#ifdef MEMDEBUG
|
2000-05-03 23:07:30 +00:00
|
|
|
isc_mem_stats(mctx, stderr);
|
2000-05-02 23:23:12 +00:00
|
|
|
#endif
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_mem_destroy(&mctx);
|
2000-05-02 23:23:12 +00:00
|
|
|
}
|
|
|
|
#endif
|
2000-05-08 22:51:08 +00:00
|
|
|
exit(exitcode);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
void
|
|
|
|
debug(char *format, ...) {
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start(args, format);
|
|
|
|
vfprintf(stderr, format, args);
|
|
|
|
va_end(args);
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
void
|
|
|
|
debug(char *format, ...) {
|
|
|
|
UNUSED(format);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2000-05-05 18:22:16 +00:00
|
|
|
void
|
2000-04-26 18:34:17 +00:00
|
|
|
check_result(isc_result_t result, char *msg) {
|
2000-05-08 22:51:08 +00:00
|
|
|
if (result != ISC_R_SUCCESS) {
|
|
|
|
exitcode = 1;
|
2000-04-26 18:34:17 +00:00
|
|
|
fatal("%s: %s", msg, isc_result_totext(result));
|
2000-05-08 22:51:08 +00:00
|
|
|
}
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
isc_boolean_t
|
|
|
|
isclass(char *text) {
|
|
|
|
/* Tests if a field is a class, without needing isc libs
|
2000-05-03 23:07:30 +00:00
|
|
|
* initialized. This list will have to be manually kept in
|
|
|
|
* sync with what the libs support.
|
|
|
|
*/
|
2000-05-24 17:26:01 +00:00
|
|
|
const char *classlist[] = {"in", "hs", "chaos"};
|
|
|
|
const int numclasses = 3;
|
2000-04-26 18:34:17 +00:00
|
|
|
int i;
|
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
for (i = 0; i < numclasses; i++)
|
2000-04-26 18:34:17 +00:00
|
|
|
if (strcasecmp(text, classlist[i]) == 0)
|
|
|
|
return ISC_TRUE;
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
return ISC_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
isc_boolean_t
|
|
|
|
istype(char *text) {
|
|
|
|
/* Tests if a field is a type, without needing isc libs
|
2000-05-03 23:07:30 +00:00
|
|
|
* initialized. This list will have to be manually kept in
|
|
|
|
* sync with what the libs support.
|
|
|
|
*/
|
2000-04-26 18:34:17 +00:00
|
|
|
const char *typelist[] = {"a", "ns", "md", "mf", "cname",
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
"soa", "mb", "mg", "mr", "null",
|
|
|
|
"wks", "ptr", "hinfo", "minfo",
|
|
|
|
"mx", "txt", "rp", "afsdb",
|
|
|
|
"x25", "isdn", "rt", "nsap",
|
|
|
|
"nsap_ptr", "sig", "key", "px",
|
|
|
|
"gpos", "aaaa", "loc", "nxt",
|
|
|
|
"srv", "naptr", "kx", "cert",
|
|
|
|
"a6", "dname", "opt", "unspec",
|
2000-05-06 01:16:07 +00:00
|
|
|
"tkey", "tsig", "axfr", "any"};
|
|
|
|
const int numtypes = 42;
|
2000-04-26 18:34:17 +00:00
|
|
|
int i;
|
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
for (i = 0; i < numtypes; i++) {
|
2000-04-26 18:34:17 +00:00
|
|
|
if (strcasecmp(text, typelist[i]) == 0)
|
|
|
|
return ISC_TRUE;
|
|
|
|
}
|
|
|
|
return ISC_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-29 01:39:32 +00:00
|
|
|
#ifdef TWIDDLE
|
|
|
|
void
|
|
|
|
twiddlebuf(isc_buffer_t buf) {
|
|
|
|
isc_region_t r;
|
|
|
|
int len, pos, bit;
|
|
|
|
unsigned char bitfield;
|
|
|
|
int i, tw;
|
|
|
|
|
|
|
|
hex_dump(&buf);
|
|
|
|
tw=TWIDDLE;
|
2000-05-03 23:07:30 +00:00
|
|
|
printf ("Twiddling %d bits: ", tw);
|
2000-04-29 01:39:32 +00:00
|
|
|
for (i=0;i<tw;i++) {
|
|
|
|
isc_buffer_usedregion (&buf, &r);
|
|
|
|
len = r.length;
|
|
|
|
pos=(int)random();
|
|
|
|
pos = pos%len;
|
|
|
|
bit = (int)random()%8;
|
|
|
|
bitfield = 1 << bit;
|
2000-05-03 23:07:30 +00:00
|
|
|
printf ("%d@%03x ", bit, pos);
|
2000-04-29 01:39:32 +00:00
|
|
|
r.base[pos] ^= bitfield;
|
|
|
|
}
|
|
|
|
puts ("");
|
|
|
|
hex_dump(&buf);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2000-05-12 01:02:37 +00:00
|
|
|
dig_lookup_t
|
|
|
|
*requeue_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
|
|
|
|
dig_lookup_t *looknew;
|
|
|
|
dig_server_t *s, *srv;
|
|
|
|
|
|
|
|
debug("requeue_lookup()");
|
|
|
|
|
2000-05-22 22:56:31 +00:00
|
|
|
if (free_now)
|
|
|
|
return(ISC_R_SUCCESS);
|
|
|
|
|
2000-05-12 01:02:37 +00:00
|
|
|
lookup_counter++;
|
|
|
|
if (lookup_counter > LOOKUP_LIMIT)
|
|
|
|
fatal ("Too many lookups.");
|
|
|
|
looknew = isc_mem_allocate
|
|
|
|
(mctx, sizeof(struct dig_lookup));
|
|
|
|
if (looknew == NULL)
|
|
|
|
fatal ("Memory allocation failure in %s:%d",
|
|
|
|
__FILE__, __LINE__);
|
|
|
|
looknew->pending = ISC_FALSE;
|
|
|
|
strncpy (looknew->textname, lookold-> textname, MXNAME);
|
|
|
|
strncpy (looknew->rttext, lookold-> rttext, 32);
|
|
|
|
strncpy (looknew->rctext, lookold-> rctext, 32);
|
|
|
|
looknew->namespace[0]=0;
|
|
|
|
looknew->sendspace[0]=0;
|
|
|
|
looknew->sendmsg=NULL;
|
|
|
|
looknew->name=NULL;
|
|
|
|
looknew->oname=NULL;
|
|
|
|
looknew->timer = NULL;
|
|
|
|
looknew->xfr_q = NULL;
|
|
|
|
looknew->doing_xfr = lookold->doing_xfr;
|
|
|
|
looknew->defname = lookold->defname;
|
|
|
|
looknew->trace = lookold->trace;
|
|
|
|
looknew->trace_root = lookold->trace_root;
|
|
|
|
looknew->identify = lookold->identify;
|
|
|
|
looknew->udpsize = lookold->udpsize;
|
|
|
|
looknew->recurse = lookold->recurse;
|
|
|
|
looknew->aaonly = lookold->aaonly;
|
|
|
|
looknew->ns_search_only = lookold->ns_search_only;
|
|
|
|
looknew->origin = NULL;
|
|
|
|
looknew->retries = tries;
|
|
|
|
looknew->nsfound = 0;
|
|
|
|
looknew->tcp_mode = lookold->tcp_mode;
|
|
|
|
looknew->comments = lookold->comments;
|
|
|
|
looknew->stats = lookold->stats;
|
|
|
|
looknew->section_question = lookold->section_question;
|
|
|
|
looknew->section_answer = lookold->section_answer;
|
|
|
|
looknew->section_authority = lookold->section_authority;
|
|
|
|
looknew->section_additional = lookold->section_additional;
|
2000-05-24 19:49:51 +00:00
|
|
|
looknew->new_search = ISC_FALSE;
|
2000-05-12 01:02:37 +00:00
|
|
|
ISC_LIST_INIT(looknew->my_server_list);
|
|
|
|
ISC_LIST_INIT(looknew->q);
|
|
|
|
|
|
|
|
looknew->use_my_server_list = ISC_FALSE;
|
|
|
|
if (servers) {
|
|
|
|
looknew->use_my_server_list = lookold->use_my_server_list;
|
|
|
|
if (looknew->use_my_server_list) {
|
|
|
|
s = ISC_LIST_HEAD(lookold->my_server_list);
|
|
|
|
while (s != NULL) {
|
|
|
|
srv = isc_mem_allocate (mctx, sizeof(struct
|
|
|
|
dig_server));
|
|
|
|
if (srv == NULL)
|
|
|
|
fatal("Memory allocation failure "
|
|
|
|
"in %s:%d", __FILE__, __LINE__);
|
|
|
|
strncpy(srv->servername, s->servername,
|
|
|
|
MXNAME);
|
|
|
|
ISC_LIST_ENQUEUE(looknew->my_server_list, srv,
|
|
|
|
link);
|
|
|
|
s = ISC_LIST_NEXT(s, link);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-05-12 18:45:38 +00:00
|
|
|
debug ("Before insertion, init@%lx "
|
|
|
|
"-> %lx, new@%lx "
|
|
|
|
"-> %lx", (long int)lookold,
|
2000-05-12 01:02:37 +00:00
|
|
|
(long int)lookold->link.next,
|
|
|
|
(long int)looknew, (long int)looknew->
|
|
|
|
link.next);
|
|
|
|
ISC_LIST_INSERTAFTER(lookup_list, lookold, looknew, link);
|
|
|
|
debug ("After insertion, init -> "
|
2000-05-12 18:45:38 +00:00
|
|
|
"%lx, new = %lx, "
|
|
|
|
"new -> %lx", (long int)lookold,
|
2000-05-12 01:02:37 +00:00
|
|
|
(long int)looknew, (long int)looknew->
|
|
|
|
link.next);
|
|
|
|
return (looknew);
|
|
|
|
}
|
|
|
|
|
2000-05-09 18:05:13 +00:00
|
|
|
void
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
setup_system(void) {
|
2000-04-26 18:34:17 +00:00
|
|
|
char rcinput[MXNAME];
|
|
|
|
FILE *fp;
|
|
|
|
char *ptr;
|
|
|
|
dig_server_t *srv;
|
2000-05-02 23:23:12 +00:00
|
|
|
dig_searchlist_t *search;
|
|
|
|
dig_lookup_t *l;
|
|
|
|
isc_boolean_t get_servers;
|
2000-04-26 18:34:17 +00:00
|
|
|
|
2000-05-03 20:27:13 +00:00
|
|
|
|
|
|
|
if (fixeddomain[0]!=0) {
|
|
|
|
search = isc_mem_allocate( mctx, sizeof(struct dig_server));
|
|
|
|
if (search == NULL)
|
2000-05-06 01:16:07 +00:00
|
|
|
fatal("Memory allocation failure in %s:%d",
|
|
|
|
__FILE__, __LINE__);
|
2000-05-03 20:27:13 +00:00
|
|
|
strncpy(search->origin, fixeddomain, MXNAME - 1);
|
|
|
|
ISC_LIST_PREPEND(search_list, search, link);
|
|
|
|
}
|
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
debug ("setup_system()");
|
2000-05-09 18:05:13 +00:00
|
|
|
|
|
|
|
free_now = ISC_FALSE;
|
2000-05-24 03:10:24 +00:00
|
|
|
get_servers = ISC_TF(server_list.head == NULL);
|
2000-05-02 23:23:12 +00:00
|
|
|
fp = fopen (RESOLVCONF, "r");
|
|
|
|
if (fp != NULL) {
|
|
|
|
while (fgets(rcinput, MXNAME, fp) != 0) {
|
|
|
|
ptr = strtok (rcinput, " \t\r\n");
|
|
|
|
if (ptr != NULL) {
|
|
|
|
if (get_servers &&
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
strcasecmp(ptr, "nameserver") == 0) {
|
2000-05-02 23:23:12 +00:00
|
|
|
debug ("Got a nameserver line");
|
|
|
|
ptr = strtok (NULL, " \t\r\n");
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
if (ptr != NULL) {
|
|
|
|
srv = isc_mem_allocate(mctx,
|
2000-05-02 23:23:12 +00:00
|
|
|
sizeof(struct dig_server));
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
if (srv == NULL)
|
|
|
|
fatal("Memory "
|
|
|
|
"allocation "
|
2000-05-06 01:16:07 +00:00
|
|
|
"failure in "
|
|
|
|
"%s:%d",
|
|
|
|
__FILE__,
|
|
|
|
__LINE__);
|
2000-05-03 18:25:52 +00:00
|
|
|
strncpy((char *)srv->
|
2000-04-26 19:36:40 +00:00
|
|
|
servername,
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
ptr,
|
|
|
|
MXNAME - 1);
|
2000-04-26 19:36:40 +00:00
|
|
|
ISC_LIST_APPEND
|
|
|
|
(server_list,
|
|
|
|
srv, link);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
2000-05-03 23:07:30 +00:00
|
|
|
} else if (strcasecmp(ptr, "options") == 0) {
|
2000-05-02 23:23:12 +00:00
|
|
|
ptr = strtok(NULL, " \t\r\n");
|
|
|
|
if (ptr != NULL) {
|
|
|
|
if ((strncasecmp(ptr, "ndots:",
|
|
|
|
6) == 0) &&
|
|
|
|
(ndots == -1)) {
|
|
|
|
ndots = atoi(
|
|
|
|
&ptr[6]);
|
|
|
|
debug ("ndots is "
|
|
|
|
"%d.",
|
|
|
|
ndots);
|
|
|
|
}
|
|
|
|
}
|
2000-05-03 23:07:30 +00:00
|
|
|
} else if ((strcasecmp(ptr, "search") == 0)
|
2000-05-03 20:27:13 +00:00
|
|
|
&& usesearch){
|
2000-05-02 23:23:12 +00:00
|
|
|
while ((ptr = strtok(NULL, " \t\r\n"))
|
|
|
|
!= NULL) {
|
|
|
|
search = isc_mem_allocate(
|
|
|
|
mctx, sizeof(struct
|
|
|
|
dig_server));
|
|
|
|
if (search == NULL)
|
|
|
|
fatal("Memory "
|
|
|
|
"allocation "
|
2000-05-06 01:16:07 +00:00
|
|
|
"failure in %s:"
|
|
|
|
"%d", __FILE__,
|
|
|
|
__LINE__);
|
2000-05-02 23:23:12 +00:00
|
|
|
strncpy(search->
|
|
|
|
origin,
|
|
|
|
ptr,
|
|
|
|
MXNAME - 1);
|
|
|
|
ISC_LIST_APPEND
|
|
|
|
(search_list,
|
|
|
|
search,
|
|
|
|
link);
|
|
|
|
}
|
2000-05-03 23:07:30 +00:00
|
|
|
} else if ((strcasecmp(ptr, "domain") == 0) &&
|
2000-05-03 20:27:13 +00:00
|
|
|
(fixeddomain[0] == 0 )){
|
|
|
|
while ((ptr = strtok(NULL, " \t\r\n"))
|
|
|
|
!= NULL) {
|
|
|
|
search = isc_mem_allocate(
|
|
|
|
mctx, sizeof(struct
|
|
|
|
dig_server));
|
|
|
|
if (search == NULL)
|
|
|
|
fatal("Memory "
|
|
|
|
"allocation "
|
2000-05-06 01:16:07 +00:00
|
|
|
"failure in %s:"
|
|
|
|
"%d", __FILE__,
|
|
|
|
__LINE__);
|
2000-05-03 20:27:13 +00:00
|
|
|
strncpy(search->
|
|
|
|
origin,
|
|
|
|
ptr,
|
|
|
|
MXNAME - 1);
|
|
|
|
ISC_LIST_PREPEND
|
|
|
|
(search_list,
|
|
|
|
search,
|
|
|
|
link);
|
|
|
|
}
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
2000-05-02 23:23:12 +00:00
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
}
|
2000-05-02 23:23:12 +00:00
|
|
|
fclose (fp);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
|
2000-05-02 23:23:12 +00:00
|
|
|
if (ndots == -1)
|
|
|
|
ndots = 1;
|
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
if (server_list.head == NULL) {
|
|
|
|
srv = isc_mem_allocate(mctx, sizeof(dig_server_t));
|
|
|
|
if (srv == NULL)
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
fatal("Memory allocation failure");
|
|
|
|
strcpy(srv->servername, "127.0.0.1");
|
2000-04-26 18:34:17 +00:00
|
|
|
ISC_LIST_APPEND(server_list, srv, link);
|
|
|
|
}
|
2000-05-02 23:23:12 +00:00
|
|
|
|
|
|
|
for (l = ISC_LIST_HEAD(lookup_list) ;
|
|
|
|
l != NULL;
|
|
|
|
l = ISC_LIST_NEXT(l, link) ) {
|
|
|
|
l -> origin = ISC_LIST_HEAD(search_list);
|
|
|
|
}
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
|
2000-05-09 18:05:13 +00:00
|
|
|
void
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
setup_libs(void) {
|
2000-04-26 18:34:17 +00:00
|
|
|
isc_result_t result;
|
|
|
|
isc_buffer_t b;
|
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
debug ("setup_libs()");
|
2000-05-12 01:02:37 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Warning: This is not particularly good randomness. We'll
|
|
|
|
* just use random() now for getting id values, but doing so
|
|
|
|
* does NOT insure that id's cann't be guessed.
|
|
|
|
*/
|
|
|
|
srandom (getpid() + (int)&setup_libs);
|
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
result = isc_app_start();
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "isc_app_start");
|
2000-04-26 18:34:17 +00:00
|
|
|
|
|
|
|
result = isc_net_probeipv4();
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "isc_net_probeipv4");
|
2000-04-26 18:34:17 +00:00
|
|
|
|
|
|
|
result = isc_net_probeipv6();
|
|
|
|
if (result == ISC_R_SUCCESS)
|
|
|
|
have_ipv6=ISC_TRUE;
|
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
result = isc_mem_create(0, 0, &mctx);
|
|
|
|
check_result(result, "isc_mem_create");
|
2000-04-26 18:34:17 +00:00
|
|
|
|
|
|
|
result = isc_taskmgr_create (mctx, 1, 0, &taskmgr);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "isc_taskmgr_create");
|
2000-04-26 18:34:17 +00:00
|
|
|
|
2000-05-26 22:03:00 +00:00
|
|
|
result = isc_task_create (taskmgr, 0, &global_task);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "isc_task_create");
|
2000-04-26 18:34:17 +00:00
|
|
|
|
|
|
|
result = isc_timermgr_create (mctx, &timermgr);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "isc_timermgr_create");
|
2000-04-26 18:34:17 +00:00
|
|
|
|
|
|
|
result = isc_socketmgr_create (mctx, &socketmgr);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "isc_socketmgr_create");
|
|
|
|
isc_buffer_init(&b, ".", 1);
|
|
|
|
isc_buffer_add(&b, 1);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
|
2000-05-08 22:51:08 +00:00
|
|
|
static void
|
|
|
|
add_opt (dns_message_t *msg, isc_uint16_t udpsize) {
|
|
|
|
dns_rdataset_t *rdataset = NULL;
|
|
|
|
dns_rdatalist_t *rdatalist = NULL;
|
|
|
|
dns_rdata_t *rdata = NULL;
|
|
|
|
isc_result_t result;
|
|
|
|
|
2000-05-12 18:45:38 +00:00
|
|
|
debug ("add_opt()");
|
2000-05-08 22:51:08 +00:00
|
|
|
result = dns_message_gettemprdataset(msg, &rdataset);
|
|
|
|
check_result (result, "dns_message_gettemprdataset");
|
|
|
|
dns_rdataset_init (rdataset);
|
|
|
|
result = dns_message_gettemprdatalist(msg, &rdatalist);
|
|
|
|
check_result (result, "dns_message_gettemprdatalist");
|
|
|
|
result = dns_message_gettemprdata(msg, &rdata);
|
|
|
|
check_result (result, "dns_message_gettemprdata");
|
2000-05-12 18:45:38 +00:00
|
|
|
|
|
|
|
debug ("Setting udp size of %d", udpsize);
|
2000-05-08 22:51:08 +00:00
|
|
|
rdatalist->type = dns_rdatatype_opt;
|
|
|
|
rdatalist->covers = 0;
|
|
|
|
rdatalist->rdclass = udpsize;
|
|
|
|
rdatalist->ttl = 0;
|
|
|
|
rdata->data = NULL;
|
|
|
|
rdata->length = 0;
|
|
|
|
ISC_LIST_INIT(rdatalist->rdata);
|
|
|
|
ISC_LIST_APPEND(rdatalist->rdata, rdata, link);
|
|
|
|
dns_rdatalist_tordataset(rdatalist, rdataset);
|
|
|
|
result = dns_message_setopt(msg, rdataset);
|
|
|
|
check_result (result, "dns_message_setopt");
|
|
|
|
}
|
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
static void
|
|
|
|
add_type(dns_message_t *message, dns_name_t *name, dns_rdataclass_t rdclass,
|
|
|
|
dns_rdatatype_t rdtype)
|
|
|
|
{
|
|
|
|
dns_rdataset_t *rdataset;
|
|
|
|
isc_result_t result;
|
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
debug ("add_type()");
|
2000-04-26 18:34:17 +00:00
|
|
|
rdataset = NULL;
|
|
|
|
result = dns_message_gettemprdataset(message, &rdataset);
|
|
|
|
check_result(result, "dns_message_gettemprdataset()");
|
|
|
|
dns_rdataset_init(rdataset);
|
|
|
|
dns_rdataset_makequestion(rdataset, rdclass, rdtype);
|
|
|
|
ISC_LIST_APPEND(name->list, rdataset, link);
|
|
|
|
}
|
|
|
|
|
2000-05-12 01:02:37 +00:00
|
|
|
static void
|
|
|
|
check_next_lookup(dig_lookup_t *lookup) {
|
|
|
|
dig_lookup_t *next;
|
|
|
|
dig_query_t *query;
|
|
|
|
isc_boolean_t still_working=ISC_FALSE;
|
|
|
|
|
2000-05-22 22:56:31 +00:00
|
|
|
if (free_now)
|
|
|
|
return;
|
|
|
|
|
2000-05-12 01:02:37 +00:00
|
|
|
debug("check_next_lookup(%lx)", (long int)lookup);
|
|
|
|
for (query = ISC_LIST_HEAD(lookup->q);
|
|
|
|
query != NULL;
|
|
|
|
query = ISC_LIST_NEXT(query, link)) {
|
|
|
|
if (query->working) {
|
|
|
|
debug("Still have a worker.", stderr);
|
|
|
|
still_working=ISC_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (still_working)
|
|
|
|
return;
|
|
|
|
|
|
|
|
debug ("Have %d retries left for %s",
|
|
|
|
lookup->retries-1, lookup->textname);
|
|
|
|
debug ("Lookup %s pending", lookup->pending?"is":"is not");
|
|
|
|
|
|
|
|
next = ISC_LIST_NEXT(lookup, link);
|
|
|
|
|
|
|
|
if (lookup->tcp_mode) {
|
|
|
|
if (next == NULL) {
|
|
|
|
debug("Shutting Down.", stderr);
|
|
|
|
dighost_shutdown();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (next->sendmsg == NULL) {
|
|
|
|
debug ("Setting up for TCP");
|
|
|
|
setup_lookup(next);
|
|
|
|
do_lookup(next);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!lookup->pending) {
|
|
|
|
if (next == NULL) {
|
|
|
|
debug("Shutting Down.", stderr);
|
|
|
|
dighost_shutdown();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (next->sendmsg == NULL) {
|
|
|
|
debug ("Setting up for UDP");
|
|
|
|
setup_lookup(next);
|
|
|
|
do_lookup(next);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (lookup->retries > 1) {
|
|
|
|
debug ("Retrying");
|
|
|
|
lookup->retries --;
|
|
|
|
if (lookup->timer != NULL)
|
|
|
|
isc_timer_detach(&lookup->timer);
|
|
|
|
send_udp(lookup);
|
|
|
|
} else {
|
|
|
|
debug ("Cancelling");
|
|
|
|
cancel_lookup(lookup);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-28 21:53:50 +00:00
|
|
|
static void
|
2000-05-06 01:16:07 +00:00
|
|
|
followup_lookup(dns_message_t *msg, dig_query_t *query,
|
|
|
|
dns_section_t section) {
|
2000-04-28 21:41:19 +00:00
|
|
|
dig_lookup_t *lookup = NULL;
|
|
|
|
dig_server_t *srv = NULL;
|
|
|
|
dns_rdataset_t *rdataset = NULL;
|
|
|
|
dns_rdata_t rdata;
|
|
|
|
dns_name_t *name = NULL;
|
|
|
|
isc_result_t result, loopresult;
|
|
|
|
isc_buffer_t *b = NULL;
|
|
|
|
isc_region_t r;
|
2000-05-06 01:16:07 +00:00
|
|
|
isc_boolean_t success = ISC_FALSE;
|
2000-04-28 21:41:19 +00:00
|
|
|
int len;
|
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
debug ("followup_lookup()");
|
2000-05-22 22:56:31 +00:00
|
|
|
if (free_now)
|
|
|
|
return;
|
2000-05-06 01:16:07 +00:00
|
|
|
result = dns_message_firstname (msg,section);
|
2000-04-28 21:41:19 +00:00
|
|
|
if (result != ISC_R_SUCCESS) {
|
2000-04-29 00:12:56 +00:00
|
|
|
debug ("Firstname returned %s",
|
2000-04-28 21:41:19 +00:00
|
|
|
isc_result_totext(result));
|
2000-05-06 01:16:07 +00:00
|
|
|
if ((section == DNS_SECTION_ANSWER) &&
|
|
|
|
query->lookup->trace)
|
|
|
|
followup_lookup (msg, query, DNS_SECTION_AUTHORITY);
|
2000-04-28 21:41:19 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
debug ("Following up %s", query->lookup->textname);
|
2000-04-28 21:41:19 +00:00
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
name = NULL;
|
2000-05-06 01:16:07 +00:00
|
|
|
dns_message_currentname(msg, section, &name);
|
2000-04-28 21:41:19 +00:00
|
|
|
for (rdataset = ISC_LIST_HEAD(name->list);
|
|
|
|
rdataset != NULL;
|
|
|
|
rdataset = ISC_LIST_NEXT(rdataset, link)) {
|
|
|
|
loopresult = dns_rdataset_first(rdataset);
|
|
|
|
while (loopresult == ISC_R_SUCCESS) {
|
|
|
|
dns_rdataset_current(rdataset, &rdata);
|
2000-05-06 01:16:07 +00:00
|
|
|
debug ("Got rdata with type %d",
|
|
|
|
rdata.type);
|
|
|
|
if ((rdata.type == dns_rdatatype_ns) &&
|
|
|
|
(!query->lookup->trace_root ||
|
|
|
|
(query->lookup->nsfound < ROOTNS)))
|
|
|
|
{
|
|
|
|
query->lookup->nsfound++;
|
2000-04-28 21:41:19 +00:00
|
|
|
result = isc_buffer_allocate(mctx, &b,
|
|
|
|
BUFSIZE);
|
|
|
|
check_result (result,
|
|
|
|
"isc_buffer_allocate");
|
|
|
|
result = dns_rdata_totext (&rdata,
|
|
|
|
NULL,
|
|
|
|
b);
|
|
|
|
check_result (result,
|
|
|
|
"dns_rdata_totext");
|
|
|
|
isc_buffer_usedregion(b, &r);
|
|
|
|
len = r.length-1;
|
|
|
|
if (len >= MXNAME)
|
|
|
|
len = MXNAME-1;
|
|
|
|
/* Initialize lookup if we've not yet */
|
2000-04-29 00:12:56 +00:00
|
|
|
debug ("Found NS %d %.*s",
|
2000-04-28 21:41:19 +00:00
|
|
|
(int)r.length, (int)r.length,
|
|
|
|
(char *)r.base);
|
2000-05-06 01:16:07 +00:00
|
|
|
if (!success) {
|
|
|
|
success = ISC_TRUE;
|
|
|
|
lookup_counter++;
|
2000-05-12 01:02:37 +00:00
|
|
|
lookup = requeue_lookup
|
|
|
|
(query->lookup,
|
|
|
|
ISC_FALSE);
|
2000-05-06 01:16:07 +00:00
|
|
|
lookup->doing_xfr = ISC_FALSE;
|
2000-05-08 22:51:08 +00:00
|
|
|
lookup->defname = ISC_FALSE;
|
2000-05-06 01:16:07 +00:00
|
|
|
lookup->use_my_server_list =
|
|
|
|
ISC_TRUE;
|
|
|
|
if (section ==
|
|
|
|
DNS_SECTION_ANSWER)
|
|
|
|
lookup->trace =
|
|
|
|
ISC_FALSE;
|
|
|
|
else
|
|
|
|
lookup->trace =
|
|
|
|
query->
|
|
|
|
lookup->trace;
|
|
|
|
lookup->trace_root = ISC_FALSE;
|
|
|
|
ISC_LIST_INIT(lookup->
|
|
|
|
my_server_list);
|
|
|
|
}
|
2000-04-28 21:41:19 +00:00
|
|
|
srv = isc_mem_allocate (mctx,
|
|
|
|
sizeof(
|
|
|
|
struct
|
|
|
|
dig_server));
|
|
|
|
if (srv == NULL)
|
|
|
|
fatal("Memory allocation "
|
2000-05-06 01:16:07 +00:00
|
|
|
"failure in %s:%d",
|
|
|
|
__FILE__, __LINE__);
|
2000-05-03 23:07:30 +00:00
|
|
|
strncpy(srv->servername,
|
|
|
|
(char *)r.base, len);
|
2000-04-28 21:41:19 +00:00
|
|
|
srv->servername[len]=0;
|
2000-05-12 01:02:37 +00:00
|
|
|
debug ("Adding server %s",
|
|
|
|
srv->servername);
|
2000-04-28 21:41:19 +00:00
|
|
|
ISC_LIST_APPEND
|
|
|
|
(lookup->my_server_list,
|
|
|
|
srv, link);
|
|
|
|
isc_buffer_free (&b);
|
|
|
|
}
|
|
|
|
loopresult = dns_rdataset_next(rdataset);
|
|
|
|
}
|
|
|
|
}
|
2000-05-06 01:16:07 +00:00
|
|
|
result = dns_message_nextname (msg, section);
|
|
|
|
if (result != ISC_R_SUCCESS)
|
|
|
|
break;
|
2000-04-28 21:41:19 +00:00
|
|
|
}
|
2000-05-06 01:16:07 +00:00
|
|
|
if ((lookup == NULL) && (section == DNS_SECTION_ANSWER) &&
|
|
|
|
query->lookup->trace)
|
|
|
|
followup_lookup(msg, query, DNS_SECTION_AUTHORITY);
|
2000-04-28 21:41:19 +00:00
|
|
|
}
|
|
|
|
|
2000-05-02 23:23:12 +00:00
|
|
|
static void
|
|
|
|
next_origin(dns_message_t *msg, dig_query_t *query) {
|
|
|
|
dig_lookup_t *lookup;
|
|
|
|
|
|
|
|
UNUSED (msg);
|
|
|
|
|
|
|
|
debug ("next_origin()");
|
2000-05-22 22:56:31 +00:00
|
|
|
if (free_now)
|
|
|
|
return;
|
2000-05-02 23:23:12 +00:00
|
|
|
debug ("Following up %s", query->lookup->textname);
|
|
|
|
|
|
|
|
if (query->lookup->origin == NULL) { /*Then we just did rootorg;
|
|
|
|
there's nothing left. */
|
|
|
|
debug ("Made it to the root whith nowhere to go.");
|
|
|
|
return;
|
|
|
|
}
|
2000-05-12 01:02:37 +00:00
|
|
|
lookup = requeue_lookup(query->lookup, ISC_TRUE);
|
2000-05-08 22:51:08 +00:00
|
|
|
lookup->defname = ISC_FALSE;
|
2000-05-03 23:07:30 +00:00
|
|
|
lookup->origin = ISC_LIST_NEXT(query->lookup->origin, link);
|
2000-05-02 23:23:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
void
|
|
|
|
setup_lookup(dig_lookup_t *lookup) {
|
2000-05-02 23:23:12 +00:00
|
|
|
isc_result_t result, res2;
|
2000-04-26 18:34:17 +00:00
|
|
|
int len;
|
|
|
|
dns_rdatatype_t rdtype;
|
|
|
|
dns_rdataclass_t rdclass;
|
|
|
|
dig_server_t *serv;
|
|
|
|
dig_query_t *query;
|
2000-05-02 23:23:12 +00:00
|
|
|
isc_region_t r;
|
|
|
|
isc_textregion_t tr;
|
2000-04-26 18:34:17 +00:00
|
|
|
isc_buffer_t b;
|
2000-05-02 23:23:12 +00:00
|
|
|
char store[MXNAME];
|
2000-04-26 18:34:17 +00:00
|
|
|
|
2000-05-22 22:56:31 +00:00
|
|
|
REQUIRE (lookup != NULL);
|
|
|
|
|
2000-05-12 01:02:37 +00:00
|
|
|
debug("setup_lookup(%lx)",(long int)lookup);
|
|
|
|
|
2000-05-22 22:56:31 +00:00
|
|
|
if (free_now)
|
|
|
|
return;
|
2000-05-12 01:02:37 +00:00
|
|
|
|
2000-05-04 21:40:47 +00:00
|
|
|
debug("Setting up for looking up %s @%lx->%lx",
|
2000-04-28 21:41:19 +00:00
|
|
|
lookup->textname, (long int)lookup,
|
|
|
|
(long int)lookup->link.next);
|
2000-04-26 18:34:17 +00:00
|
|
|
|
|
|
|
result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER,
|
|
|
|
&lookup->sendmsg);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "dns_message_create");
|
2000-04-26 18:34:17 +00:00
|
|
|
|
2000-05-24 23:39:30 +00:00
|
|
|
if (lookup->new_search) {
|
|
|
|
debug ("Resetting lookup counter.");
|
2000-05-24 19:49:51 +00:00
|
|
|
lookup_counter = 0;
|
2000-05-24 23:39:30 +00:00
|
|
|
}
|
2000-04-26 18:34:17 +00:00
|
|
|
|
|
|
|
result = dns_message_gettempname(lookup->sendmsg, &lookup->name);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "dns_message_gettempname");
|
|
|
|
dns_name_init(lookup->name, NULL);
|
2000-04-26 18:34:17 +00:00
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_buffer_init(&lookup->namebuf, lookup->namespace, BUFSIZE);
|
2000-05-02 23:23:12 +00:00
|
|
|
isc_buffer_init(&lookup->onamebuf, lookup->onamespace, BUFSIZE);
|
|
|
|
|
2000-05-08 22:51:08 +00:00
|
|
|
if ((count_dots(lookup->textname) >= ndots) || lookup->defname)
|
2000-05-02 23:23:12 +00:00
|
|
|
lookup->origin = NULL; /* Force root lookup */
|
2000-05-04 21:40:47 +00:00
|
|
|
debug ("lookup->origin = %lx", (long int)lookup->origin);
|
2000-05-02 23:23:12 +00:00
|
|
|
if (lookup->origin != NULL) {
|
2000-05-03 23:07:30 +00:00
|
|
|
debug ("Trying origin %s", lookup->origin->origin);
|
2000-05-02 23:23:12 +00:00
|
|
|
result = dns_message_gettempname(lookup->sendmsg,
|
|
|
|
&lookup->oname);
|
|
|
|
check_result(result, "dns_message_gettempname");
|
|
|
|
dns_name_init(lookup->oname, NULL);
|
|
|
|
len=strlen(lookup->origin->origin);
|
|
|
|
isc_buffer_init(&b, lookup->origin->origin, len);
|
|
|
|
isc_buffer_add(&b, len);
|
2000-05-03 23:07:30 +00:00
|
|
|
result = dns_name_fromtext(lookup->oname, &b, dns_rootname,
|
2000-05-02 23:23:12 +00:00
|
|
|
ISC_FALSE, &lookup->onamebuf);
|
|
|
|
if (result != ISC_R_SUCCESS) {
|
2000-05-03 20:27:13 +00:00
|
|
|
dns_message_puttempname(lookup->sendmsg,
|
2000-05-02 23:23:12 +00:00
|
|
|
&lookup->name);
|
|
|
|
dns_message_puttempname(lookup->sendmsg,
|
|
|
|
&lookup->oname);
|
|
|
|
fatal("Aborting: %s is not a legal name syntax. (%s)",
|
|
|
|
lookup->origin->origin,
|
|
|
|
dns_result_totext(result));
|
|
|
|
}
|
2000-05-06 01:16:07 +00:00
|
|
|
if (!lookup->trace_root) {
|
|
|
|
len=strlen(lookup->textname);
|
|
|
|
isc_buffer_init(&b, lookup->textname, len);
|
|
|
|
isc_buffer_add(&b, len);
|
|
|
|
result = dns_name_fromtext(lookup->name, &b,
|
|
|
|
lookup->oname, ISC_FALSE,
|
|
|
|
&lookup->namebuf);
|
|
|
|
} else {
|
|
|
|
isc_buffer_init(&b, ". ", 1);
|
|
|
|
isc_buffer_add(&b, 1);
|
|
|
|
result = dns_name_fromtext(lookup->name, &b,
|
|
|
|
lookup->oname, ISC_FALSE,
|
|
|
|
&lookup->namebuf);
|
|
|
|
}
|
2000-05-02 23:23:12 +00:00
|
|
|
if (result != ISC_R_SUCCESS) {
|
|
|
|
dns_message_puttempname(lookup->sendmsg,
|
|
|
|
&lookup->name);
|
|
|
|
dns_message_puttempname(lookup->sendmsg,
|
|
|
|
&lookup->oname);
|
|
|
|
fatal("Aborting: %s is not a legal name syntax. (%s)",
|
|
|
|
lookup->textname, dns_result_totext(result));
|
|
|
|
}
|
|
|
|
dns_message_puttempname(lookup->sendmsg, &lookup->oname);
|
|
|
|
} else {
|
|
|
|
debug ("Using root origin.");
|
2000-05-06 01:16:07 +00:00
|
|
|
if (!lookup->trace_root) {
|
|
|
|
len = strlen (lookup->textname);
|
|
|
|
isc_buffer_init(&b, lookup->textname, len);
|
|
|
|
isc_buffer_add(&b, len);
|
|
|
|
result = dns_name_fromtext(lookup->name, &b,
|
|
|
|
dns_rootname,
|
|
|
|
ISC_FALSE,
|
|
|
|
&lookup->namebuf);
|
|
|
|
} else {
|
|
|
|
isc_buffer_init(&b, ". ", 1);
|
|
|
|
isc_buffer_add(&b, 1);
|
|
|
|
result = dns_name_fromtext(lookup->name, &b,
|
|
|
|
dns_rootname,
|
|
|
|
ISC_FALSE,
|
|
|
|
&lookup->namebuf);
|
|
|
|
}
|
2000-05-02 23:23:12 +00:00
|
|
|
if (result != ISC_R_SUCCESS) {
|
|
|
|
dns_message_puttempname(lookup->sendmsg,
|
|
|
|
&lookup->name);
|
|
|
|
isc_buffer_init(&b, store, MXNAME);
|
2000-05-03 23:07:30 +00:00
|
|
|
res2 = dns_name_totext(dns_rootname, ISC_FALSE, &b);
|
2000-05-02 23:23:12 +00:00
|
|
|
check_result (res2, "dns_name_totext");
|
|
|
|
isc_buffer_usedregion (&b, &r);
|
|
|
|
fatal("Aborting: %s/%.*s is not a legal name syntax. "
|
|
|
|
"(%s)", lookup->textname, (int)r.length,
|
|
|
|
(char *)r.base, dns_result_totext(result));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
isc_buffer_init (&b, store, MXNAME);
|
|
|
|
dns_name_totext(lookup->name, ISC_FALSE, &b);
|
|
|
|
isc_buffer_usedregion (&b, &r);
|
|
|
|
trying((int)r.length, (char *)r.base, lookup);
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (dns_name_isabsolute(lookup->name))
|
|
|
|
debug ("This is an absolute name.");
|
|
|
|
else
|
|
|
|
debug ("This is a relative name (which is wrong).");
|
|
|
|
#endif
|
2000-04-26 18:34:17 +00:00
|
|
|
|
|
|
|
if (lookup->rctext[0] == 0)
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
strcpy(lookup->rctext, "IN");
|
2000-04-26 18:34:17 +00:00
|
|
|
if (lookup->rttext[0] == 0)
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
strcpy(lookup->rttext, "A");
|
2000-04-26 18:34:17 +00:00
|
|
|
|
2000-05-24 03:10:24 +00:00
|
|
|
lookup->sendmsg->id = (unsigned short)(random() & 0xFFFF);
|
2000-04-26 18:34:17 +00:00
|
|
|
lookup->sendmsg->opcode = dns_opcode_query;
|
2000-05-24 03:10:24 +00:00
|
|
|
/*
|
|
|
|
* If this is a trace request, completely disallow recursion, since
|
|
|
|
* it's meaningless for traces.
|
|
|
|
*/
|
2000-05-06 01:16:07 +00:00
|
|
|
if (lookup->recurse && !lookup->trace) {
|
2000-05-03 20:27:13 +00:00
|
|
|
debug ("Recursive query");
|
2000-04-26 18:34:17 +00:00
|
|
|
lookup->sendmsg->flags |= DNS_MESSAGEFLAG_RD;
|
2000-05-03 20:27:13 +00:00
|
|
|
}
|
2000-04-26 18:34:17 +00:00
|
|
|
|
2000-05-08 22:51:08 +00:00
|
|
|
if (lookup->aaonly) {
|
|
|
|
debug ("AA query");
|
|
|
|
lookup->sendmsg->flags |= DNS_MESSAGEFLAG_AA;
|
|
|
|
}
|
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
dns_message_addname(lookup->sendmsg, lookup->name,
|
|
|
|
DNS_SECTION_QUESTION);
|
|
|
|
|
|
|
|
|
2000-05-06 01:16:07 +00:00
|
|
|
if (lookup->trace_root) {
|
|
|
|
tr.base="SOA";
|
|
|
|
tr.length=3;
|
|
|
|
} else {
|
2000-05-02 23:23:12 +00:00
|
|
|
tr.base=lookup->rttext;
|
|
|
|
tr.length=strlen(lookup->rttext);
|
2000-04-28 21:41:19 +00:00
|
|
|
}
|
2000-05-02 23:23:12 +00:00
|
|
|
result = dns_rdatatype_fromtext(&rdtype, &tr);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "dns_rdatatype_fromtext");
|
|
|
|
if (rdtype == dns_rdatatype_axfr) {
|
2000-04-26 18:34:17 +00:00
|
|
|
lookup->doing_xfr = ISC_TRUE;
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
/*
|
|
|
|
* Force TCP mode if we're doing an xfr.
|
|
|
|
*/
|
2000-05-12 01:02:37 +00:00
|
|
|
lookup->tcp_mode = ISC_TRUE;
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
2000-05-06 01:16:07 +00:00
|
|
|
if (lookup->trace_root) {
|
2000-05-02 23:23:12 +00:00
|
|
|
tr.base="IN";
|
|
|
|
tr.length=2;
|
2000-05-06 01:16:07 +00:00
|
|
|
} else {
|
|
|
|
tr.base=lookup->rctext;
|
|
|
|
tr.length=strlen(lookup->rctext);
|
2000-04-28 21:41:19 +00:00
|
|
|
}
|
2000-05-02 23:23:12 +00:00
|
|
|
result = dns_rdataclass_fromtext(&rdclass, &tr);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "dns_rdataclass_fromtext");
|
2000-04-26 18:34:17 +00:00
|
|
|
add_type(lookup->sendmsg, lookup->name, rdclass, rdtype);
|
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_buffer_init(&lookup->sendbuf, lookup->sendspace, COMMSIZE);
|
2000-05-02 23:23:12 +00:00
|
|
|
debug ("Starting to render the message");
|
2000-04-26 18:34:17 +00:00
|
|
|
result = dns_message_renderbegin(lookup->sendmsg, &lookup->sendbuf);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "dns_message_renderbegin");
|
2000-05-08 22:51:08 +00:00
|
|
|
if (lookup->udpsize > 0) {
|
|
|
|
add_opt(lookup->sendmsg, lookup->udpsize);
|
|
|
|
}
|
2000-04-26 18:34:17 +00:00
|
|
|
result = dns_message_rendersection(lookup->sendmsg,
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
DNS_SECTION_QUESTION, 0);
|
|
|
|
check_result(result, "dns_message_rendersection");
|
2000-04-26 18:34:17 +00:00
|
|
|
result = dns_message_renderend(lookup->sendmsg);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "dns_message_renderend");
|
2000-05-02 23:23:12 +00:00
|
|
|
debug ("Done rendering.");
|
2000-04-26 18:34:17 +00:00
|
|
|
|
|
|
|
lookup->pending = ISC_FALSE;
|
|
|
|
|
2000-04-28 21:41:19 +00:00
|
|
|
if (lookup->use_my_server_list)
|
2000-04-28 21:53:50 +00:00
|
|
|
serv = ISC_LIST_HEAD(lookup->my_server_list);
|
2000-04-28 21:41:19 +00:00
|
|
|
else
|
2000-04-28 21:53:50 +00:00
|
|
|
serv = ISC_LIST_HEAD(server_list);
|
|
|
|
for (; serv != NULL;
|
2000-04-26 18:34:17 +00:00
|
|
|
serv = ISC_LIST_NEXT(serv, link)) {
|
|
|
|
query = isc_mem_allocate(mctx, sizeof(dig_query_t));
|
|
|
|
if (query == NULL)
|
2000-05-24 03:10:24 +00:00
|
|
|
fatal("Memory allocation failure in %s:%d",
|
|
|
|
__FILE__, __LINE__);
|
2000-05-12 18:45:38 +00:00
|
|
|
debug ("Create query %lx linked to lookup %lx",
|
|
|
|
(long int)query, (long int)lookup);
|
2000-04-26 18:34:17 +00:00
|
|
|
query->lookup = lookup;
|
|
|
|
query->working = ISC_FALSE;
|
|
|
|
query->waiting_connect = ISC_FALSE;
|
|
|
|
query->first_pass = ISC_TRUE;
|
|
|
|
query->first_soa_rcvd = ISC_FALSE;
|
|
|
|
query->servname = serv->servername;
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
ISC_LIST_INIT(query->sendlist);
|
|
|
|
ISC_LIST_INIT(query->recvlist);
|
|
|
|
ISC_LIST_INIT(query->lengthlist);
|
2000-04-26 18:34:17 +00:00
|
|
|
query->sock = NULL;
|
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_buffer_init(&query->recvbuf, query->recvspace, COMMSIZE);
|
|
|
|
isc_buffer_init(&query->lengthbuf, query->lengthspace, 2);
|
|
|
|
isc_buffer_init(&query->slbuf, query->slspace, 2);
|
2000-04-26 18:34:17 +00:00
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
ISC_LIST_ENQUEUE(lookup->q, query, link);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
2000-05-08 22:51:08 +00:00
|
|
|
if (!ISC_LIST_EMPTY(lookup->q) && qr) {
|
|
|
|
printmessage (ISC_LIST_HEAD(lookup->q), lookup->sendmsg,
|
|
|
|
ISC_TRUE);
|
|
|
|
}
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-04-26 19:36:40 +00:00
|
|
|
send_done(isc_task_t *task, isc_event_t *event) {
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
UNUSED(task);
|
2000-05-26 00:48:18 +00:00
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_event_free(&event);
|
2000-04-29 00:12:56 +00:00
|
|
|
|
|
|
|
debug("send_done()");
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-04-26 19:36:40 +00:00
|
|
|
cancel_lookup(dig_lookup_t *lookup) {
|
2000-04-29 01:39:32 +00:00
|
|
|
dig_query_t *query=NULL;
|
2000-04-26 18:34:17 +00:00
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("cancel_lookup()");
|
2000-04-26 18:34:17 +00:00
|
|
|
for (query = ISC_LIST_HEAD(lookup->q);
|
|
|
|
query != NULL;
|
|
|
|
query = ISC_LIST_NEXT(query, link)) {
|
|
|
|
if (query->working) {
|
2000-05-12 01:02:37 +00:00
|
|
|
debug ("Cancelling a worker.");
|
2000-05-24 23:39:30 +00:00
|
|
|
}
|
|
|
|
if (query->sock != NULL) {
|
2000-05-26 22:03:00 +00:00
|
|
|
isc_socket_cancel(query->sock, global_task,
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
ISC_SOCKCANCEL_ALL);
|
2000-05-24 23:39:30 +00:00
|
|
|
isc_socket_detach(&query->sock);
|
|
|
|
sockcount--;
|
|
|
|
debug ("Socket = %d",sockcount);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
}
|
2000-05-12 01:02:37 +00:00
|
|
|
lookup->pending = ISC_FALSE;
|
|
|
|
lookup->retries = 0;
|
|
|
|
check_next_lookup(lookup);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
|
2000-05-02 23:23:12 +00:00
|
|
|
static void
|
|
|
|
recv_done(isc_task_t *task, isc_event_t *event);
|
|
|
|
|
|
|
|
static void
|
|
|
|
connect_timeout(isc_task_t *task, isc_event_t *event);
|
|
|
|
|
|
|
|
void
|
|
|
|
send_udp(dig_lookup_t *lookup) {
|
|
|
|
dig_query_t *query;
|
|
|
|
isc_result_t result;
|
|
|
|
|
|
|
|
debug ("send_udp()");
|
|
|
|
|
|
|
|
isc_interval_set(&lookup->interval, timeout, 0);
|
|
|
|
result = isc_timer_create(timermgr, isc_timertype_once, NULL,
|
2000-05-26 22:03:00 +00:00
|
|
|
&lookup->interval, global_task,
|
|
|
|
connect_timeout, lookup, &lookup->timer);
|
2000-05-02 23:23:12 +00:00
|
|
|
check_result(result, "isc_timer_create");
|
|
|
|
for (query = ISC_LIST_HEAD(lookup->q);
|
|
|
|
query != NULL;
|
|
|
|
query = ISC_LIST_NEXT(query, link)) {
|
2000-05-12 18:45:38 +00:00
|
|
|
debug ("Working on lookup %lx, query %lx",
|
|
|
|
(long int)query->lookup, (long int)query);
|
2000-05-02 23:23:12 +00:00
|
|
|
ISC_LIST_ENQUEUE(query->recvlist, &query->recvbuf, link);
|
|
|
|
query->working = ISC_TRUE;
|
2000-05-24 23:39:30 +00:00
|
|
|
debug ("recving with lookup=%lx, query=%lx, sock=%lx",
|
|
|
|
(long int)query->lookup, (long int)query,
|
|
|
|
(long int)query->sock);
|
2000-05-02 23:23:12 +00:00
|
|
|
result = isc_socket_recvv(query->sock, &query->recvlist, 1,
|
2000-05-26 22:03:00 +00:00
|
|
|
global_task, recv_done, query);
|
2000-05-02 23:23:12 +00:00
|
|
|
check_result(result, "isc_socket_recvv");
|
|
|
|
sendcount++;
|
|
|
|
debug("Sent count number %d", sendcount);
|
|
|
|
#ifdef TWIDDLE
|
|
|
|
if (twiddle) {
|
|
|
|
twiddlebuf(lookup->sendbuf);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
ISC_LIST_ENQUEUE(query->sendlist, &lookup->sendbuf, link);
|
|
|
|
debug("Sending a request.");
|
|
|
|
result = isc_time_now(&query->time_sent);
|
|
|
|
check_result(result, "isc_time_now");
|
2000-05-24 23:39:30 +00:00
|
|
|
ENSURE (query->sock != NULL);
|
2000-05-02 23:23:12 +00:00
|
|
|
result = isc_socket_sendtov(query->sock, &query->sendlist,
|
2000-05-26 22:03:00 +00:00
|
|
|
global_task, send_done, query,
|
2000-05-02 23:23:12 +00:00
|
|
|
&query->sockaddr, NULL);
|
|
|
|
check_result(result, "isc_socket_sendtov");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
/* connect_timeout is used for both UDP recieves and TCP connects. */
|
|
|
|
static void
|
2000-04-26 19:36:40 +00:00
|
|
|
connect_timeout(isc_task_t *task, isc_event_t *event) {
|
2000-05-12 01:02:37 +00:00
|
|
|
dig_lookup_t *lookup=NULL, *next=NULL;
|
2000-04-26 18:34:17 +00:00
|
|
|
dig_query_t *q=NULL;
|
|
|
|
isc_result_t result;
|
2000-04-28 21:41:19 +00:00
|
|
|
isc_buffer_t *b=NULL;
|
2000-04-26 18:34:17 +00:00
|
|
|
isc_region_t r;
|
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
REQUIRE(event->ev_type == ISC_TIMEREVENT_IDLE);
|
2000-04-26 18:34:17 +00:00
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("connect_timeout()");
|
|
|
|
lookup = event->ev_arg;
|
|
|
|
|
2000-05-25 19:32:11 +00:00
|
|
|
isc_event_free(&event);
|
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
debug ("Buffer Allocate connect_timeout");
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
result = isc_buffer_allocate(mctx, &b, 256);
|
|
|
|
check_result(result, "isc_buffer_allocate");
|
2000-04-26 18:34:17 +00:00
|
|
|
for (q = ISC_LIST_HEAD(lookup->q);
|
|
|
|
q != NULL;
|
|
|
|
q = ISC_LIST_NEXT(q, link)) {
|
|
|
|
if (q->working) {
|
2000-04-28 21:41:19 +00:00
|
|
|
if (!free_now) {
|
|
|
|
isc_buffer_clear(b);
|
|
|
|
result = isc_sockaddr_totext(&q->sockaddr, b);
|
|
|
|
check_result(result, "isc_sockaddr_totext");
|
|
|
|
isc_buffer_usedregion(b, &r);
|
2000-05-02 23:23:12 +00:00
|
|
|
if (q->lookup->retries > 1)
|
|
|
|
printf(";; Connection to server %.*s "
|
|
|
|
"for %s timed out. "
|
2000-05-04 21:40:47 +00:00
|
|
|
"Retrying %d.\n",
|
2000-05-02 23:23:12 +00:00
|
|
|
(int)r.length, r.base,
|
2000-05-04 21:40:47 +00:00
|
|
|
q->lookup->textname,
|
|
|
|
q->lookup->retries-1);
|
2000-05-08 22:51:08 +00:00
|
|
|
else {
|
2000-05-12 01:02:37 +00:00
|
|
|
if (lookup->tcp_mode) {
|
|
|
|
printf(";; Connection to "
|
|
|
|
"server %.*s "
|
|
|
|
"for %s timed out. "
|
|
|
|
"Giving up.\n",
|
|
|
|
(int)r.length, r.base,
|
|
|
|
q->lookup->textname);
|
|
|
|
} else {
|
|
|
|
printf(";; Connection to "
|
|
|
|
"server %.*s "
|
|
|
|
"for %s timed out. "
|
|
|
|
"Trying TCP.\n",
|
|
|
|
(int)r.length, r.base,
|
|
|
|
q->lookup->textname);
|
|
|
|
next = requeue_lookup
|
|
|
|
(lookup,ISC_TRUE);
|
|
|
|
next->tcp_mode = ISC_TRUE;
|
|
|
|
}
|
2000-05-08 22:51:08 +00:00
|
|
|
}
|
2000-04-28 21:41:19 +00:00
|
|
|
}
|
|
|
|
isc_socket_cancel(q->sock, task,
|
|
|
|
ISC_SOCKCANCEL_ALL);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
}
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
ENSURE(lookup->timer != NULL);
|
|
|
|
isc_timer_detach(&lookup->timer);
|
|
|
|
isc_buffer_free(&b);
|
2000-05-02 23:23:12 +00:00
|
|
|
debug ("Done with connect_timeout()");
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-04-26 19:36:40 +00:00
|
|
|
tcp_length_done(isc_task_t *task, isc_event_t *event) {
|
2000-04-26 18:34:17 +00:00
|
|
|
isc_socketevent_t *sevent;
|
|
|
|
isc_buffer_t *b=NULL;
|
|
|
|
isc_region_t r;
|
|
|
|
isc_result_t result;
|
|
|
|
dig_query_t *query=NULL;
|
|
|
|
isc_uint16_t length;
|
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
REQUIRE(event->ev_type == ISC_SOCKEVENT_RECVDONE);
|
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
UNUSED(task);
|
2000-04-26 18:34:17 +00:00
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("tcp_length_done()");
|
2000-05-22 22:56:31 +00:00
|
|
|
|
2000-05-26 00:48:18 +00:00
|
|
|
if (free_now) {
|
|
|
|
isc_event_free(&event);
|
2000-05-22 22:56:31 +00:00
|
|
|
return;
|
2000-05-26 00:48:18 +00:00
|
|
|
}
|
2000-05-22 22:56:31 +00:00
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
sevent = (isc_socketevent_t *)event;
|
|
|
|
|
|
|
|
query = event->ev_arg;
|
|
|
|
|
|
|
|
if (sevent->result == ISC_R_CANCELED) {
|
|
|
|
query->working = ISC_FALSE;
|
|
|
|
check_next_lookup(query->lookup);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_event_free(&event);
|
2000-04-26 18:34:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (sevent->result != ISC_R_SUCCESS) {
|
2000-04-29 00:12:56 +00:00
|
|
|
debug ("Buffer Allocate connect_timeout");
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
result = isc_buffer_allocate(mctx, &b, 256);
|
|
|
|
check_result(result, "isc_buffer_allocate");
|
2000-04-26 18:34:17 +00:00
|
|
|
result = isc_sockaddr_totext(&query->sockaddr, b);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "isc_sockaddr_totext");
|
|
|
|
isc_buffer_usedregion(b, &r);
|
|
|
|
printf("%.*s: %s\n", (int)r.length, r.base,
|
|
|
|
isc_result_totext(sevent->result));
|
|
|
|
isc_buffer_free(&b);
|
2000-04-26 18:34:17 +00:00
|
|
|
query->working = ISC_FALSE;
|
2000-05-24 23:39:30 +00:00
|
|
|
sockcount--;
|
|
|
|
debug ("Socket = %d",sockcount);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_socket_detach(&query->sock);
|
2000-04-26 18:34:17 +00:00
|
|
|
check_next_lookup(query->lookup);
|
2000-05-26 00:48:18 +00:00
|
|
|
isc_event_free(&event);
|
2000-04-26 18:34:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
b = ISC_LIST_HEAD(sevent->bufferlist);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
ISC_LIST_DEQUEUE(sevent->bufferlist, &query->lengthbuf, link);
|
2000-04-26 18:34:17 +00:00
|
|
|
length = isc_buffer_getuint16(b);
|
2000-04-29 00:12:56 +00:00
|
|
|
if (length > COMMSIZE) {
|
|
|
|
isc_event_free (&event);
|
|
|
|
fatal ("Length of %X was longer than I can handle!",
|
|
|
|
length);
|
|
|
|
}
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
/*
|
|
|
|
* Even though the buffer was already init'ed, we need
|
|
|
|
* to redo it now, to force the length we want.
|
|
|
|
*/
|
|
|
|
isc_buffer_invalidate(&query->recvbuf);
|
|
|
|
isc_buffer_init(&query->recvbuf, query->recvspace, length);
|
|
|
|
ENSURE(ISC_LIST_EMPTY(query->recvlist));
|
|
|
|
ISC_LIST_ENQUEUE(query->recvlist, &query->recvbuf, link);
|
2000-05-12 18:45:38 +00:00
|
|
|
debug ("recving with lookup=%lx, query=%lx",
|
|
|
|
(long int)query->lookup, (long int)query);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
result = isc_socket_recvv(query->sock, &query->recvlist, length, task,
|
|
|
|
recv_done, query);
|
|
|
|
check_result(result, "isc_socket_recvv");
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("Resubmitted recv request with length %d", length);
|
2000-05-26 00:48:18 +00:00
|
|
|
isc_event_free(&event);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
launch_next_query(dig_query_t *query, isc_boolean_t include_question) {
|
|
|
|
isc_result_t result;
|
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("launch_next_query()");
|
|
|
|
|
2000-05-22 22:56:31 +00:00
|
|
|
if (free_now)
|
|
|
|
return;
|
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
if (!query->lookup->pending) {
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("Ignoring launch_next_query because !pending.");
|
2000-05-24 23:39:30 +00:00
|
|
|
sockcount--;
|
|
|
|
debug ("Socket = %d",sockcount);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_socket_detach(&query->sock);
|
2000-04-26 18:34:17 +00:00
|
|
|
query->working = ISC_FALSE;
|
|
|
|
query->waiting_connect = ISC_FALSE;
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_next_lookup(query->lookup);
|
2000-04-26 18:34:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
isc_buffer_clear(&query->slbuf);
|
|
|
|
isc_buffer_clear(&query->lengthbuf);
|
|
|
|
isc_buffer_putuint16(&query->slbuf, query->lookup->sendbuf.used);
|
|
|
|
ISC_LIST_ENQUEUE(query->sendlist, &query->slbuf, link);
|
2000-04-29 01:39:32 +00:00
|
|
|
if (include_question) {
|
|
|
|
#ifdef TWIDDLE
|
|
|
|
if (twiddle) {
|
|
|
|
twiddlebuf(query->lookup->sendbuf);
|
|
|
|
}
|
|
|
|
#endif
|
2000-04-26 18:34:17 +00:00
|
|
|
ISC_LIST_ENQUEUE(query->sendlist, &query->lookup->sendbuf,
|
|
|
|
link);
|
2000-04-29 01:39:32 +00:00
|
|
|
}
|
2000-04-26 18:34:17 +00:00
|
|
|
ISC_LIST_ENQUEUE(query->lengthlist, &query->lengthbuf, link);
|
|
|
|
|
2000-05-26 22:03:00 +00:00
|
|
|
result = isc_socket_recvv(query->sock, &query->lengthlist, 0,
|
|
|
|
global_task, tcp_length_done, query);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "isc_socket_recvv");
|
2000-04-26 18:34:17 +00:00
|
|
|
sendcount++;
|
2000-04-29 00:12:56 +00:00
|
|
|
if (!query->first_soa_rcvd) {
|
|
|
|
debug("Sending a request.");
|
2000-05-02 23:23:12 +00:00
|
|
|
result = isc_time_now(&query->time_sent);
|
|
|
|
check_result(result, "isc_time_now");
|
2000-05-26 22:03:00 +00:00
|
|
|
result = isc_socket_sendv(query->sock, &query->sendlist,
|
|
|
|
global_task, send_done, query);
|
2000-04-29 00:12:56 +00:00
|
|
|
check_result(result, "isc_socket_recvv");
|
|
|
|
}
|
2000-04-26 18:34:17 +00:00
|
|
|
query->waiting_connect = ISC_FALSE;
|
|
|
|
check_next_lookup(query->lookup);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-04-26 19:36:40 +00:00
|
|
|
connect_done(isc_task_t *task, isc_event_t *event) {
|
2000-04-26 18:34:17 +00:00
|
|
|
isc_result_t result;
|
2000-04-28 21:41:19 +00:00
|
|
|
isc_socketevent_t *sevent=NULL;
|
|
|
|
dig_query_t *query=NULL;
|
|
|
|
isc_buffer_t *b=NULL;
|
2000-04-26 18:34:17 +00:00
|
|
|
isc_region_t r;
|
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
UNUSED(task);
|
2000-04-26 18:34:17 +00:00
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
REQUIRE(event->ev_type == ISC_SOCKEVENT_CONNECT);
|
2000-04-29 00:12:56 +00:00
|
|
|
|
2000-05-26 00:48:18 +00:00
|
|
|
debug ("connect_done()");
|
2000-05-25 19:32:11 +00:00
|
|
|
|
2000-05-26 00:48:18 +00:00
|
|
|
if (free_now) {
|
|
|
|
isc_event_free(&event);
|
2000-05-22 22:56:31 +00:00
|
|
|
return;
|
2000-05-26 00:48:18 +00:00
|
|
|
}
|
2000-05-22 22:56:31 +00:00
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
sevent = (isc_socketevent_t *)event;
|
|
|
|
query = sevent->ev_arg;
|
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
REQUIRE(query->waiting_connect);
|
2000-04-26 18:34:17 +00:00
|
|
|
|
|
|
|
query->waiting_connect = ISC_FALSE;
|
|
|
|
|
|
|
|
if (sevent->result != ISC_R_SUCCESS) {
|
2000-04-29 00:12:56 +00:00
|
|
|
debug ("Buffer Allocate connect_timeout");
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
result = isc_buffer_allocate(mctx, &b, 256);
|
|
|
|
check_result(result, "isc_buffer_allocate");
|
2000-04-26 18:34:17 +00:00
|
|
|
result = isc_sockaddr_totext(&query->sockaddr, b);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "isc_sockaddr_totext");
|
|
|
|
isc_buffer_usedregion(b, &r);
|
|
|
|
printf(";; Connection to server %.*s for %s failed: %s.\n",
|
|
|
|
(int)r.length, r.base, query->lookup->textname,
|
|
|
|
isc_result_totext(sevent->result));
|
2000-05-08 22:51:08 +00:00
|
|
|
if (exitcode < 9)
|
|
|
|
exitcode = 9;
|
2000-04-26 18:34:17 +00:00
|
|
|
isc_buffer_free(&b);
|
|
|
|
query->working = ISC_FALSE;
|
|
|
|
query->waiting_connect = ISC_FALSE;
|
|
|
|
check_next_lookup(query->lookup);
|
2000-05-26 00:48:18 +00:00
|
|
|
isc_event_free(&event);
|
2000-04-26 18:34:17 +00:00
|
|
|
return;
|
|
|
|
}
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
launch_next_query(query, ISC_TRUE);
|
2000-05-26 00:48:18 +00:00
|
|
|
isc_event_free(&event);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static isc_boolean_t
|
|
|
|
msg_contains_soa(dns_message_t *msg, dig_query_t *query) {
|
|
|
|
isc_result_t result;
|
|
|
|
dns_name_t *name=NULL;
|
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("msg_contains_soa()");
|
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
result = dns_message_findname(msg, DNS_SECTION_ANSWER,
|
|
|
|
query->lookup->name, dns_rdatatype_soa,
|
|
|
|
0, &name, NULL);
|
2000-04-26 18:34:17 +00:00
|
|
|
if (result == ISC_R_SUCCESS) {
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("Found SOA", stderr);
|
2000-04-26 18:34:17 +00:00
|
|
|
return (ISC_TRUE);
|
|
|
|
} else {
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("Didn't find SOA, result=%d:%s",
|
2000-04-26 18:34:17 +00:00
|
|
|
result, dns_result_totext(result));
|
|
|
|
return (ISC_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
recv_done(isc_task_t *task, isc_event_t *event) {
|
|
|
|
isc_socketevent_t *sevent = NULL;
|
|
|
|
dig_query_t *query = NULL;
|
|
|
|
isc_buffer_t *b = NULL;
|
|
|
|
dns_message_t *msg = NULL;
|
2000-04-26 18:34:17 +00:00
|
|
|
isc_result_t result;
|
|
|
|
isc_buffer_t ab;
|
|
|
|
char abspace[MXNAME];
|
|
|
|
isc_region_t r;
|
2000-05-12 01:02:37 +00:00
|
|
|
dig_lookup_t *n;
|
2000-04-26 18:34:17 +00:00
|
|
|
|
|
|
|
UNUSED (task);
|
|
|
|
|
2000-05-26 00:48:18 +00:00
|
|
|
debug ("recv_done()");
|
2000-05-25 19:32:11 +00:00
|
|
|
|
2000-05-26 00:48:18 +00:00
|
|
|
if (free_now) {
|
|
|
|
isc_event_free(&event);
|
2000-05-22 22:56:31 +00:00
|
|
|
return;
|
2000-05-26 00:48:18 +00:00
|
|
|
}
|
2000-05-22 22:56:31 +00:00
|
|
|
|
2000-05-12 18:45:38 +00:00
|
|
|
query = event->ev_arg;
|
2000-05-26 00:48:18 +00:00
|
|
|
debug("(lookup=%lx, query=%lx)",
|
2000-05-12 18:45:38 +00:00
|
|
|
(long int)query->lookup, (long int)query);
|
2000-04-29 00:12:56 +00:00
|
|
|
|
|
|
|
if (free_now) {
|
|
|
|
debug("Bailing out, since freeing now.");
|
2000-05-26 00:48:18 +00:00
|
|
|
isc_event_free(&event);
|
2000-04-29 00:12:56 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
sendcount--;
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("In recv_done, counter down to %d", sendcount);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
REQUIRE(event->ev_type == ISC_SOCKEVENT_RECVDONE);
|
2000-04-26 18:34:17 +00:00
|
|
|
sevent = (isc_socketevent_t *)event;
|
|
|
|
|
2000-05-06 01:16:07 +00:00
|
|
|
if (!query->lookup->pending && !query->lookup->ns_search_only) {
|
2000-05-12 01:02:37 +00:00
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("No longer pending. Got %s",
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_result_totext(sevent->result));
|
2000-04-26 18:34:17 +00:00
|
|
|
query->working = ISC_FALSE;
|
|
|
|
query->waiting_connect = ISC_FALSE;
|
2000-05-12 01:02:37 +00:00
|
|
|
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
cancel_lookup(query->lookup);
|
2000-05-26 00:48:18 +00:00
|
|
|
isc_event_free(&event);
|
2000-04-26 18:34:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sevent->result == ISC_R_SUCCESS) {
|
|
|
|
b = ISC_LIST_HEAD(sevent->bufferlist);
|
|
|
|
ISC_LIST_DEQUEUE(sevent->bufferlist, &query->recvbuf, link);
|
|
|
|
result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE,
|
|
|
|
&msg);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "dns_message_create");
|
2000-05-12 01:02:37 +00:00
|
|
|
debug ("Before parse starts");
|
2000-04-26 18:34:17 +00:00
|
|
|
result = dns_message_parse(msg, b, ISC_TRUE);
|
2000-05-12 01:02:37 +00:00
|
|
|
if (result != ISC_R_SUCCESS) {
|
|
|
|
printf (";; Got bad UDP packet:\n");
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
hex_dump(b);
|
2000-05-12 01:02:37 +00:00
|
|
|
query->working = ISC_FALSE;
|
|
|
|
query->waiting_connect = ISC_FALSE;
|
|
|
|
if (!query->lookup->tcp_mode) {
|
|
|
|
printf (";; Retrying in TCP mode.\n");
|
|
|
|
n = requeue_lookup(query->lookup, ISC_TRUE);
|
|
|
|
n->tcp_mode = ISC_TRUE;
|
|
|
|
}
|
|
|
|
cancel_lookup(query->lookup);
|
|
|
|
dns_message_destroy(&msg);
|
2000-05-26 00:48:18 +00:00
|
|
|
isc_event_free(&event);
|
2000-05-12 01:02:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
debug ("After parse has started");
|
2000-04-26 18:34:17 +00:00
|
|
|
if (query->lookup->xfr_q == NULL)
|
|
|
|
query->lookup->xfr_q = query;
|
|
|
|
if (query->lookup->xfr_q == query) {
|
2000-05-06 01:16:07 +00:00
|
|
|
if (query->lookup->trace) {
|
2000-05-24 03:10:24 +00:00
|
|
|
if (show_details ||
|
|
|
|
((dns_message_firstname(msg,
|
|
|
|
DNS_SECTION_ANSWER)
|
|
|
|
== ISC_R_SUCCESS) &&
|
|
|
|
!query->lookup->trace_root)) {
|
2000-05-06 01:16:07 +00:00
|
|
|
printmessage(query, msg, ISC_TRUE);
|
2000-05-04 21:40:47 +00:00
|
|
|
}
|
|
|
|
if ((msg->rcode != 0) &&
|
|
|
|
(query->lookup->origin != NULL)) {
|
|
|
|
next_origin(msg, query);
|
2000-05-06 01:16:07 +00:00
|
|
|
} else {
|
|
|
|
result = dns_message_firstname
|
|
|
|
(msg,DNS_SECTION_ANSWER);
|
|
|
|
if ((result != ISC_R_SUCCESS) ||
|
|
|
|
query->lookup->trace_root)
|
|
|
|
followup_lookup(msg, query,
|
|
|
|
DNS_SECTION_AUTHORITY);
|
|
|
|
}
|
2000-05-04 21:40:47 +00:00
|
|
|
} else if ((msg->rcode != 0) &&
|
2000-05-02 23:23:12 +00:00
|
|
|
(query->lookup->origin != NULL)) {
|
|
|
|
next_origin(msg, query);
|
|
|
|
if (show_details) {
|
|
|
|
printmessage(query, msg, ISC_TRUE);
|
|
|
|
}
|
|
|
|
} else {
|
2000-04-28 21:41:19 +00:00
|
|
|
if (query->first_soa_rcvd &&
|
|
|
|
query->lookup->doing_xfr)
|
|
|
|
printmessage(query, msg, ISC_FALSE);
|
|
|
|
else
|
|
|
|
printmessage(query, msg, ISC_TRUE);
|
|
|
|
}
|
2000-05-06 01:16:07 +00:00
|
|
|
} else if (( dns_message_firstname(msg, DNS_SECTION_ANSWER)
|
|
|
|
== ISC_R_SUCCESS) &&
|
|
|
|
query->lookup->ns_search_only &&
|
|
|
|
!query->lookup->trace_root ) {
|
|
|
|
printmessage (query, msg, ISC_TRUE);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
2000-05-06 01:16:07 +00:00
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
if (query->lookup->pending)
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("Still pending.");
|
2000-04-26 18:34:17 +00:00
|
|
|
#endif
|
|
|
|
if (query->lookup->doing_xfr) {
|
|
|
|
if (!query->first_soa_rcvd) {
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("Not yet got first SOA");
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
if (!msg_contains_soa(msg, query)) {
|
|
|
|
puts("; Transfer failed. "
|
|
|
|
"Didn't start with SOA answer.");
|
2000-04-26 18:34:17 +00:00
|
|
|
query->working = ISC_FALSE;
|
2000-04-27 23:20:29 +00:00
|
|
|
cancel_lookup(query->lookup);
|
|
|
|
dns_message_destroy (&msg);
|
2000-05-26 00:48:18 +00:00
|
|
|
isc_event_free(&event);
|
2000-04-26 18:34:17 +00:00
|
|
|
return;
|
2000-05-24 17:26:01 +00:00
|
|
|
}
|
|
|
|
else {
|
2000-04-26 18:34:17 +00:00
|
|
|
query->first_soa_rcvd = ISC_TRUE;
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
launch_next_query(query, ISC_FALSE);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
2000-05-24 03:10:24 +00:00
|
|
|
} else {
|
2000-04-26 18:34:17 +00:00
|
|
|
if (msg_contains_soa(msg, query)) {
|
2000-05-02 23:23:12 +00:00
|
|
|
isc_buffer_init(&ab, abspace, MXNAME);
|
|
|
|
result = isc_sockaddr_totext(&sevent->
|
|
|
|
address,
|
|
|
|
&ab);
|
|
|
|
check_result(result,
|
|
|
|
"isc_sockaddr_totext");
|
|
|
|
isc_buffer_usedregion(&ab, &r);
|
2000-05-03 18:25:52 +00:00
|
|
|
received(b->used, r.length,
|
|
|
|
(char *)r.base, query);
|
2000-04-26 18:34:17 +00:00
|
|
|
query->working = ISC_FALSE;
|
2000-05-12 01:02:37 +00:00
|
|
|
cancel_lookup(query->lookup);
|
2000-04-27 23:20:29 +00:00
|
|
|
dns_message_destroy (&msg);
|
2000-05-26 00:48:18 +00:00
|
|
|
isc_event_free(&event);
|
2000-04-26 18:34:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
launch_next_query(query, ISC_FALSE);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2000-05-02 23:23:12 +00:00
|
|
|
if ((msg->rcode == 0) ||
|
|
|
|
(query->lookup->origin == NULL)) {
|
|
|
|
isc_buffer_init(&ab, abspace, MXNAME);
|
|
|
|
result = isc_sockaddr_totext(&sevent->address,
|
|
|
|
&ab);
|
|
|
|
check_result(result, "isc_sockaddr_totext");
|
|
|
|
isc_buffer_usedregion(&ab, &r);
|
2000-05-03 18:25:52 +00:00
|
|
|
received(b->used, r.length, (char *)r.base,
|
|
|
|
query);
|
2000-05-02 23:23:12 +00:00
|
|
|
}
|
2000-04-26 18:34:17 +00:00
|
|
|
query->working = ISC_FALSE;
|
2000-05-06 01:16:07 +00:00
|
|
|
query->lookup->pending = ISC_FALSE;
|
|
|
|
if (!query->lookup->ns_search_only ||
|
|
|
|
query->lookup->trace_root ) {
|
|
|
|
cancel_lookup(query->lookup);
|
|
|
|
}
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_next_lookup(query->lookup);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
dns_message_destroy(&msg);
|
2000-05-26 00:48:18 +00:00
|
|
|
isc_event_free(&event);
|
2000-04-26 18:34:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* In truth, we should never get into the CANCELED routine, since
|
|
|
|
the cancel_lookup() routine clears the pending flag. */
|
|
|
|
if (sevent->result == ISC_R_CANCELED) {
|
2000-05-02 23:23:12 +00:00
|
|
|
debug ("In cancel handler");
|
2000-04-26 18:34:17 +00:00
|
|
|
query->working = ISC_FALSE;
|
|
|
|
query->waiting_connect = ISC_FALSE;
|
|
|
|
check_next_lookup(query->lookup);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_event_free(&event);
|
2000-04-26 18:34:17 +00:00
|
|
|
return;
|
|
|
|
}
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
fatal("recv_done got result %s",
|
|
|
|
isc_result_totext(sevent->result));
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
|
2000-05-16 17:53:35 +00:00
|
|
|
void
|
2000-05-02 23:23:12 +00:00
|
|
|
get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr) {
|
2000-04-26 18:34:17 +00:00
|
|
|
struct in_addr in4;
|
|
|
|
struct in6_addr in6;
|
|
|
|
struct hostent *he;
|
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("get_address()");
|
|
|
|
|
2000-04-29 01:39:32 +00:00
|
|
|
if (have_ipv6 && inet_pton(AF_INET6, host, &in6) == 1)
|
2000-04-26 18:34:17 +00:00
|
|
|
isc_sockaddr_fromin6(sockaddr, &in6, port);
|
2000-04-29 01:39:32 +00:00
|
|
|
else if (inet_pton(AF_INET, host, &in4) == 1)
|
2000-04-26 18:34:17 +00:00
|
|
|
isc_sockaddr_fromin(sockaddr, &in4, port);
|
|
|
|
else {
|
2000-04-29 01:39:32 +00:00
|
|
|
he = gethostbyname(host);
|
2000-04-26 18:34:17 +00:00
|
|
|
if (he == NULL)
|
2000-04-26 19:36:40 +00:00
|
|
|
fatal("Couldn't look up your server host %s. errno=%d",
|
2000-05-02 23:23:12 +00:00
|
|
|
host, h_errno);
|
2000-04-26 18:34:17 +00:00
|
|
|
INSIST(he->h_addrtype == AF_INET);
|
|
|
|
isc_sockaddr_fromin(sockaddr,
|
|
|
|
(struct in_addr *)(he->h_addr_list[0]),
|
|
|
|
port);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-12 01:02:37 +00:00
|
|
|
static void
|
2000-04-26 19:36:40 +00:00
|
|
|
do_lookup_tcp(dig_lookup_t *lookup) {
|
2000-04-26 18:34:17 +00:00
|
|
|
dig_query_t *query;
|
|
|
|
isc_result_t result;
|
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("do_lookup_tcp()");
|
2000-04-26 18:34:17 +00:00
|
|
|
lookup->pending = ISC_TRUE;
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_interval_set(&lookup->interval, timeout, 0);
|
|
|
|
result = isc_timer_create(timermgr, isc_timertype_once, NULL,
|
2000-05-26 22:03:00 +00:00
|
|
|
&lookup->interval, global_task,
|
|
|
|
connect_timeout, lookup, &lookup->timer);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
check_result(result, "isc_timer_create");
|
2000-04-26 18:34:17 +00:00
|
|
|
|
|
|
|
for (query = ISC_LIST_HEAD(lookup->q);
|
|
|
|
query != NULL;
|
|
|
|
query = ISC_LIST_NEXT(query, link)) {
|
|
|
|
query->working = ISC_TRUE;
|
|
|
|
query->waiting_connect = ISC_TRUE;
|
|
|
|
get_address(query->servname, port, &query->sockaddr);
|
|
|
|
|
2000-05-24 23:39:30 +00:00
|
|
|
sockcount++;
|
|
|
|
debug ("Socket = %d",sockcount);
|
|
|
|
ENSURE (query->sock == NULL);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
result = isc_socket_create(socketmgr,
|
|
|
|
isc_sockaddr_pf(&query->sockaddr),
|
|
|
|
isc_sockettype_tcp, &query->sock) ;
|
|
|
|
check_result(result, "isc_socket_create");
|
2000-05-19 17:54:04 +00:00
|
|
|
if (specified_source) {
|
|
|
|
result = isc_socket_bind(query->sock, &bind_address);
|
|
|
|
check_result(result, "isc_socket_bind");
|
|
|
|
}
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
result = isc_socket_connect(query->sock, &query->sockaddr,
|
2000-05-26 22:03:00 +00:00
|
|
|
global_task, connect_done, query);
|
2000-04-26 18:34:17 +00:00
|
|
|
check_result (result, "isc_socket_connect");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-12 01:02:37 +00:00
|
|
|
static void
|
2000-04-26 19:36:40 +00:00
|
|
|
do_lookup_udp(dig_lookup_t *lookup) {
|
2000-04-26 18:34:17 +00:00
|
|
|
dig_query_t *query;
|
|
|
|
isc_result_t result;
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("do_lookup_udp()");
|
2000-05-12 01:02:37 +00:00
|
|
|
if (lookup->tcp_mode)
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("I'm starting UDP with tcp_mode set!!!");
|
2000-04-26 18:34:17 +00:00
|
|
|
#endif
|
|
|
|
lookup->pending = ISC_TRUE;
|
|
|
|
|
|
|
|
for (query = ISC_LIST_HEAD(lookup->q);
|
|
|
|
query != NULL;
|
|
|
|
query = ISC_LIST_NEXT(query, link)) {
|
|
|
|
query->working = ISC_TRUE;
|
|
|
|
query->waiting_connect = ISC_FALSE;
|
|
|
|
get_address(query->servname, port, &query->sockaddr);
|
|
|
|
|
2000-05-24 23:39:30 +00:00
|
|
|
sockcount++;
|
|
|
|
debug ("Socket = %d",sockcount);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
result = isc_socket_create(socketmgr,
|
|
|
|
isc_sockaddr_pf(&query->sockaddr),
|
|
|
|
isc_sockettype_udp, &query->sock) ;
|
|
|
|
check_result(result, "isc_socket_create");
|
2000-05-19 17:54:04 +00:00
|
|
|
if (specified_source) {
|
|
|
|
result = isc_socket_bind(query->sock, &bind_address);
|
|
|
|
check_result(result, "isc_socket_bind");
|
|
|
|
}
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
2000-05-02 23:23:12 +00:00
|
|
|
|
|
|
|
send_udp(lookup);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
|
2000-05-12 01:02:37 +00:00
|
|
|
void
|
|
|
|
do_lookup(dig_lookup_t *lookup) {
|
|
|
|
|
|
|
|
REQUIRE (lookup != NULL);
|
|
|
|
|
2000-05-12 18:45:38 +00:00
|
|
|
debug ("do_lookup()");
|
2000-05-12 01:02:37 +00:00
|
|
|
if (lookup->tcp_mode)
|
|
|
|
do_lookup_tcp(lookup);
|
|
|
|
else
|
|
|
|
do_lookup_udp(lookup);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
start_lookup(void) {
|
|
|
|
dig_lookup_t *lookup;
|
|
|
|
|
|
|
|
debug ("start_lookup()");
|
2000-05-22 22:56:31 +00:00
|
|
|
|
|
|
|
if (free_now)
|
|
|
|
return;
|
|
|
|
|
2000-05-12 01:02:37 +00:00
|
|
|
lookup = ISC_LIST_HEAD(lookup_list);
|
|
|
|
if (lookup != NULL) {
|
|
|
|
setup_lookup(lookup);
|
|
|
|
do_lookup(lookup);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-09 18:05:13 +00:00
|
|
|
void
|
2000-05-16 17:53:35 +00:00
|
|
|
free_lists(int _exitcode) {
|
2000-04-26 18:34:17 +00:00
|
|
|
void *ptr;
|
|
|
|
dig_lookup_t *l;
|
|
|
|
dig_query_t *q;
|
|
|
|
dig_server_t *s;
|
2000-05-02 23:23:12 +00:00
|
|
|
dig_searchlist_t *o;
|
2000-04-26 18:34:17 +00:00
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
debug("free_lists()");
|
|
|
|
|
2000-05-02 23:23:12 +00:00
|
|
|
if (free_now)
|
|
|
|
return;
|
|
|
|
|
2000-04-29 00:12:56 +00:00
|
|
|
free_now = ISC_TRUE;
|
|
|
|
|
2000-04-26 18:34:17 +00:00
|
|
|
l = ISC_LIST_HEAD(lookup_list);
|
|
|
|
while (l != NULL) {
|
|
|
|
q = ISC_LIST_HEAD(l->q);
|
|
|
|
while (q != NULL) {
|
2000-04-28 21:41:19 +00:00
|
|
|
if (q->sock != NULL) {
|
|
|
|
isc_socket_cancel(q->sock, NULL,
|
|
|
|
ISC_SOCKCANCEL_ALL);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_socket_detach(&q->sock);
|
2000-05-24 23:39:30 +00:00
|
|
|
sockcount--;
|
|
|
|
debug ("Socket = %d",sockcount);
|
2000-04-28 21:41:19 +00:00
|
|
|
}
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
if (ISC_LINK_LINKED(&q->recvbuf, link))
|
|
|
|
ISC_LIST_DEQUEUE(q->recvlist, &q->recvbuf,
|
|
|
|
link);
|
|
|
|
if (ISC_LINK_LINKED(&q->lengthbuf, link))
|
|
|
|
ISC_LIST_DEQUEUE(q->lengthlist, &q->lengthbuf,
|
|
|
|
link);
|
|
|
|
isc_buffer_invalidate(&q->recvbuf);
|
|
|
|
isc_buffer_invalidate(&q->lengthbuf);
|
2000-04-26 18:34:17 +00:00
|
|
|
ptr = q;
|
|
|
|
q = ISC_LIST_NEXT(q, link);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_mem_free(mctx, ptr);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
2000-04-28 21:41:19 +00:00
|
|
|
if (l->use_my_server_list) {
|
|
|
|
s = ISC_LIST_HEAD(l->my_server_list);
|
|
|
|
while (s != NULL) {
|
|
|
|
ptr = s;
|
|
|
|
s = ISC_LIST_NEXT(s, link);
|
|
|
|
isc_mem_free(mctx, ptr);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2000-04-26 18:34:17 +00:00
|
|
|
if (l->sendmsg != NULL)
|
2000-04-27 23:20:29 +00:00
|
|
|
dns_message_destroy (&l->sendmsg);
|
2000-04-26 18:34:17 +00:00
|
|
|
if (l->timer != NULL)
|
2000-04-27 23:20:29 +00:00
|
|
|
isc_timer_detach (&l->timer);
|
2000-04-26 18:34:17 +00:00
|
|
|
ptr = l;
|
|
|
|
l = ISC_LIST_NEXT(l, link);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_mem_free(mctx, ptr);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
|
|
|
s = ISC_LIST_HEAD(server_list);
|
|
|
|
while (s != NULL) {
|
|
|
|
ptr = s;
|
|
|
|
s = ISC_LIST_NEXT(s, link);
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_mem_free(mctx, ptr);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|
2000-05-02 23:23:12 +00:00
|
|
|
o = ISC_LIST_HEAD(search_list);
|
|
|
|
while (o != NULL) {
|
|
|
|
ptr = o;
|
|
|
|
o = ISC_LIST_NEXT(o, link);
|
|
|
|
isc_mem_free(mctx, ptr);
|
|
|
|
}
|
2000-04-26 18:34:17 +00:00
|
|
|
if (socketmgr != NULL)
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_socketmgr_destroy(&socketmgr);
|
2000-04-26 18:34:17 +00:00
|
|
|
if (timermgr != NULL)
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_timermgr_destroy(&timermgr);
|
2000-05-26 22:03:00 +00:00
|
|
|
if (global_task != NULL)
|
|
|
|
isc_task_detach(&global_task);
|
2000-04-26 18:34:17 +00:00
|
|
|
if (taskmgr != NULL)
|
103. [func] libisc buffer API changes for <isc/buffer.h>:
Added:
isc_buffer_base(b) (pointer)
isc_buffer_current(b) (pointer)
isc_buffer_active(b) (pointer)
isc_buffer_used(b) (pointer)
isc_buffer_length(b) (int)
isc_buffer_usedlength(b) (int)
isc_buffer_consumedlength(b) (int)
isc_buffer_remaininglength(b) (int)
isc_buffer_activelength(b) (int)
isc_buffer_availablelength(b) (int)
Removed:
ISC_BUFFER_USEDCOUNT(b)
ISC_BUFFER_AVAILABLECOUNT(b)
isc_buffer_type(b)
Changed names:
isc_buffer_used(b, r) ->
isc_buffer_usedregion(b, r)
isc_buffer_available(b, r) ->
isc_buffer_available_region(b, r)
isc_buffer_consumed(b, r) ->
isc_buffer_consumedregion(b, r)
isc_buffer_active(b, r) ->
isc_buffer_activeregion(b, r)
isc_buffer_remaining(b, r) ->
isc_buffer_remainingregion(b, r)
Buffer types were removed, so the ISC_BUFFERTYPE_*
macros are no more, and the type argument to
isc_buffer_init and isc_buffer_allocate were removed.
isc_buffer_putstr is now void (instead of isc_result_t)
and requires that the caller ensure that there
is enough available buffer space for the string.
2000-04-27 00:03:12 +00:00
|
|
|
isc_taskmgr_destroy(&taskmgr);
|
2000-05-02 23:23:12 +00:00
|
|
|
|
|
|
|
#ifdef MEMDEBUG
|
|
|
|
isc_mem_stats(mctx, stderr);
|
|
|
|
#endif
|
|
|
|
isc_app_finish();
|
|
|
|
if (mctx != NULL)
|
|
|
|
isc_mem_destroy(&mctx);
|
|
|
|
|
2000-05-16 17:53:35 +00:00
|
|
|
debug("Getting ready to exit, code=%d",_exitcode);
|
|
|
|
if (_exitcode != 0)
|
|
|
|
exit(_exitcode);
|
2000-04-26 18:34:17 +00:00
|
|
|
}
|