=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/dig/dighost.c,v retrieving revision 1.28 retrieving revision 1.29 diff -c -r1.28 -r1.29 *** src/usr.bin/dig/dighost.c 2020/09/14 08:39:12 1.28 --- src/usr.bin/dig/dighost.c 2020/09/14 08:40:43 1.29 *************** *** 14,20 **** * PERFORMANCE OF THIS SOFTWARE. */ ! /* $Id: dighost.c,v 1.28 2020/09/14 08:39:12 florian Exp $ */ /*! \file * \note --- 14,20 ---- * PERFORMANCE OF THIS SOFTWARE. */ ! /* $Id: dighost.c,v 1.29 2020/09/14 08:40:43 florian Exp $ */ /*! \file * \note *************** *** 78,95 **** 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; in_port_t port = 53; unsigned int timeout = 0; unsigned int extrabytes; --- 78,95 ---- dig_serverlist_t root_hints_server_list; dig_searchlistlist_t search_list; ! 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,173 **** 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; char *progname = NULL; dig_lookup_t *current_lookup = NULL; --- 165,173 ---- unsigned int digestbits = 0; isc_buffer_t *namebuf = NULL; dns_tsigkey_t *tsigkey = NULL; ! int validated = 1; ! int debugging = 0; ! int debugtiming = 0; char *progname = NULL; dig_lookup_t *current_lookup = NULL; *************** *** 177,183 **** isc_result_t (*dighost_printmessage)(dig_query_t *query, dns_message_t *msg, ! isc_boolean_t headers); void (*dighost_received)(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query); --- 177,183 ---- isc_result_t (*dighost_printmessage)(dig_query_t *query, dns_message_t *msg, ! int headers); void (*dighost_received)(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query); *************** *** 203,214 **** connect_timeout(isc_task_t *task, isc_event_t *event); static void ! launch_next_query(dig_query_t *query, isc_boolean_t include_question); static void check_next_lookup(dig_lookup_t *lookup); ! static isc_boolean_t next_origin(dig_lookup_t *oldlookup); char * --- 203,214 ---- connect_timeout(isc_task_t *task, isc_event_t *event); static void ! launch_next_query(dig_query_t *query, int include_question); static void check_next_lookup(dig_lookup_t *lookup); ! static int next_origin(dig_lookup_t *oldlookup); char * *************** *** 305,312 **** } isc_result_t ! get_reverse(char *reverse, size_t len, char *value, isc_boolean_t ip6_int, ! isc_boolean_t strict) { int r; isc_result_t result; --- 305,312 ---- } isc_result_t ! get_reverse(char *reverse, size_t len, char *value, int ip6_int, ! int strict) { int r; isc_result_t result; *************** *** 641,705 **** if (looknew == NULL) fatal("memory allocation failure in %s:%d", __FILE__, __LINE__); ! looknew->pending = ISC_TRUE; 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->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->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->ednsflags = 0; looknew->opcode = dns_opcode_query; ! looknew->expire = ISC_FALSE; ! looknew->nsid = ISC_FALSE; ! looknew->idnout = ISC_FALSE; ! looknew->sit = ISC_FALSE; 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->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->ecs_addr = NULL; looknew->sitvalue = NULL; looknew->ednsopts = NULL; looknew->ednsoptscnt = 0; ! looknew->ednsneg = ISC_FALSE; looknew->eoferr = 0; dns_fixedname_init(&looknew->fdomain); ISC_LINK_INIT(looknew, link); --- 641,705 ---- if (looknew == NULL) fatal("memory allocation failure in %s:%d", __FILE__, __LINE__); ! 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 = 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 = 0; looknew->ixfr_serial = 0; ! 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 = 0; ! looknew->nsid = 0; ! looknew->idnout = 0; ! looknew->sit = 0; looknew->udpsize = 0; looknew->edns = -1; ! 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 = 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 = 0; looknew->eoferr = 0; dns_fixedname_init(&looknew->fdomain); ISC_LINK_INIT(looknew, link); *************** *** 752,758 **** * list separately from somewhere else, or construct it by hand. */ dig_lookup_t * ! clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) { dig_lookup_t *looknew; debug("clone_lookup()"); --- 752,758 ---- * list separately from somewhere else, or construct it by hand. */ dig_lookup_t * ! clone_lookup(dig_lookup_t *lookold, int servers) { dig_lookup_t *looknew; debug("clone_lookup()"); *************** *** 841,847 **** * queue getting run. */ dig_lookup_t * ! requeue_lookup(dig_lookup_t *lookold, isc_boolean_t servers) { dig_lookup_t *looknew; debug("requeue_lookup()"); --- 841,847 ---- * queue getting run. */ dig_lookup_t * ! requeue_lookup(dig_lookup_t *lookold, int servers) { dig_lookup_t *looknew; debug("requeue_lookup()"); *************** *** 897,903 **** goto failure; result = dns_tsigkey_create(&keyname, hmacname, secretstore, ! (int)secretsize, ISC_FALSE, NULL, 0, 0, &tsigkey); failure: if (result != ISC_R_SUCCESS) --- 897,903 ---- goto failure; result = dns_tsigkey_create(&keyname, hmacname, secretstore, ! (int)secretsize, 0, NULL, 0, 0, &tsigkey); failure: if (result != ISC_R_SUCCESS) *************** *** 930,937 **** 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; char buf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:XXX.XXX.XXX.XXX/128")]; const char *errstr; --- 930,937 ---- struct in6_addr in6; uint32_t prefix_length = 0xffffffff; char *slash = NULL; ! 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,973 **** if (errstr != NULL) { fatal("prefix length is %s: '%s'", errstr, value); } ! prefix_parsed = ISC_TRUE; } if (inet_pton(AF_INET6, buf, &in6) == 1) { ! parsed = ISC_TRUE; 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; isc_sockaddr_fromin(sa, &in4, 0); if (prefix_length > 32) prefix_length = 32; --- 958,973 ---- if (errstr != NULL) { fatal("prefix length is %s: '%s'", errstr, value); } ! prefix_parsed = 1; } if (inet_pton(AF_INET6, buf, &in6) == 1) { ! 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 = 1; isc_sockaddr_fromin(sa, &in4, 0); if (prefix_length > 32) prefix_length = 32; *************** *** 977,983 **** 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; isc_sockaddr_fromin(sa, &in4, 0); break; } --- 977,983 ---- 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 = 1; isc_sockaddr_fromin(sa, &in4, 0); break; } *************** *** 1153,1159 **** * settings. */ void ! setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only) { dig_searchlist_t *domain = NULL; lwres_result_t lwresult; int lwresflags = 0; --- 1153,1159 ---- * settings. */ void ! setup_system(int ipv4only, int ipv6only) { dig_searchlist_t *domain = NULL; lwres_result_t lwresult; int lwresflags = 0; *************** *** 1162,1175 **** if (ipv4only) { if (have_ipv4) ! have_ipv6 = ISC_FALSE; else fatal("can't find IPv4 networking"); } if (ipv6only) { if (have_ipv6) ! have_ipv4 = ISC_FALSE; else fatal("can't find IPv6 networking"); } --- 1162,1175 ---- if (ipv4only) { if (have_ipv4) ! have_ipv6 = 0; else fatal("can't find IPv4 networking"); } if (ipv6only) { if (have_ipv6) ! have_ipv4 = 0; else fatal("can't find IPv6 networking"); } *************** *** 1280,1286 **** result = dst_lib_init(); check_result(result, "dst_lib_init"); ! is_dst_up = ISC_TRUE; } typedef struct dig_ednsoptname { --- 1280,1286 ---- result = dst_lib_init(); check_result(result, "dst_lib_init"); ! is_dst_up = 1; } typedef struct dig_ednsoptname { *************** *** 1311,1317 **** isc_result_t result; uint32_t num = 0; isc_buffer_t b; ! isc_boolean_t found = ISC_FALSE; unsigned int i; const char *errstr; --- 1311,1317 ---- isc_result_t result; uint32_t num = 0; isc_buffer_t b; ! int found = 0; unsigned int i; const char *errstr; *************** *** 1321,1327 **** for (i = 0; i < N_EDNS_OPTNAMES; i++) { if (strcasecmp(code, optnames[i].name) == 0) { num = optnames[i].code; ! found = ISC_TRUE; break; } } --- 1321,1327 ---- for (i = 0; i < N_EDNS_OPTNAMES; i++) { if (strcasecmp(code, optnames[i].name) == 0) { num = optnames[i].code; ! found = 1; break; } } *************** *** 1460,1476 **** isc_buffer_invalidate(&query->recvbuf); isc_buffer_invalidate(&query->lengthbuf); if (query->waiting_senddone) ! query->pending_free = ISC_TRUE; 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 * lookup pointer has been invalidated. */ ! static isc_boolean_t try_clear_lookup(dig_lookup_t *lookup) { dig_query_t *q; --- 1460,1476 ---- isc_buffer_invalidate(&query->recvbuf); isc_buffer_invalidate(&query->lengthbuf); if (query->waiting_senddone) ! query->pending_free = 1; else free(query); } /*% ! * 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 int try_clear_lookup(dig_lookup_t *lookup) { dig_query_t *q; *************** *** 1495,1501 **** q = ISC_LIST_NEXT(q, clink); } } ! return (ISC_FALSE); } /* --- 1495,1501 ---- q = ISC_LIST_NEXT(q, clink); } } ! return (0); } /* *************** *** 1503,1509 **** * so can make it go away also. */ destroy_lookup(lookup); ! return (ISC_TRUE); } void --- 1503,1509 ---- * so can make it go away also. */ destroy_lookup(lookup); ! return (1); } void *************** *** 1617,1629 **** dns_rdata_t rdata = DNS_RDATA_INIT; dns_name_t *name = NULL; isc_result_t result; ! isc_boolean_t success = ISC_FALSE; 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; INSIST(!free_now); --- 1617,1629 ---- dns_rdata_t rdata = DNS_RDATA_INIT; dns_name_t *name = NULL; isc_result_t result; ! int success = 0; int numLookups = 0; int num; isc_result_t lresult, addresses_result; char bad_namestr[DNS_NAME_FORMATSIZE]; dns_name_t *domain; ! int horizontal = 0, bad = 0; INSIST(!free_now); *************** *** 1663,1673 **** if (namereln == dns_namereln_equal) { if (!horizontal) printf(";; BAD (HORIZONTAL) REFERRAL\n"); ! horizontal = ISC_TRUE; } else if (namereln != dns_namereln_subdomain) { if (!bad) printf(";; BAD REFERRAL\n"); ! bad = ISC_TRUE; continue; } } --- 1663,1673 ---- if (namereln == dns_namereln_equal) { if (!horizontal) printf(";; BAD (HORIZONTAL) REFERRAL\n"); ! horizontal = 1; } else if (namereln != dns_namereln_subdomain) { if (!bad) printf(";; BAD REFERRAL\n"); ! bad = 1; continue; } } *************** *** 1693,1714 **** /* Initialize lookup if we've not yet */ debug("found NS %s", namestr); if (!success) { ! success = ISC_TRUE; lookup_counter++; lookup = requeue_lookup(query->lookup, ! ISC_FALSE); cancel_lookup(query->lookup); ! lookup->doing_xfr = ISC_FALSE; if (!lookup->trace_root && section == DNS_SECTION_ANSWER) ! lookup->trace = ISC_FALSE; else lookup->trace = query->lookup->trace; lookup->ns_search_only = query->lookup->ns_search_only; ! lookup->trace_root = ISC_FALSE; if (lookup->ns_search_only) ! lookup->recurse = ISC_FALSE; domain = dns_fixedname_name(&lookup->fdomain); dns_name_copy(name, domain, NULL); } --- 1693,1714 ---- /* Initialize lookup if we've not yet */ debug("found NS %s", namestr); if (!success) { ! success = 1; lookup_counter++; lookup = requeue_lookup(query->lookup, ! 0); cancel_lookup(query->lookup); ! lookup->doing_xfr = 0; if (!lookup->trace_root && section == DNS_SECTION_ANSWER) ! lookup->trace = 0; else lookup->trace = query->lookup->trace; lookup->ns_search_only = query->lookup->ns_search_only; ! lookup->trace_root = 0; if (lookup->ns_search_only) ! lookup->recurse = 0; domain = dns_fixedname_name(&lookup->fdomain); dns_name_copy(name, domain, NULL); } *************** *** 1773,1781 **** * 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. */ ! static isc_boolean_t next_origin(dig_lookup_t *oldlookup) { dig_lookup_t *newlookup; dig_searchlist_t *search; --- 1773,1781 ---- * Create and queue a new lookup using the next origin from the search * list, read in setup_system(). * ! * Return 1 iff there was another searchlist entry. */ ! static int next_origin(dig_lookup_t *oldlookup) { dig_lookup_t *newlookup; dig_searchlist_t *search; *************** *** 1793,1799 **** * We're not using a search list, so don't even think * about finding the next entry. */ ! return (ISC_FALSE); /* * Check for a absolute name or ndots being met. --- 1793,1799 ---- * We're not using a search list, so don't even think * about finding the next entry. */ ! return (0); /* * Check for a absolute name or ndots being met. *************** *** 1804,1829 **** if (result == ISC_R_SUCCESS && (dns_name_isabsolute(name) || (int)dns_name_countlabels(name) > ndots)) ! return (ISC_FALSE); if (oldlookup->origin == NULL && !oldlookup->need_search) /* * Then we just did rootorg; there's nothing left. */ ! return (ISC_FALSE); if (oldlookup->origin == NULL && oldlookup->need_search) { ! newlookup = requeue_lookup(oldlookup, ISC_TRUE); newlookup->origin = ISC_LIST_HEAD(search_list); ! newlookup->need_search = ISC_FALSE; } else { search = ISC_LIST_NEXT(oldlookup->origin, link); if (search == NULL && oldlookup->done_as_is) ! return (ISC_FALSE); ! newlookup = requeue_lookup(oldlookup, ISC_TRUE); newlookup->origin = search; } cancel_lookup(oldlookup); ! return (ISC_TRUE); } /*% --- 1804,1829 ---- if (result == ISC_R_SUCCESS && (dns_name_isabsolute(name) || (int)dns_name_countlabels(name) > ndots)) ! return (0); if (oldlookup->origin == NULL && !oldlookup->need_search) /* * Then we just did rootorg; there's nothing left. */ ! return (0); if (oldlookup->origin == NULL && oldlookup->need_search) { ! newlookup = requeue_lookup(oldlookup, 1); newlookup->origin = ISC_LIST_HEAD(search_list); ! newlookup->need_search = 0; } else { search = ISC_LIST_NEXT(oldlookup->origin, link); if (search == NULL && oldlookup->done_as_is) ! return (0); ! newlookup = requeue_lookup(oldlookup, 1); newlookup->origin = search; } cancel_lookup(oldlookup); ! return (1); } /*% *************** *** 1922,1928 **** * 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 setup_lookup(dig_lookup_t *lookup) { isc_result_t result; uint32_t id; --- 1922,1928 ---- * well as the query structures and buffer space for the replies. If the * server list is empty, clone it from the system default list. */ ! int setup_lookup(dig_lookup_t *lookup) { isc_result_t result; uint32_t id; *************** *** 1979,1989 **** if (lookup->new_search) { if ((count_dots(lookup->textname) >= ndots) || !usesearch) { lookup->origin = NULL; /* Force abs lookup */ ! lookup->done_as_is = ISC_TRUE; lookup->need_search = usesearch; } else if (lookup->origin == NULL && usesearch) { lookup->origin = ISC_LIST_HEAD(search_list); ! lookup->need_search = ISC_FALSE; } } --- 1979,1989 ---- if (lookup->new_search) { if ((count_dots(lookup->textname) >= ndots) || !usesearch) { lookup->origin = NULL; /* Force abs lookup */ ! 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 = 0; } } *************** *** 2035,2041 **** dns_message_puttempname(lookup->sendmsg, &lookup->oname); if (result == DNS_R_NAMETOOLONG) ! return (ISC_FALSE); fatal("'%s' is not in legal name syntax (%s)", lookup->textname, isc_result_totext(result)); --- 2035,2041 ---- dns_message_puttempname(lookup->sendmsg, &lookup->oname); if (result == DNS_R_NAMETOOLONG) ! return (0); fatal("'%s' is not in legal name syntax (%s)", lookup->textname, isc_result_totext(result)); *************** *** 2076,2082 **** * it's meaningless for traces. */ if (lookup->trace || (lookup->ns_search_only && !lookup->trace_root)) ! lookup->recurse = ISC_FALSE; if (lookup->recurse && lookup->rdtype != dns_rdatatype_axfr && --- 2076,2082 ---- * it's meaningless for traces. */ if (lookup->trace || (lookup->ns_search_only && !lookup->trace_root)) ! lookup->recurse = 0; if (lookup->recurse && lookup->rdtype != dns_rdatatype_axfr && *************** *** 2115,2124 **** * 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; } else if (lookup->tcp_mode) { ! lookup->doing_xfr = ISC_TRUE; } } --- 2115,2124 ---- * Force TCP mode if we're doing an axfr. */ if (lookup->rdtype == dns_rdatatype_axfr) { ! lookup->doing_xfr = 1; ! lookup->tcp_mode = 1; } else if (lookup->tcp_mode) { ! lookup->doing_xfr = 1; } } *************** *** 2311,2319 **** * Force TCP mode if the request is larger than 512 bytes. */ if (isc_buffer_usedlength(&lookup->renderbuf) > 512) ! lookup->tcp_mode = ISC_TRUE; ! lookup->pending = ISC_FALSE; for (serv = ISC_LIST_HEAD(lookup->my_server_list); serv != NULL; --- 2311,2319 ---- * Force TCP mode if the request is larger than 512 bytes. */ if (isc_buffer_usedlength(&lookup->renderbuf) > 512) ! lookup->tcp_mode = 1; ! lookup->pending = 0; for (serv = ISC_LIST_HEAD(lookup->my_server_list); serv != NULL; *************** *** 2326,2341 **** 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->first_rr_serial = 0; query->second_rr_serial = 0; query->servname = serv->servername; --- 2326,2341 ---- query, lookup); query->lookup = lookup; query->timer = NULL; ! 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,2349 **** query->rr_count = 0; query->msg_count = 0; query->byte_count = 0; ! query->ixfr_axfr = ISC_FALSE; ISC_LIST_INIT(query->recvlist); ISC_LIST_INIT(query->lengthlist); query->sock = NULL; --- 2343,2349 ---- query->rr_count = 0; query->msg_count = 0; query->byte_count = 0; ! query->ixfr_axfr = 0; ISC_LIST_INIT(query->recvlist); ISC_LIST_INIT(query->lengthlist); query->sock = NULL; *************** *** 2365,2373 **** if (!ISC_LIST_EMPTY(lookup->q) && qr) { extrabytes = 0; dighost_printmessage(ISC_LIST_HEAD(lookup->q), lookup->sendmsg, ! ISC_TRUE); } ! return (ISC_TRUE); } /*% --- 2365,2373 ---- if (!ISC_LIST_EMPTY(lookup->q) && qr) { extrabytes = 0; dighost_printmessage(ISC_LIST_HEAD(lookup->q), lookup->sendmsg, ! 1); } ! return (1); } /*% *************** *** 2398,2404 **** } query = event->ev_arg; ! query->waiting_senddone = ISC_FALSE; l = query->lookup; if (l->ns_search_only && !l->trace_root && !l->tcp_mode) { --- 2398,2404 ---- } query = event->ev_arg; ! query->waiting_senddone = 0; l = query->lookup; if (l->ns_search_only && !l->trace_root && !l->tcp_mode) { *************** *** 2438,2444 **** } query = next; } ! lookup->pending = ISC_FALSE; lookup->retries = 0; } --- 2438,2444 ---- } query = next; } ! lookup->pending = 0; lookup->retries = 0; } *************** *** 2515,2521 **** debug("send_tcp_connect(%p)", query); l = query->lookup; ! query->waiting_connect = ISC_TRUE; query->lookup->current_query = query; result = get_address(query->servname, port, &query->sockaddr); if (result != ISC_R_SUCCESS) { --- 2515,2521 ---- debug("send_tcp_connect(%p)", query); l = query->lookup; ! query->waiting_connect = 1; query->lookup->current_query = query; result = get_address(query->servname, port, &query->sockaddr); if (result != ISC_R_SUCCESS) { *************** *** 2533,2539 **** isc_sockaddr_pf(&bind_address))) { printf(";; Skipping server %s, incompatible " "address family\n", query->servname); ! query->waiting_connect = ISC_FALSE; if (ISC_LINK_LINKED(query, link)) next = ISC_LIST_NEXT(query, link); else --- 2533,2539 ---- isc_sockaddr_pf(&bind_address))) { printf(";; Skipping server %s, incompatible " "address family\n", query->servname); ! query->waiting_connect = 0; if (ISC_LINK_LINKED(query, link)) next = ISC_LIST_NEXT(query, link); else *************** *** 2554,2561 **** 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); goto search; } --- 2554,2561 ---- if (keep != NULL && isc_sockaddr_equal(&keepaddr, &query->sockaddr)) { sockcount++; isc_socket_attach(keep, &query->sock); ! query->waiting_connect = 0; ! launch_next_query(query, 1); goto search; } *************** *** 2629,2635 **** 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; result = get_address(query->servname, port, &query->sockaddr); if (result != ISC_R_SUCCESS) { /* This servname doesn't have an address. */ --- 2629,2635 ---- 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 = 0; result = get_address(query->servname, port, &query->sockaddr); if (result != ISC_R_SUCCESS) { /* This servname doesn't have an address. */ *************** *** 2653,2659 **** } check_result(result, "isc_socket_bind"); ! query->recv_made = ISC_TRUE; ISC_LINK_INIT(&query->recvbuf, link); ISC_LIST_ENQUEUE(query->recvlist, &query->recvbuf, link); --- 2653,2659 ---- } check_result(result, "isc_socket_bind"); ! query->recv_made = 1; ISC_LINK_INIT(&query->recvbuf, link); ISC_LIST_ENQUEUE(query->recvlist, &query->recvbuf, link); *************** *** 2671,2677 **** debug("sending a request"); clock_gettime(CLOCK_MONOTONIC, &query->time_sent); INSIST(query->sock != NULL); ! query->waiting_senddone = ISC_TRUE; result = isc_socket_sendtov2(query->sock, &query->sendlist, global_task, send_done, query, &query->sockaddr, NULL, --- 2671,2677 ---- debug("sending a request"); clock_gettime(CLOCK_MONOTONIC, &query->time_sent); INSIST(query->sock != NULL); ! query->waiting_senddone = 1; result = isc_socket_sendtov2(query->sock, &query->sendlist, global_task, send_done, query, &query->sockaddr, NULL, *************** *** 2718,2724 **** } if (l->tcp_mode && query->sock != NULL) { ! query->timedout = ISC_TRUE; isc_socket_cancel(query->sock, NULL, ISC_SOCKCANCEL_ALL); } --- 2718,2724 ---- } if (l->tcp_mode && query->sock != NULL) { ! query->timedout = 1; isc_socket_cancel(query->sock, NULL, ISC_SOCKCANCEL_ALL); } *************** *** 2731,2737 **** debug("making new TCP request, %d tries left", l->retries); l->retries--; ! requeue_lookup(l, ISC_TRUE); cancel_lookup(l); check_next_lookup(l); } --- 2731,2737 ---- debug("making new TCP request, %d tries left", l->retries); l->retries--; ! requeue_lookup(l, 1); cancel_lookup(l); check_next_lookup(l); } *************** *** 2799,2805 **** debug("sockcount=%d", sockcount); INSIST(sockcount >= 0); if (sevent->result == ISC_R_EOF && l->eoferr == 0U) { ! n = requeue_lookup(l, ISC_TRUE); n->eoferr++; } isc_event_free(&event); --- 2799,2805 ---- debug("sockcount=%d", sockcount); INSIST(sockcount >= 0); if (sevent->result == ISC_R_EOF && l->eoferr == 0U) { ! n = requeue_lookup(l, 1); n->eoferr++; } isc_event_free(&event); *************** *** 2811,2817 **** length = isc_buffer_getuint16(b); if (length == 0) { isc_event_free(&event); ! launch_next_query(query, ISC_FALSE); return; } --- 2811,2817 ---- length = isc_buffer_getuint16(b); if (length == 0) { isc_event_free(&event); ! launch_next_query(query, 0); return; } *************** *** 2839,2845 **** * launch the next recv. */ static void ! launch_next_query(dig_query_t *query, isc_boolean_t include_question) { isc_result_t result; dig_lookup_t *l; isc_buffer_t *buffer; --- 2839,2845 ---- * launch the next recv. */ static void ! launch_next_query(dig_query_t *query, int include_question) { isc_result_t result; dig_lookup_t *l; isc_buffer_t *buffer; *************** *** 2854,2860 **** sockcount--; debug("sockcount=%d", sockcount); INSIST(sockcount >= 0); ! query->waiting_connect = ISC_FALSE; l = query->lookup; clear_query(query); check_next_lookup(l); --- 2854,2860 ---- sockcount--; debug("sockcount=%d", sockcount); INSIST(sockcount >= 0); ! query->waiting_connect = 0; l = query->lookup; clear_query(query); check_next_lookup(l); *************** *** 2886,2899 **** 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; 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; return; } --- 2886,2899 ---- if (!query->first_soa_rcvd) { debug("sending a request in launch_next_query"); clock_gettime(CLOCK_MONOTONIC, &query->time_sent); ! 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 = 0; return; } *************** *** 2921,2927 **** INSIST(query->waiting_connect); ! query->waiting_connect = ISC_FALSE; if (sevent->result == ISC_R_CANCELED) { debug("in cancel handler"); --- 2921,2927 ---- INSIST(query->waiting_connect); ! query->waiting_connect = 0; if (sevent->result == ISC_R_CANCELED) { debug("in cancel handler"); *************** *** 2935,2941 **** INSIST(sockcount > 0); sockcount--; debug("sockcount=%d", sockcount); ! query->waiting_connect = ISC_FALSE; isc_event_free(&event); l = query->lookup; clear_query(query); --- 2935,2941 ---- INSIST(sockcount > 0); sockcount--; debug("sockcount=%d", sockcount); ! query->waiting_connect = 0; isc_event_free(&event); l = query->lookup; clear_query(query); *************** *** 2959,2965 **** if (exitcode < 9) exitcode = 9; debug("sockcount=%d", sockcount); ! query->waiting_connect = ISC_FALSE; isc_event_free(&event); l = query->lookup; if ((l->current_query != NULL) && --- 2959,2965 ---- if (exitcode < 9) exitcode = 9; debug("sockcount=%d", sockcount); ! query->waiting_connect = 0; isc_event_free(&event); l = query->lookup; if ((l->current_query != NULL) && *************** *** 2981,2987 **** isc_socket_attach(query->sock, &keep); keepaddr = query->sockaddr; } ! launch_next_query(query, ISC_TRUE); isc_event_free(&event); } --- 2981,2987 ---- isc_socket_attach(query->sock, &keep); keepaddr = query->sockaddr; } ! launch_next_query(query, 1); isc_event_free(&event); } *************** *** 2989,2997 **** * 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. */ ! static isc_boolean_t check_for_more_data(dig_query_t *query, dns_message_t *msg, isc_socketevent_t *sevent) { --- 2989,2997 ---- * 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. ! * 0 means more data is on the way, and the recv has been issued. */ ! static int check_for_more_data(dig_query_t *query, dns_message_t *msg, isc_socketevent_t *sevent) { *************** *** 3000,3007 **** 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; if (ixfr) axfr = query->ixfr_axfr; --- 3000,3007 ---- dns_rdata_soa_t soa; uint32_t ixfr_serial = query->lookup->ixfr_serial, serial; isc_result_t result; ! int ixfr = query->lookup->rdtype == dns_rdatatype_ixfr; ! int axfr = query->lookup->rdtype == dns_rdatatype_axfr; if (ixfr) axfr = query->ixfr_axfr; *************** *** 3022,3028 **** result = dns_message_firstname(msg, DNS_SECTION_ANSWER); if (result != ISC_R_SUCCESS) { puts("; Transfer failed."); ! return (ISC_TRUE); } do { dns_name_t *name; --- 3022,3028 ---- result = dns_message_firstname(msg, DNS_SECTION_ANSWER); if (result != ISC_R_SUCCESS) { puts("; Transfer failed."); ! return (1); } do { dns_name_t *name; *************** *** 3047,3060 **** (rdata.type != dns_rdatatype_soa)) { puts("; Transfer failed. " "Didn't start with SOA answer."); ! return (ISC_TRUE); } if ((!query->second_rr_rcvd) && (rdata.type != dns_rdatatype_soa)) { ! query->second_rr_rcvd = ISC_TRUE; query->second_rr_serial = 0; debug("got the second rr as nonsoa"); ! axfr = query->ixfr_axfr = ISC_TRUE; goto next_rdata; } --- 3047,3060 ---- (rdata.type != dns_rdatatype_soa)) { puts("; Transfer failed. " "Didn't start with SOA answer."); ! return (1); } if ((!query->second_rr_rcvd) && (rdata.type != dns_rdatatype_soa)) { ! query->second_rr_rcvd = 1; query->second_rr_serial = 0; debug("got the second rr as nonsoa"); ! axfr = query->ixfr_axfr = 1; goto next_rdata; } *************** *** 3072,3078 **** serial = soa.serial; dns_rdata_freestruct_soa(&soa); if (!query->first_soa_rcvd) { ! query->first_soa_rcvd = ISC_TRUE; query->first_rr_serial = serial; debug("this is the first serial %u", serial); --- 3072,3078 ---- serial = soa.serial; dns_rdata_freestruct_soa(&soa); if (!query->first_soa_rcvd) { ! query->first_soa_rcvd = 1; query->first_rr_serial = serial; debug("this is the first serial %u", serial); *************** *** 3096,3102 **** } debug("this is the second serial %u", serial); ! query->second_rr_rcvd = ISC_TRUE; query->second_rr_serial = serial; goto next_rdata; } --- 3096,3102 ---- } debug("this is the second serial %u", serial); ! query->second_rr_rcvd = 1; query->second_rr_serial = serial; goto next_rdata; } *************** *** 3109,3115 **** debug("got a match for ixfr"); if (!query->first_repeat_rcvd) { query->first_repeat_rcvd = ! ISC_TRUE; goto next_rdata; } debug("done with ixfr"); --- 3109,3115 ---- debug("got a match for ixfr"); if (!query->first_repeat_rcvd) { query->first_repeat_rcvd = ! 1; goto next_rdata; } debug("done with ixfr"); *************** *** 3122,3132 **** } result = dns_message_nextname(msg, DNS_SECTION_ANSWER); } while (result == ISC_R_SUCCESS); ! launch_next_query(query, ISC_FALSE); ! return (ISC_FALSE); doexit: dighost_received(sevent->n, &sevent->address, query); ! return (ISC_TRUE); } static void --- 3122,3132 ---- } result = dns_message_nextname(msg, DNS_SECTION_ANSWER); } while (result == ISC_R_SUCCESS); ! launch_next_query(query, 0); ! return (0); doexit: dighost_received(sevent->n, &sevent->address, query); ! return (1); } static void *************** *** 3137,3143 **** isc_buffer_t hexbuf; size_t len; const unsigned char *sit; ! isc_boolean_t copysit; isc_result_t result; if (l->sitvalue != NULL) { --- 3137,3143 ---- isc_buffer_t hexbuf; size_t len; const unsigned char *sit; ! int copysit; isc_result_t result; if (l->sitvalue != NULL) { *************** *** 3146,3156 **** check_result(result, "isc_hex_decodestring"); sit = isc_buffer_base(&hexbuf); len = isc_buffer_usedlength(&hexbuf); ! copysit = ISC_FALSE; } else { sit = cookie; len = sizeof(cookie); ! copysit = ISC_TRUE; } INSIST(msg->sitok == 0 && msg->sitbad == 0); --- 3146,3156 ---- check_result(result, "isc_hex_decodestring"); sit = isc_buffer_base(&hexbuf); len = isc_buffer_usedlength(&hexbuf); ! copysit = 0; } else { sit = cookie; len = sizeof(cookie); ! copysit = 1; } INSIST(msg->sitok == 0 && msg->sitbad == 0); *************** *** 3160,3171 **** } else { printf(";; Warning: SIT client cookie mismatch\n"); msg->sitbad = 1; ! copysit = ISC_FALSE; } } else { printf(";; Warning: SIT bad token (too short)\n"); msg->sitbad = 1; ! copysit = ISC_FALSE; } if (copysit) { isc_region_t r; --- 3160,3171 ---- } else { printf(";; Warning: SIT client cookie mismatch\n"); msg->sitbad = 1; ! copysit = 0; } } else { printf(";; Warning: SIT bad token (too short)\n"); msg->sitbad = 1; ! copysit = 0; } if (copysit) { isc_region_t r; *************** *** 3190,3196 **** isc_buffer_t optbuf; uint16_t optcode, optlen; dns_rdataset_t *opt = msg->opt; ! isc_boolean_t seen_cookie = ISC_FALSE; result = dns_rdataset_first(opt); if (result == ISC_R_SUCCESS) { --- 3190,3196 ---- isc_buffer_t optbuf; uint16_t optcode, optlen; dns_rdataset_t *opt = msg->opt; ! int seen_cookie = 0; result = dns_rdataset_first(opt); if (result == ISC_R_SUCCESS) { *************** *** 3211,3217 **** break; } process_sit(l, msg, &optbuf, optlen); ! seen_cookie = ISC_TRUE; break; default: isc_buffer_forward(&optbuf, optlen); --- 3211,3217 ---- break; } process_sit(l, msg, &optbuf, optlen); ! seen_cookie = 1; break; default: isc_buffer_forward(&optbuf, optlen); *************** *** 3238,3245 **** 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; unsigned int parseflags; dns_messageid_t id; unsigned int msgflags; --- 3238,3245 ---- dns_message_t *msg = NULL; isc_result_t result; dig_lookup_t *n, *l; ! int docancel = 0; ! int match = 1; unsigned int parseflags; dns_messageid_t id; unsigned int msgflags; *************** *** 3272,3278 **** 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; isc_event_free(&event); clear_query(query); --- 3272,3278 ---- if ((!l->pending && !l->ns_search_only) || cancel_now) { debug("no longer pending. Got %s", isc_result_totext(sevent->result)); ! query->waiting_connect = 0; isc_event_free(&event); clear_query(query); *************** *** 3283,3289 **** if (sevent->result != ISC_R_SUCCESS) { if (sevent->result == ISC_R_CANCELED) { debug("in recv cancel handler"); ! query->waiting_connect = ISC_FALSE; } else { printf(";; communications error: %s\n", isc_result_totext(sevent->result)); --- 3283,3289 ---- if (sevent->result != ISC_R_SUCCESS) { if (sevent->result == ISC_R_CANCELED) { debug("in recv cancel handler"); ! query->waiting_connect = 0; } else { printf(";; communications error: %s\n", isc_result_totext(sevent->result)); *************** *** 3295,3301 **** INSIST(sockcount >= 0); } if (sevent->result == ISC_R_EOF && l->eoferr == 0U) { ! n = requeue_lookup(l, ISC_TRUE); n->eoferr++; } isc_event_free(&event); --- 3295,3301 ---- INSIST(sockcount >= 0); } if (sevent->result == ISC_R_EOF && l->eoferr == 0U) { ! n = requeue_lookup(l, 1); n->eoferr++; } isc_event_free(&event); *************** *** 3335,3349 **** sizeof(buf2)); printf(";; reply from unexpected source: %s," " expected %s\n", buf1, buf2); ! match = ISC_FALSE; } } result = dns_message_peekheader(b, &id, &msgflags); if (result != ISC_R_SUCCESS || l->sendmsg->id != id) { ! match = ISC_FALSE; if (l->tcp_mode) { ! isc_boolean_t fail = ISC_TRUE; if (result == ISC_R_SUCCESS) { if (!query->first_soa_rcvd || query->warn_id) --- 3335,3349 ---- sizeof(buf2)); printf(";; reply from unexpected source: %s," " expected %s\n", buf1, buf2); ! match = 0; } } result = dns_message_peekheader(b, &id, &msgflags); if (result != ISC_R_SUCCESS || l->sendmsg->id != id) { ! match = 0; if (l->tcp_mode) { ! int fail = 1; if (result == ISC_R_SUCCESS) { if (!query->first_soa_rcvd || query->warn_id) *************** *** 3353,3360 **** "WARNING" : "ERROR", l->sendmsg->id, id); if (query->first_soa_rcvd) ! fail = ISC_FALSE; ! query->warn_id = ISC_FALSE; } else printf(";; ERROR: short " "(< header size) message\n"); --- 3353,3360 ---- "WARNING" : "ERROR", l->sendmsg->id, id); if (query->first_soa_rcvd) ! fail = 0; ! query->warn_id = 0; } else printf(";; ERROR: short " "(< header size) message\n"); *************** *** 3365,3371 **** check_next_lookup(l); return; } ! match = ISC_TRUE; } else if (result == ISC_R_SUCCESS) printf(";; Warning: ID mismatch: " "expected ID %u, got %u\n", l->sendmsg->id, id); --- 3365,3371 ---- check_next_lookup(l); return; } ! match = 1; } else if (result == ISC_R_SUCCESS) printf(";; Warning: ID mismatch: " "expected ID %u, got %u\n", l->sendmsg->id, id); *************** *** 3416,3422 **** if (result != ISC_R_SUCCESS) { printf(";; Got bad packet: %s\n", isc_result_totext(result)); hex_dump(b); ! query->waiting_connect = ISC_FALSE; dns_message_destroy(&msg); isc_event_free(&event); clear_query(query); --- 3416,3422 ---- if (result != ISC_R_SUCCESS) { printf(";; Got bad packet: %s\n", isc_result_totext(result)); hex_dump(b); ! query->waiting_connect = 0; dns_message_destroy(&msg); isc_event_free(&event); clear_query(query); *************** *** 3425,3431 **** return; } if (msg->counts[DNS_SECTION_QUESTION] != 0) { ! match = ISC_TRUE; for (result = dns_message_firstname(msg, DNS_SECTION_QUESTION); result == ISC_R_SUCCESS && match; result = dns_message_nextname(msg, DNS_SECTION_QUESTION)) { --- 3425,3431 ---- return; } if (msg->counts[DNS_SECTION_QUESTION] != 0) { ! 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,3460 **** printf(";; Question section mismatch: " "got %s/%s/%s\n", namestr, typebuf, classbuf); ! match = ISC_FALSE; } } } --- 3454,3460 ---- printf(";; Question section mismatch: " "got %s/%s/%s\n", namestr, typebuf, classbuf); ! match = 0; } } } *************** *** 3479,3485 **** printf(";; BADVERS, retrying with EDNS version %u.\n", (unsigned int)newedns); l->edns = newedns; ! n = requeue_lookup(l, ISC_TRUE); if (l->trace && l->trace_root) n->rdtype = l->qrdtype; dns_message_destroy(&msg); --- 3479,3485 ---- printf(";; BADVERS, retrying with EDNS version %u.\n", (unsigned int)newedns); l->edns = newedns; ! n = requeue_lookup(l, 1); if (l->trace && l->trace_root) n->rdtype = l->qrdtype; dns_message_destroy(&msg); *************** *** 3495,3502 **** 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; if (l->trace && l->trace_root) n->rdtype = l->qrdtype; dns_message_destroy(&msg); --- 3495,3502 ---- process_opt(l, msg); if (l->comments) printf(";; Truncated, retrying in TCP mode.\n"); ! n = requeue_lookup(l, 1); ! n->tcp_mode = 1; if (l->trace && l->trace_root) n->rdtype = l->qrdtype; dns_message_destroy(&msg); *************** *** 3546,3552 **** if (result != ISC_R_SUCCESS) { printf(";; Couldn't verify signature: %s\n", isc_result_totext(result)); ! validated = ISC_FALSE; } l->tsigctx = msg->tsigctx; msg->tsigctx = NULL; --- 3546,3552 ---- if (result != ISC_R_SUCCESS) { printf(";; Couldn't verify signature: %s\n", isc_result_totext(result)); ! validated = 0; } l->tsigctx = msg->tsigctx; msg->tsigctx = NULL; *************** *** 3587,3593 **** l->interval.tv_nsec = 0; result = isc_timer_reset(query->timer, &l->interval, ! ISC_FALSE); check_result(result, "isc_timer_reset"); } } --- 3587,3593 ---- l->interval.tv_nsec = 0; result = isc_timer_reset(query->timer, &l->interval, ! 0); check_result(result, "isc_timer_reset"); } } *************** *** 3604,3621 **** 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_received(b->used, &sevent->address, query); } } else if (!l->trace && !l->ns_search_only) { ! dighost_printmessage(query, msg, ISC_TRUE); } 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); l->rdtype = l->qrdtype; if (l->trace_root || (l->ns_search_only && count > 0)) { --- 3604,3621 ---- if (msg->rcode == dns_rcode_nxdomain && (l->origin != NULL || l->need_search)) { if (!next_origin(query->lookup) || showsearch) { ! dighost_printmessage(query, msg, 1); dighost_received(b->used, &sevent->address, query); } } else if (!l->trace && !l->ns_search_only) { ! 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, 1); l->rdtype = l->qrdtype; if (l->trace_root || (l->ns_search_only && count > 0)) { *************** *** 3623,3634 **** l->rdtype = dns_rdatatype_soa; nl = followup_lookup(msg, query, DNS_SECTION_ANSWER); ! l->trace_root = ISC_FALSE; } else if (count == 0) nl = followup_lookup(msg, query, DNS_SECTION_AUTHORITY); if (nl == 0) ! docancel = ISC_TRUE; } else { debug("in NSSEARCH code"); --- 3623,3634 ---- l->rdtype = dns_rdatatype_soa; nl = followup_lookup(msg, query, DNS_SECTION_ANSWER); ! l->trace_root = 0; } else if (count == 0) nl = followup_lookup(msg, query, DNS_SECTION_AUTHORITY); if (nl == 0) ! docancel = 1; } else { debug("in NSSEARCH code"); *************** *** 3642,3652 **** nl = followup_lookup(msg, query, DNS_SECTION_ANSWER); if (nl == 0) ! docancel = ISC_TRUE; ! l->trace_root = ISC_FALSE; ! usesearch = ISC_FALSE; } else ! dighost_printmessage(query, msg, ISC_TRUE); } } --- 3642,3652 ---- nl = followup_lookup(msg, query, DNS_SECTION_ANSWER); if (nl == 0) ! docancel = 1; ! l->trace_root = 0; ! usesearch = 0; } else ! dighost_printmessage(query, msg, 1); } } *************** *** 3656,3662 **** if (query != l->xfr_q) { dns_message_destroy(&msg); isc_event_free(&event); ! query->waiting_connect = ISC_FALSE; return; } if (!docancel) --- 3656,3662 ---- if (query != l->xfr_q) { dns_message_destroy(&msg); isc_event_free(&event); ! query->waiting_connect = 0; return; } if (!docancel) *************** *** 3675,3681 **** } if (!query->lookup->ns_search_only) ! query->lookup->pending = ISC_FALSE; if (!query->lookup->ns_search_only || query->lookup->trace_root || docancel) { dns_message_destroy(&msg); --- 3675,3681 ---- } if (!query->lookup->ns_search_only) ! query->lookup->pending = 0; if (!query->lookup->ns_search_only || query->lookup->trace_root || docancel) { dns_message_destroy(&msg); *************** *** 3762,3768 **** REQUIRE(lookup != NULL); debug("do_lookup()"); ! lookup->pending = ISC_TRUE; query = ISC_LIST_HEAD(lookup->q); if (query != NULL) { if (lookup->tcp_mode) --- 3762,3768 ---- REQUIRE(lookup != NULL); debug("do_lookup()"); ! lookup->pending = 1; query = ISC_LIST_HEAD(lookup->q); if (query != NULL) { if (lookup->tcp_mode) *************** *** 3797,3803 **** if (free_now) { return; } ! cancel_now = ISC_TRUE; if (current_lookup != NULL) { for (q = ISC_LIST_HEAD(current_lookup->q); q != NULL; --- 3797,3803 ---- if (free_now) { return; } ! cancel_now = 1; if (current_lookup != NULL) { for (q = ISC_LIST_HEAD(current_lookup->q); q != NULL; *************** *** 3865,3871 **** INSIST(current_lookup == NULL); INSIST(!free_now); ! free_now = ISC_TRUE; lwres_conf_clear(lwconf); --- 3865,3871 ---- INSIST(current_lookup == NULL); INSIST(!free_now); ! free_now = 1; lwres_conf_clear(lwconf); *************** *** 3891,3897 **** if (is_dst_up) { debug("destroy DST lib"); dst_lib_destroy(); ! is_dst_up = ISC_FALSE; } debug("Removing log context"); --- 3891,3897 ---- if (is_dst_up) { debug("destroy DST lib"); dst_lib_destroy(); ! is_dst_up = 0; } debug("Removing log context");