summaryrefslogtreecommitdiff
path: root/usr.bin/dig/dighost.c
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2020-09-14 08:40:45 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2020-09-14 08:40:45 +0000
commit34cca05c4ff9397afd4d16562d8d391973804ffb (patch)
tree9b956a296045b1a69f0df50b42f72c7ac5ef6e33 /usr.bin/dig/dighost.c
parent91273258f09702d56f03712ff5f914eecc3b3cf8 (diff)
Mechanically replace isc_boolean_t with int.
OK deraadt
Diffstat (limited to 'usr.bin/dig/dighost.c')
-rw-r--r--usr.bin/dig/dighost.c390
1 files changed, 195 insertions, 195 deletions
diff --git a/usr.bin/dig/dighost.c b/usr.bin/dig/dighost.c
index 982e6236b83..eb775a489a4 100644
--- a/usr.bin/dig/dighost.c
+++ b/usr.bin/dig/dighost.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dighost.c,v 1.28 2020/09/14 08:39:12 florian Exp $ */
+/* $Id: dighost.c,v 1.29 2020/09/14 08:40:43 florian Exp $ */
/*! \file
* \note
@@ -78,18 +78,18 @@ dig_serverlist_t server_list;
dig_serverlist_t root_hints_server_list;
dig_searchlistlist_t search_list;
-isc_boolean_t
- check_ra = ISC_FALSE,
- have_ipv4 = ISC_TRUE,
- have_ipv6 = ISC_TRUE,
- specified_source = ISC_FALSE,
- free_now = ISC_FALSE,
- cancel_now = ISC_FALSE,
- usesearch = ISC_FALSE,
- showsearch = ISC_FALSE,
- qr = ISC_FALSE,
- is_dst_up = ISC_FALSE,
- keep_open = ISC_FALSE;
+int
+ check_ra = 0,
+ have_ipv4 = 1,
+ have_ipv6 = 1,
+ specified_source = 0,
+ free_now = 0,
+ cancel_now = 0,
+ usesearch = 0,
+ showsearch = 0,
+ qr = 0,
+ is_dst_up = 0,
+ keep_open = 0;
in_port_t port = 53;
unsigned int timeout = 0;
unsigned int extrabytes;
@@ -165,9 +165,9 @@ dns_name_t *hmacname = NULL;
unsigned int digestbits = 0;
isc_buffer_t *namebuf = NULL;
dns_tsigkey_t *tsigkey = NULL;
-isc_boolean_t validated = ISC_TRUE;
-isc_boolean_t debugging = ISC_FALSE;
-isc_boolean_t debugtiming = ISC_FALSE;
+int validated = 1;
+int debugging = 0;
+int debugtiming = 0;
char *progname = NULL;
dig_lookup_t *current_lookup = NULL;
@@ -177,7 +177,7 @@ dig_lookup_t *current_lookup = NULL;
isc_result_t
(*dighost_printmessage)(dig_query_t *query, dns_message_t *msg,
- isc_boolean_t headers);
+ int headers);
void
(*dighost_received)(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query);
@@ -203,12 +203,12 @@ static void
connect_timeout(isc_task_t *task, isc_event_t *event);
static void
-launch_next_query(dig_query_t *query, isc_boolean_t include_question);
+launch_next_query(dig_query_t *query, int include_question);
static void
check_next_lookup(dig_lookup_t *lookup);
-static isc_boolean_t
+static int
next_origin(dig_lookup_t *oldlookup);
char *
@@ -305,8 +305,8 @@ reverse_octets(const char *in, char **p, char *end) {
}
isc_result_t
-get_reverse(char *reverse, size_t len, char *value, isc_boolean_t ip6_int,
- isc_boolean_t strict)
+get_reverse(char *reverse, size_t len, char *value, int ip6_int,
+ int strict)
{
int r;
isc_result_t result;
@@ -641,65 +641,65 @@ make_empty_lookup(void) {
if (looknew == NULL)
fatal("memory allocation failure in %s:%d",
__FILE__, __LINE__);
- looknew->pending = ISC_TRUE;
+ looknew->pending = 1;
looknew->textname[0] = 0;
looknew->cmdline[0] = 0;
looknew->rdtype = dns_rdatatype_a;
looknew->qrdtype = dns_rdatatype_a;
looknew->rdclass = dns_rdataclass_in;
- looknew->rdtypeset = ISC_FALSE;
- looknew->rdclassset = ISC_FALSE;
+ looknew->rdtypeset = 0;
+ looknew->rdclassset = 0;
looknew->sendspace = NULL;
looknew->sendmsg = NULL;
looknew->name = NULL;
looknew->oname = NULL;
looknew->xfr_q = NULL;
looknew->current_query = NULL;
- looknew->doing_xfr = ISC_FALSE;
+ looknew->doing_xfr = 0;
looknew->ixfr_serial = 0;
- looknew->trace = ISC_FALSE;
- looknew->trace_root = ISC_FALSE;
- looknew->identify = ISC_FALSE;
- looknew->identify_previous_line = ISC_FALSE;
- looknew->ignore = ISC_FALSE;
- looknew->servfail_stops = ISC_TRUE;
- looknew->besteffort = ISC_TRUE;
- looknew->dnssec = ISC_FALSE;
+ looknew->trace = 0;
+ looknew->trace_root = 0;
+ looknew->identify = 0;
+ looknew->identify_previous_line = 0;
+ looknew->ignore = 0;
+ looknew->servfail_stops = 1;
+ looknew->besteffort = 1;
+ looknew->dnssec = 0;
looknew->ednsflags = 0;
looknew->opcode = dns_opcode_query;
- looknew->expire = ISC_FALSE;
- looknew->nsid = ISC_FALSE;
- looknew->idnout = ISC_FALSE;
- looknew->sit = ISC_FALSE;
+ looknew->expire = 0;
+ looknew->nsid = 0;
+ looknew->idnout = 0;
+ looknew->sit = 0;
looknew->udpsize = 0;
looknew->edns = -1;
- looknew->recurse = ISC_TRUE;
- looknew->aaonly = ISC_FALSE;
- looknew->adflag = ISC_FALSE;
- looknew->cdflag = ISC_FALSE;
- looknew->ns_search_only = ISC_FALSE;
+ looknew->recurse = 1;
+ looknew->aaonly = 0;
+ looknew->adflag = 0;
+ looknew->cdflag = 0;
+ looknew->ns_search_only = 0;
looknew->origin = NULL;
looknew->tsigctx = NULL;
looknew->querysig = NULL;
looknew->retries = tries;
looknew->nsfound = 0;
- looknew->tcp_mode = ISC_FALSE;
- looknew->tcp_mode_set = ISC_FALSE;
- looknew->ip6_int = ISC_FALSE;
- looknew->comments = ISC_TRUE;
- looknew->stats = ISC_TRUE;
- looknew->section_question = ISC_TRUE;
- looknew->section_answer = ISC_TRUE;
- looknew->section_authority = ISC_TRUE;
- looknew->section_additional = ISC_TRUE;
- looknew->new_search = ISC_FALSE;
- looknew->done_as_is = ISC_FALSE;
- looknew->need_search = ISC_FALSE;
+ looknew->tcp_mode = 0;
+ looknew->tcp_mode_set = 0;
+ looknew->ip6_int = 0;
+ looknew->comments = 1;
+ looknew->stats = 1;
+ looknew->section_question = 1;
+ looknew->section_answer = 1;
+ looknew->section_authority = 1;
+ looknew->section_additional = 1;
+ looknew->new_search = 0;
+ looknew->done_as_is = 0;
+ looknew->need_search = 0;
looknew->ecs_addr = NULL;
looknew->sitvalue = NULL;
looknew->ednsopts = NULL;
looknew->ednsoptscnt = 0;
- looknew->ednsneg = ISC_FALSE;
+ looknew->ednsneg = 0;
looknew->eoferr = 0;
dns_fixedname_init(&looknew->fdomain);
ISC_LINK_INIT(looknew, link);
@@ -752,7 +752,7 @@ cloneopts(dig_lookup_t *looknew, dig_lookup_t *lookold) {
* list separately from somewhere else, or construct it by hand.
*/
dig_lookup_t *
-clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
+clone_lookup(dig_lookup_t *lookold, int servers) {
dig_lookup_t *looknew;
debug("clone_lookup()");
@@ -841,7 +841,7 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
* queue getting run.
*/
dig_lookup_t *
-requeue_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
+requeue_lookup(dig_lookup_t *lookold, int servers) {
dig_lookup_t *looknew;
debug("requeue_lookup()");
@@ -897,7 +897,7 @@ setup_text_key(void) {
goto failure;
result = dns_tsigkey_create(&keyname, hmacname, secretstore,
- (int)secretsize, ISC_FALSE, NULL, 0, 0,
+ (int)secretsize, 0, NULL, 0, 0,
&tsigkey);
failure:
if (result != ISC_R_SUCCESS)
@@ -930,8 +930,8 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) {
struct in6_addr in6;
uint32_t prefix_length = 0xffffffff;
char *slash = NULL;
- isc_boolean_t parsed = ISC_FALSE;
- isc_boolean_t prefix_parsed = ISC_FALSE;
+ int parsed = 0;
+ int prefix_parsed = 0;
char buf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:XXX.XXX.XXX.XXX/128")];
const char *errstr;
@@ -958,16 +958,16 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) {
if (errstr != NULL) {
fatal("prefix length is %s: '%s'", errstr, value);
}
- prefix_parsed = ISC_TRUE;
+ prefix_parsed = 1;
}
if (inet_pton(AF_INET6, buf, &in6) == 1) {
- parsed = ISC_TRUE;
+ parsed = 1;
isc_sockaddr_fromin6(sa, &in6, 0);
if (prefix_length > 128)
prefix_length = 128;
} else if (inet_pton(AF_INET, buf, &in4) == 1) {
- parsed = ISC_TRUE;
+ parsed = 1;
isc_sockaddr_fromin(sa, &in4, 0);
if (prefix_length > 32)
prefix_length = 32;
@@ -977,7 +977,7 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) {
for (i = 0; i < 3 && strlen(buf) < sizeof(buf) - 2; i++) {
strlcat(buf, ".0", sizeof(buf));
if (inet_pton(AF_INET, buf, &in4) == 1) {
- parsed = ISC_TRUE;
+ parsed = 1;
isc_sockaddr_fromin(sa, &in4, 0);
break;
}
@@ -1153,7 +1153,7 @@ create_search_list(lwres_conf_t *confdata) {
* settings.
*/
void
-setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only) {
+setup_system(int ipv4only, int ipv6only) {
dig_searchlist_t *domain = NULL;
lwres_result_t lwresult;
int lwresflags = 0;
@@ -1162,14 +1162,14 @@ setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only) {
if (ipv4only) {
if (have_ipv4)
- have_ipv6 = ISC_FALSE;
+ have_ipv6 = 0;
else
fatal("can't find IPv4 networking");
}
if (ipv6only) {
if (have_ipv6)
- have_ipv4 = ISC_FALSE;
+ have_ipv4 = 0;
else
fatal("can't find IPv6 networking");
}
@@ -1280,7 +1280,7 @@ setup_libs(void) {
result = dst_lib_init();
check_result(result, "dst_lib_init");
- is_dst_up = ISC_TRUE;
+ is_dst_up = 1;
}
typedef struct dig_ednsoptname {
@@ -1311,7 +1311,7 @@ save_opt(dig_lookup_t *lookup, char *code, char *value) {
isc_result_t result;
uint32_t num = 0;
isc_buffer_t b;
- isc_boolean_t found = ISC_FALSE;
+ int found = 0;
unsigned int i;
const char *errstr;
@@ -1321,7 +1321,7 @@ save_opt(dig_lookup_t *lookup, char *code, char *value) {
for (i = 0; i < N_EDNS_OPTNAMES; i++) {
if (strcasecmp(code, optnames[i].name) == 0) {
num = optnames[i].code;
- found = ISC_TRUE;
+ found = 1;
break;
}
}
@@ -1460,17 +1460,17 @@ clear_query(dig_query_t *query) {
isc_buffer_invalidate(&query->recvbuf);
isc_buffer_invalidate(&query->lengthbuf);
if (query->waiting_senddone)
- query->pending_free = ISC_TRUE;
+ query->pending_free = 1;
else
free(query);
}
/*%
- * Try and clear out a lookup if we're done with it. Return ISC_TRUE if
- * the lookup was successfully cleared. If ISC_TRUE is returned, the
+ * Try and clear out a lookup if we're done with it. Return 1 if
+ * the lookup was successfully cleared. If 1 is returned, the
* lookup pointer has been invalidated.
*/
-static isc_boolean_t
+static int
try_clear_lookup(dig_lookup_t *lookup) {
dig_query_t *q;
@@ -1495,7 +1495,7 @@ try_clear_lookup(dig_lookup_t *lookup) {
q = ISC_LIST_NEXT(q, clink);
}
}
- return (ISC_FALSE);
+ return (0);
}
/*
@@ -1503,7 +1503,7 @@ try_clear_lookup(dig_lookup_t *lookup) {
* so can make it go away also.
*/
destroy_lookup(lookup);
- return (ISC_TRUE);
+ return (1);
}
void
@@ -1617,13 +1617,13 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section)
dns_rdata_t rdata = DNS_RDATA_INIT;
dns_name_t *name = NULL;
isc_result_t result;
- isc_boolean_t success = ISC_FALSE;
+ int success = 0;
int numLookups = 0;
int num;
isc_result_t lresult, addresses_result;
char bad_namestr[DNS_NAME_FORMATSIZE];
dns_name_t *domain;
- isc_boolean_t horizontal = ISC_FALSE, bad = ISC_FALSE;
+ int horizontal = 0, bad = 0;
INSIST(!free_now);
@@ -1663,11 +1663,11 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section)
if (namereln == dns_namereln_equal) {
if (!horizontal)
printf(";; BAD (HORIZONTAL) REFERRAL\n");
- horizontal = ISC_TRUE;
+ horizontal = 1;
} else if (namereln != dns_namereln_subdomain) {
if (!bad)
printf(";; BAD REFERRAL\n");
- bad = ISC_TRUE;
+ bad = 1;
continue;
}
}
@@ -1693,22 +1693,22 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section)
/* Initialize lookup if we've not yet */
debug("found NS %s", namestr);
if (!success) {
- success = ISC_TRUE;
+ success = 1;
lookup_counter++;
lookup = requeue_lookup(query->lookup,
- ISC_FALSE);
+ 0);
cancel_lookup(query->lookup);
- lookup->doing_xfr = ISC_FALSE;
+ lookup->doing_xfr = 0;
if (!lookup->trace_root &&
section == DNS_SECTION_ANSWER)
- lookup->trace = ISC_FALSE;
+ lookup->trace = 0;
else
lookup->trace = query->lookup->trace;
lookup->ns_search_only =
query->lookup->ns_search_only;
- lookup->trace_root = ISC_FALSE;
+ lookup->trace_root = 0;
if (lookup->ns_search_only)
- lookup->recurse = ISC_FALSE;
+ lookup->recurse = 0;
domain = dns_fixedname_name(&lookup->fdomain);
dns_name_copy(name, domain, NULL);
}
@@ -1773,9 +1773,9 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section)
* Create and queue a new lookup using the next origin from the search
* list, read in setup_system().
*
- * Return ISC_TRUE iff there was another searchlist entry.
+ * Return 1 iff there was another searchlist entry.
*/
-static isc_boolean_t
+static int
next_origin(dig_lookup_t *oldlookup) {
dig_lookup_t *newlookup;
dig_searchlist_t *search;
@@ -1793,7 +1793,7 @@ next_origin(dig_lookup_t *oldlookup) {
* We're not using a search list, so don't even think
* about finding the next entry.
*/
- return (ISC_FALSE);
+ return (0);
/*
* Check for a absolute name or ndots being met.
@@ -1804,26 +1804,26 @@ next_origin(dig_lookup_t *oldlookup) {
if (result == ISC_R_SUCCESS &&
(dns_name_isabsolute(name) ||
(int)dns_name_countlabels(name) > ndots))
- return (ISC_FALSE);
+ return (0);
if (oldlookup->origin == NULL && !oldlookup->need_search)
/*
* Then we just did rootorg; there's nothing left.
*/
- return (ISC_FALSE);
+ return (0);
if (oldlookup->origin == NULL && oldlookup->need_search) {
- newlookup = requeue_lookup(oldlookup, ISC_TRUE);
+ newlookup = requeue_lookup(oldlookup, 1);
newlookup->origin = ISC_LIST_HEAD(search_list);
- newlookup->need_search = ISC_FALSE;
+ newlookup->need_search = 0;
} else {
search = ISC_LIST_NEXT(oldlookup->origin, link);
if (search == NULL && oldlookup->done_as_is)
- return (ISC_FALSE);
- newlookup = requeue_lookup(oldlookup, ISC_TRUE);
+ return (0);
+ newlookup = requeue_lookup(oldlookup, 1);
newlookup->origin = search;
}
cancel_lookup(oldlookup);
- return (ISC_TRUE);
+ return (1);
}
/*%
@@ -1922,7 +1922,7 @@ populate_root_hints(void)
* well as the query structures and buffer space for the replies. If the
* server list is empty, clone it from the system default list.
*/
-isc_boolean_t
+int
setup_lookup(dig_lookup_t *lookup) {
isc_result_t result;
uint32_t id;
@@ -1979,11 +1979,11 @@ setup_lookup(dig_lookup_t *lookup) {
if (lookup->new_search) {
if ((count_dots(lookup->textname) >= ndots) || !usesearch) {
lookup->origin = NULL; /* Force abs lookup */
- lookup->done_as_is = ISC_TRUE;
+ lookup->done_as_is = 1;
lookup->need_search = usesearch;
} else if (lookup->origin == NULL && usesearch) {
lookup->origin = ISC_LIST_HEAD(search_list);
- lookup->need_search = ISC_FALSE;
+ lookup->need_search = 0;
}
}
@@ -2035,7 +2035,7 @@ setup_lookup(dig_lookup_t *lookup) {
dns_message_puttempname(lookup->sendmsg,
&lookup->oname);
if (result == DNS_R_NAMETOOLONG)
- return (ISC_FALSE);
+ return (0);
fatal("'%s' is not in legal name syntax (%s)",
lookup->textname,
isc_result_totext(result));
@@ -2076,7 +2076,7 @@ setup_lookup(dig_lookup_t *lookup) {
* it's meaningless for traces.
*/
if (lookup->trace || (lookup->ns_search_only && !lookup->trace_root))
- lookup->recurse = ISC_FALSE;
+ lookup->recurse = 0;
if (lookup->recurse &&
lookup->rdtype != dns_rdatatype_axfr &&
@@ -2115,10 +2115,10 @@ setup_lookup(dig_lookup_t *lookup) {
* Force TCP mode if we're doing an axfr.
*/
if (lookup->rdtype == dns_rdatatype_axfr) {
- lookup->doing_xfr = ISC_TRUE;
- lookup->tcp_mode = ISC_TRUE;
+ lookup->doing_xfr = 1;
+ lookup->tcp_mode = 1;
} else if (lookup->tcp_mode) {
- lookup->doing_xfr = ISC_TRUE;
+ lookup->doing_xfr = 1;
}
}
@@ -2311,9 +2311,9 @@ setup_lookup(dig_lookup_t *lookup) {
* Force TCP mode if the request is larger than 512 bytes.
*/
if (isc_buffer_usedlength(&lookup->renderbuf) > 512)
- lookup->tcp_mode = ISC_TRUE;
+ lookup->tcp_mode = 1;
- lookup->pending = ISC_FALSE;
+ lookup->pending = 0;
for (serv = ISC_LIST_HEAD(lookup->my_server_list);
serv != NULL;
@@ -2326,16 +2326,16 @@ setup_lookup(dig_lookup_t *lookup) {
query, lookup);
query->lookup = lookup;
query->timer = NULL;
- query->waiting_connect = ISC_FALSE;
- query->waiting_senddone = ISC_FALSE;
- query->pending_free = ISC_FALSE;
- query->recv_made = ISC_FALSE;
- query->first_pass = ISC_TRUE;
- query->first_soa_rcvd = ISC_FALSE;
- query->second_rr_rcvd = ISC_FALSE;
- query->first_repeat_rcvd = ISC_FALSE;
- query->warn_id = ISC_TRUE;
- query->timedout = ISC_FALSE;
+ query->waiting_connect = 0;
+ query->waiting_senddone = 0;
+ query->pending_free = 0;
+ query->recv_made = 0;
+ query->first_pass = 1;
+ query->first_soa_rcvd = 0;
+ query->second_rr_rcvd = 0;
+ query->first_repeat_rcvd = 0;
+ query->warn_id = 1;
+ query->timedout = 0;
query->first_rr_serial = 0;
query->second_rr_serial = 0;
query->servname = serv->servername;
@@ -2343,7 +2343,7 @@ setup_lookup(dig_lookup_t *lookup) {
query->rr_count = 0;
query->msg_count = 0;
query->byte_count = 0;
- query->ixfr_axfr = ISC_FALSE;
+ query->ixfr_axfr = 0;
ISC_LIST_INIT(query->recvlist);
ISC_LIST_INIT(query->lengthlist);
query->sock = NULL;
@@ -2365,9 +2365,9 @@ setup_lookup(dig_lookup_t *lookup) {
if (!ISC_LIST_EMPTY(lookup->q) && qr) {
extrabytes = 0;
dighost_printmessage(ISC_LIST_HEAD(lookup->q), lookup->sendmsg,
- ISC_TRUE);
+ 1);
}
- return (ISC_TRUE);
+ return (1);
}
/*%
@@ -2398,7 +2398,7 @@ send_done(isc_task_t *_task, isc_event_t *event) {
}
query = event->ev_arg;
- query->waiting_senddone = ISC_FALSE;
+ query->waiting_senddone = 0;
l = query->lookup;
if (l->ns_search_only && !l->trace_root && !l->tcp_mode) {
@@ -2438,7 +2438,7 @@ cancel_lookup(dig_lookup_t *lookup) {
}
query = next;
}
- lookup->pending = ISC_FALSE;
+ lookup->pending = 0;
lookup->retries = 0;
}
@@ -2515,7 +2515,7 @@ send_tcp_connect(dig_query_t *query) {
debug("send_tcp_connect(%p)", query);
l = query->lookup;
- query->waiting_connect = ISC_TRUE;
+ query->waiting_connect = 1;
query->lookup->current_query = query;
result = get_address(query->servname, port, &query->sockaddr);
if (result != ISC_R_SUCCESS) {
@@ -2533,7 +2533,7 @@ send_tcp_connect(dig_query_t *query) {
isc_sockaddr_pf(&bind_address))) {
printf(";; Skipping server %s, incompatible "
"address family\n", query->servname);
- query->waiting_connect = ISC_FALSE;
+ query->waiting_connect = 0;
if (ISC_LINK_LINKED(query, link))
next = ISC_LIST_NEXT(query, link);
else
@@ -2554,8 +2554,8 @@ send_tcp_connect(dig_query_t *query) {
if (keep != NULL && isc_sockaddr_equal(&keepaddr, &query->sockaddr)) {
sockcount++;
isc_socket_attach(keep, &query->sock);
- query->waiting_connect = ISC_FALSE;
- launch_next_query(query, ISC_TRUE);
+ query->waiting_connect = 0;
+ launch_next_query(query, 1);
goto search;
}
@@ -2629,7 +2629,7 @@ send_udp(dig_query_t *query) {
debug("working on lookup %p, query %p", query->lookup, query);
if (!query->recv_made) {
/* XXX Check the sense of this, need assertion? */
- query->waiting_connect = ISC_FALSE;
+ query->waiting_connect = 0;
result = get_address(query->servname, port, &query->sockaddr);
if (result != ISC_R_SUCCESS) {
/* This servname doesn't have an address. */
@@ -2653,7 +2653,7 @@ send_udp(dig_query_t *query) {
}
check_result(result, "isc_socket_bind");
- query->recv_made = ISC_TRUE;
+ query->recv_made = 1;
ISC_LINK_INIT(&query->recvbuf, link);
ISC_LIST_ENQUEUE(query->recvlist, &query->recvbuf,
link);
@@ -2671,7 +2671,7 @@ send_udp(dig_query_t *query) {
debug("sending a request");
clock_gettime(CLOCK_MONOTONIC, &query->time_sent);
INSIST(query->sock != NULL);
- query->waiting_senddone = ISC_TRUE;
+ query->waiting_senddone = 1;
result = isc_socket_sendtov2(query->sock, &query->sendlist,
global_task, send_done, query,
&query->sockaddr, NULL,
@@ -2718,7 +2718,7 @@ connect_timeout(isc_task_t *task, isc_event_t *event) {
}
if (l->tcp_mode && query->sock != NULL) {
- query->timedout = ISC_TRUE;
+ query->timedout = 1;
isc_socket_cancel(query->sock, NULL, ISC_SOCKCANCEL_ALL);
}
@@ -2731,7 +2731,7 @@ connect_timeout(isc_task_t *task, isc_event_t *event) {
debug("making new TCP request, %d tries left",
l->retries);
l->retries--;
- requeue_lookup(l, ISC_TRUE);
+ requeue_lookup(l, 1);
cancel_lookup(l);
check_next_lookup(l);
}
@@ -2799,7 +2799,7 @@ tcp_length_done(isc_task_t *task, isc_event_t *event) {
debug("sockcount=%d", sockcount);
INSIST(sockcount >= 0);
if (sevent->result == ISC_R_EOF && l->eoferr == 0U) {
- n = requeue_lookup(l, ISC_TRUE);
+ n = requeue_lookup(l, 1);
n->eoferr++;
}
isc_event_free(&event);
@@ -2811,7 +2811,7 @@ tcp_length_done(isc_task_t *task, isc_event_t *event) {
length = isc_buffer_getuint16(b);
if (length == 0) {
isc_event_free(&event);
- launch_next_query(query, ISC_FALSE);
+ launch_next_query(query, 0);
return;
}
@@ -2839,7 +2839,7 @@ tcp_length_done(isc_task_t *task, isc_event_t *event) {
* launch the next recv.
*/
static void
-launch_next_query(dig_query_t *query, isc_boolean_t include_question) {
+launch_next_query(dig_query_t *query, int include_question) {
isc_result_t result;
dig_lookup_t *l;
isc_buffer_t *buffer;
@@ -2854,7 +2854,7 @@ launch_next_query(dig_query_t *query, isc_boolean_t include_question) {
sockcount--;
debug("sockcount=%d", sockcount);
INSIST(sockcount >= 0);
- query->waiting_connect = ISC_FALSE;
+ query->waiting_connect = 0;
l = query->lookup;
clear_query(query);
check_next_lookup(l);
@@ -2886,14 +2886,14 @@ launch_next_query(dig_query_t *query, isc_boolean_t include_question) {
if (!query->first_soa_rcvd) {
debug("sending a request in launch_next_query");
clock_gettime(CLOCK_MONOTONIC, &query->time_sent);
- query->waiting_senddone = ISC_TRUE;
+ query->waiting_senddone = 1;
result = isc_socket_sendv(query->sock, &query->sendlist,
global_task, send_done, query);
check_result(result, "isc_socket_sendv");
sendcount++;
debug("sendcount=%d", sendcount);
}
- query->waiting_connect = ISC_FALSE;
+ query->waiting_connect = 0;
return;
}
@@ -2921,7 +2921,7 @@ connect_done(isc_task_t *task, isc_event_t *event) {
INSIST(query->waiting_connect);
- query->waiting_connect = ISC_FALSE;
+ query->waiting_connect = 0;
if (sevent->result == ISC_R_CANCELED) {
debug("in cancel handler");
@@ -2935,7 +2935,7 @@ connect_done(isc_task_t *task, isc_event_t *event) {
INSIST(sockcount > 0);
sockcount--;
debug("sockcount=%d", sockcount);
- query->waiting_connect = ISC_FALSE;
+ query->waiting_connect = 0;
isc_event_free(&event);
l = query->lookup;
clear_query(query);
@@ -2959,7 +2959,7 @@ connect_done(isc_task_t *task, isc_event_t *event) {
if (exitcode < 9)
exitcode = 9;
debug("sockcount=%d", sockcount);
- query->waiting_connect = ISC_FALSE;
+ query->waiting_connect = 0;
isc_event_free(&event);
l = query->lookup;
if ((l->current_query != NULL) &&
@@ -2981,7 +2981,7 @@ connect_done(isc_task_t *task, isc_event_t *event) {
isc_socket_attach(query->sock, &keep);
keepaddr = query->sockaddr;
}
- launch_next_query(query, ISC_TRUE);
+ launch_next_query(query, 1);
isc_event_free(&event);
}
@@ -2989,9 +2989,9 @@ connect_done(isc_task_t *task, isc_event_t *event) {
* Check if the ongoing XFR needs more data before it's complete, using
* the semantics of IXFR and AXFR protocols. Much of the complexity of
* this routine comes from determining when an IXFR is complete.
- * ISC_FALSE means more data is on the way, and the recv has been issued.
+ * 0 means more data is on the way, and the recv has been issued.
*/
-static isc_boolean_t
+static int
check_for_more_data(dig_query_t *query, dns_message_t *msg,
isc_socketevent_t *sevent)
{
@@ -3000,8 +3000,8 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
dns_rdata_soa_t soa;
uint32_t ixfr_serial = query->lookup->ixfr_serial, serial;
isc_result_t result;
- isc_boolean_t ixfr = query->lookup->rdtype == dns_rdatatype_ixfr;
- isc_boolean_t axfr = query->lookup->rdtype == dns_rdatatype_axfr;
+ int ixfr = query->lookup->rdtype == dns_rdatatype_ixfr;
+ int axfr = query->lookup->rdtype == dns_rdatatype_axfr;
if (ixfr)
axfr = query->ixfr_axfr;
@@ -3022,7 +3022,7 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
result = dns_message_firstname(msg, DNS_SECTION_ANSWER);
if (result != ISC_R_SUCCESS) {
puts("; Transfer failed.");
- return (ISC_TRUE);
+ return (1);
}
do {
dns_name_t *name;
@@ -3047,14 +3047,14 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
(rdata.type != dns_rdatatype_soa)) {
puts("; Transfer failed. "
"Didn't start with SOA answer.");
- return (ISC_TRUE);
+ return (1);
}
if ((!query->second_rr_rcvd) &&
(rdata.type != dns_rdatatype_soa)) {
- query->second_rr_rcvd = ISC_TRUE;
+ query->second_rr_rcvd = 1;
query->second_rr_serial = 0;
debug("got the second rr as nonsoa");
- axfr = query->ixfr_axfr = ISC_TRUE;
+ axfr = query->ixfr_axfr = 1;
goto next_rdata;
}
@@ -3072,7 +3072,7 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
serial = soa.serial;
dns_rdata_freestruct_soa(&soa);
if (!query->first_soa_rcvd) {
- query->first_soa_rcvd = ISC_TRUE;
+ query->first_soa_rcvd = 1;
query->first_rr_serial = serial;
debug("this is the first serial %u",
serial);
@@ -3096,7 +3096,7 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
}
debug("this is the second serial %u",
serial);
- query->second_rr_rcvd = ISC_TRUE;
+ query->second_rr_rcvd = 1;
query->second_rr_serial = serial;
goto next_rdata;
}
@@ -3109,7 +3109,7 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
debug("got a match for ixfr");
if (!query->first_repeat_rcvd) {
query->first_repeat_rcvd =
- ISC_TRUE;
+ 1;
goto next_rdata;
}
debug("done with ixfr");
@@ -3122,11 +3122,11 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
}
result = dns_message_nextname(msg, DNS_SECTION_ANSWER);
} while (result == ISC_R_SUCCESS);
- launch_next_query(query, ISC_FALSE);
- return (ISC_FALSE);
+ launch_next_query(query, 0);
+ return (0);
doexit:
dighost_received(sevent->n, &sevent->address, query);
- return (ISC_TRUE);
+ return (1);
}
static void
@@ -3137,7 +3137,7 @@ process_sit(dig_lookup_t *l, dns_message_t *msg,
isc_buffer_t hexbuf;
size_t len;
const unsigned char *sit;
- isc_boolean_t copysit;
+ int copysit;
isc_result_t result;
if (l->sitvalue != NULL) {
@@ -3146,11 +3146,11 @@ process_sit(dig_lookup_t *l, dns_message_t *msg,
check_result(result, "isc_hex_decodestring");
sit = isc_buffer_base(&hexbuf);
len = isc_buffer_usedlength(&hexbuf);
- copysit = ISC_FALSE;
+ copysit = 0;
} else {
sit = cookie;
len = sizeof(cookie);
- copysit = ISC_TRUE;
+ copysit = 1;
}
INSIST(msg->sitok == 0 && msg->sitbad == 0);
@@ -3160,12 +3160,12 @@ process_sit(dig_lookup_t *l, dns_message_t *msg,
} else {
printf(";; Warning: SIT client cookie mismatch\n");
msg->sitbad = 1;
- copysit = ISC_FALSE;
+ copysit = 0;
}
} else {
printf(";; Warning: SIT bad token (too short)\n");
msg->sitbad = 1;
- copysit = ISC_FALSE;
+ copysit = 0;
}
if (copysit) {
isc_region_t r;
@@ -3190,7 +3190,7 @@ process_opt(dig_lookup_t *l, dns_message_t *msg) {
isc_buffer_t optbuf;
uint16_t optcode, optlen;
dns_rdataset_t *opt = msg->opt;
- isc_boolean_t seen_cookie = ISC_FALSE;
+ int seen_cookie = 0;
result = dns_rdataset_first(opt);
if (result == ISC_R_SUCCESS) {
@@ -3211,7 +3211,7 @@ process_opt(dig_lookup_t *l, dns_message_t *msg) {
break;
}
process_sit(l, msg, &optbuf, optlen);
- seen_cookie = ISC_TRUE;
+ seen_cookie = 1;
break;
default:
isc_buffer_forward(&optbuf, optlen);
@@ -3238,8 +3238,8 @@ recv_done(isc_task_t *task, isc_event_t *event) {
dns_message_t *msg = NULL;
isc_result_t result;
dig_lookup_t *n, *l;
- isc_boolean_t docancel = ISC_FALSE;
- isc_boolean_t match = ISC_TRUE;
+ int docancel = 0;
+ int match = 1;
unsigned int parseflags;
dns_messageid_t id;
unsigned int msgflags;
@@ -3272,7 +3272,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
if ((!l->pending && !l->ns_search_only) || cancel_now) {
debug("no longer pending. Got %s",
isc_result_totext(sevent->result));
- query->waiting_connect = ISC_FALSE;
+ query->waiting_connect = 0;
isc_event_free(&event);
clear_query(query);
@@ -3283,7 +3283,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
if (sevent->result != ISC_R_SUCCESS) {
if (sevent->result == ISC_R_CANCELED) {
debug("in recv cancel handler");
- query->waiting_connect = ISC_FALSE;
+ query->waiting_connect = 0;
} else {
printf(";; communications error: %s\n",
isc_result_totext(sevent->result));
@@ -3295,7 +3295,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
INSIST(sockcount >= 0);
}
if (sevent->result == ISC_R_EOF && l->eoferr == 0U) {
- n = requeue_lookup(l, ISC_TRUE);
+ n = requeue_lookup(l, 1);
n->eoferr++;
}
isc_event_free(&event);
@@ -3335,15 +3335,15 @@ recv_done(isc_task_t *task, isc_event_t *event) {
sizeof(buf2));
printf(";; reply from unexpected source: %s,"
" expected %s\n", buf1, buf2);
- match = ISC_FALSE;
+ match = 0;
}
}
result = dns_message_peekheader(b, &id, &msgflags);
if (result != ISC_R_SUCCESS || l->sendmsg->id != id) {
- match = ISC_FALSE;
+ match = 0;
if (l->tcp_mode) {
- isc_boolean_t fail = ISC_TRUE;
+ int fail = 1;
if (result == ISC_R_SUCCESS) {
if (!query->first_soa_rcvd ||
query->warn_id)
@@ -3353,8 +3353,8 @@ recv_done(isc_task_t *task, isc_event_t *event) {
"WARNING" : "ERROR",
l->sendmsg->id, id);
if (query->first_soa_rcvd)
- fail = ISC_FALSE;
- query->warn_id = ISC_FALSE;
+ fail = 0;
+ query->warn_id = 0;
} else
printf(";; ERROR: short "
"(< header size) message\n");
@@ -3365,7 +3365,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
check_next_lookup(l);
return;
}
- match = ISC_TRUE;
+ match = 1;
} else if (result == ISC_R_SUCCESS)
printf(";; Warning: ID mismatch: "
"expected ID %u, got %u\n", l->sendmsg->id, id);
@@ -3416,7 +3416,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
if (result != ISC_R_SUCCESS) {
printf(";; Got bad packet: %s\n", isc_result_totext(result));
hex_dump(b);
- query->waiting_connect = ISC_FALSE;
+ query->waiting_connect = 0;
dns_message_destroy(&msg);
isc_event_free(&event);
clear_query(query);
@@ -3425,7 +3425,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
return;
}
if (msg->counts[DNS_SECTION_QUESTION] != 0) {
- match = ISC_TRUE;
+ match = 1;
for (result = dns_message_firstname(msg, DNS_SECTION_QUESTION);
result == ISC_R_SUCCESS && match;
result = dns_message_nextname(msg, DNS_SECTION_QUESTION)) {
@@ -3454,7 +3454,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
printf(";; Question section mismatch: "
"got %s/%s/%s\n",
namestr, typebuf, classbuf);
- match = ISC_FALSE;
+ match = 0;
}
}
}
@@ -3479,7 +3479,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
printf(";; BADVERS, retrying with EDNS version %u.\n",
(unsigned int)newedns);
l->edns = newedns;
- n = requeue_lookup(l, ISC_TRUE);
+ n = requeue_lookup(l, 1);
if (l->trace && l->trace_root)
n->rdtype = l->qrdtype;
dns_message_destroy(&msg);
@@ -3495,8 +3495,8 @@ recv_done(isc_task_t *task, isc_event_t *event) {
process_opt(l, msg);
if (l->comments)
printf(";; Truncated, retrying in TCP mode.\n");
- n = requeue_lookup(l, ISC_TRUE);
- n->tcp_mode = ISC_TRUE;
+ n = requeue_lookup(l, 1);
+ n->tcp_mode = 1;
if (l->trace && l->trace_root)
n->rdtype = l->qrdtype;
dns_message_destroy(&msg);
@@ -3546,7 +3546,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
if (result != ISC_R_SUCCESS) {
printf(";; Couldn't verify signature: %s\n",
isc_result_totext(result));
- validated = ISC_FALSE;
+ validated = 0;
}
l->tsigctx = msg->tsigctx;
msg->tsigctx = NULL;
@@ -3587,7 +3587,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
l->interval.tv_nsec = 0;
result = isc_timer_reset(query->timer,
&l->interval,
- ISC_FALSE);
+ 0);
check_result(result, "isc_timer_reset");
}
}
@@ -3604,18 +3604,18 @@ recv_done(isc_task_t *task, isc_event_t *event) {
if (msg->rcode == dns_rcode_nxdomain &&
(l->origin != NULL || l->need_search)) {
if (!next_origin(query->lookup) || showsearch) {
- dighost_printmessage(query, msg, ISC_TRUE);
+ dighost_printmessage(query, msg, 1);
dighost_received(b->used, &sevent->address, query);
}
} else if (!l->trace && !l->ns_search_only) {
- dighost_printmessage(query, msg, ISC_TRUE);
+ dighost_printmessage(query, msg, 1);
} else if (l->trace) {
int nl = 0;
int count = msg->counts[DNS_SECTION_ANSWER];
debug("in TRACE code");
if (!l->ns_search_only)
- dighost_printmessage(query, msg, ISC_TRUE);
+ dighost_printmessage(query, msg, 1);
l->rdtype = l->qrdtype;
if (l->trace_root || (l->ns_search_only && count > 0)) {
@@ -3623,12 +3623,12 @@ recv_done(isc_task_t *task, isc_event_t *event) {
l->rdtype = dns_rdatatype_soa;
nl = followup_lookup(msg, query,
DNS_SECTION_ANSWER);
- l->trace_root = ISC_FALSE;
+ l->trace_root = 0;
} else if (count == 0)
nl = followup_lookup(msg, query,
DNS_SECTION_AUTHORITY);
if (nl == 0)
- docancel = ISC_TRUE;
+ docancel = 1;
} else {
debug("in NSSEARCH code");
@@ -3642,11 +3642,11 @@ recv_done(isc_task_t *task, isc_event_t *event) {
nl = followup_lookup(msg, query,
DNS_SECTION_ANSWER);
if (nl == 0)
- docancel = ISC_TRUE;
- l->trace_root = ISC_FALSE;
- usesearch = ISC_FALSE;
+ docancel = 1;
+ l->trace_root = 0;
+ usesearch = 0;
} else
- dighost_printmessage(query, msg, ISC_TRUE);
+ dighost_printmessage(query, msg, 1);
}
}
@@ -3656,7 +3656,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
if (query != l->xfr_q) {
dns_message_destroy(&msg);
isc_event_free(&event);
- query->waiting_connect = ISC_FALSE;
+ query->waiting_connect = 0;
return;
}
if (!docancel)
@@ -3675,7 +3675,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
}
if (!query->lookup->ns_search_only)
- query->lookup->pending = ISC_FALSE;
+ query->lookup->pending = 0;
if (!query->lookup->ns_search_only ||
query->lookup->trace_root || docancel) {
dns_message_destroy(&msg);
@@ -3762,7 +3762,7 @@ do_lookup(dig_lookup_t *lookup) {
REQUIRE(lookup != NULL);
debug("do_lookup()");
- lookup->pending = ISC_TRUE;
+ lookup->pending = 1;
query = ISC_LIST_HEAD(lookup->q);
if (query != NULL) {
if (lookup->tcp_mode)
@@ -3797,7 +3797,7 @@ cancel_all(void) {
if (free_now) {
return;
}
- cancel_now = ISC_TRUE;
+ cancel_now = 1;
if (current_lookup != NULL) {
for (q = ISC_LIST_HEAD(current_lookup->q);
q != NULL;
@@ -3865,7 +3865,7 @@ destroy_libs(void) {
INSIST(current_lookup == NULL);
INSIST(!free_now);
- free_now = ISC_TRUE;
+ free_now = 1;
lwres_conf_clear(lwconf);
@@ -3891,7 +3891,7 @@ destroy_libs(void) {
if (is_dst_up) {
debug("destroy DST lib");
dst_lib_destroy();
- is_dst_up = ISC_FALSE;
+ is_dst_up = 0;
}
debug("Removing log context");