implicitly declare list elements in ISC_LIST_FOREACH macros
ISC_LIST_FOREACH and related macros now use 'typeof(list.head)' to declare the list elements automatically; the caller no longer needs to do so. ISC_LIST_FOREACH_SAFE also now implicitly declares its own 'next' pointer, so it only needs three parameters instead of four.
This commit is contained in:
+2
-4
@@ -1840,7 +1840,6 @@ static void
|
||||
resolve_cb(dns_client_t *client, const dns_name_t *query_name,
|
||||
dns_namelist_t *namelist, isc_result_t result) {
|
||||
char namestr[DNS_NAME_FORMATSIZE];
|
||||
dns_rdataset_t *rdataset;
|
||||
|
||||
if (result != ISC_R_SUCCESS && !yaml) {
|
||||
delv_log(ISC_LOG_ERROR, "resolution failed: %s",
|
||||
@@ -1855,9 +1854,9 @@ resolve_cb(dns_client_t *client, const dns_name_t *query_name,
|
||||
printf("records:\n");
|
||||
}
|
||||
|
||||
dns_name_t *response_name;
|
||||
ISC_LIST_FOREACH (*namelist, response_name, link) {
|
||||
for (rdataset = ISC_LIST_HEAD(response_name->list);
|
||||
for (dns_rdataset_t *rdataset =
|
||||
ISC_LIST_HEAD(response_name->list);
|
||||
rdataset != NULL; rdataset = ISC_LIST_NEXT(rdataset, link))
|
||||
{
|
||||
printdata(rdataset, response_name);
|
||||
@@ -1985,7 +1984,6 @@ recvresponse(void *arg) {
|
||||
}
|
||||
|
||||
MSG_SECTION_FOREACH (response, DNS_SECTION_ANSWER, name) {
|
||||
dns_rdataset_t *rdataset = NULL;
|
||||
dns_rdatatype_t prevtype = 0;
|
||||
|
||||
ISC_LIST_FOREACH (name->list, rdataset, link) {
|
||||
|
||||
@@ -578,7 +578,6 @@ dns64prefix_answer(dns_message_t *msg, isc_buffer_t *buf) {
|
||||
static isc_result_t
|
||||
short_answer(dns_message_t *msg, dns_messagetextflag_t flags, isc_buffer_t *buf,
|
||||
dig_query_t *query) {
|
||||
dns_rdataset_t *rdataset;
|
||||
isc_result_t result, loopresult;
|
||||
dns_name_t empty_name;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
|
||||
@@ -3678,7 +3678,6 @@ tcp_connected(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
|
||||
static bool
|
||||
check_for_more_data(dig_lookup_t *lookup, dig_query_t *query,
|
||||
dns_message_t *msg, isc_sockaddr_t *peer, int len) {
|
||||
dns_rdataset_t *rdataset = NULL;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
dns_rdata_soa_t soa;
|
||||
uint32_t ixfr_serial = lookup->ixfr_serial, serial;
|
||||
@@ -4237,7 +4236,6 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
|
||||
} else {
|
||||
match = true;
|
||||
MSG_SECTION_FOREACH (msg, DNS_SECTION_QUESTION, name) {
|
||||
dns_rdataset_t *rdataset;
|
||||
ISC_LIST_FOREACH (name->list, rdataset, link) {
|
||||
if (l->rdtype != rdataset->type ||
|
||||
l->rdclass != rdataset->rdclass ||
|
||||
|
||||
@@ -198,7 +198,6 @@ printrdata(dns_rdata_t *rdata) {
|
||||
static isc_result_t
|
||||
printsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
dns_section_t section) {
|
||||
dns_rdataset_t *rdataset = NULL;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
char namebuf[DNS_NAME_FORMATSIZE];
|
||||
|
||||
@@ -248,7 +247,6 @@ printsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
static isc_result_t
|
||||
detailsection(dig_query_t *query, dns_message_t *msg, bool headers,
|
||||
dns_section_t section) {
|
||||
dns_rdataset_t *rdataset = NULL;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
char namebuf[DNS_NAME_FORMATSIZE];
|
||||
|
||||
|
||||
+11
-9
@@ -2186,17 +2186,16 @@ evaluate_checksvcb(char *cmdline) {
|
||||
|
||||
static void
|
||||
setzone(dns_name_t *zonename) {
|
||||
dns_name_t *name = NULL;
|
||||
dns_rdataset_t *rdataset = NULL, *next_rds = NULL;
|
||||
|
||||
dns_namelist_t *secs = updatemsg->sections;
|
||||
dns_name_t *name = NULL;
|
||||
|
||||
if (!ISC_LIST_EMPTY(secs[DNS_SECTION_ZONE])) {
|
||||
INSIST(updatemsg->from_to_wire == DNS_MESSAGE_INTENTRENDER);
|
||||
|
||||
name = ISC_LIST_HEAD(secs[DNS_SECTION_ZONE]);
|
||||
ISC_LIST_UNLINK(secs[DNS_SECTION_ZONE], name, link);
|
||||
|
||||
ISC_LIST_FOREACH_SAFE (name->list, rdataset, link, next_rds) {
|
||||
ISC_LIST_FOREACH_SAFE (name->list, rdataset, link) {
|
||||
ISC_LIST_UNLINK(name->list, rdataset, link);
|
||||
dns_rdataset_disassociate(rdataset);
|
||||
dns_message_puttemprdataset(updatemsg, &rdataset);
|
||||
@@ -2205,6 +2204,8 @@ setzone(dns_name_t *zonename) {
|
||||
}
|
||||
|
||||
if (zonename != NULL) {
|
||||
dns_rdataset_t *rdataset = NULL;
|
||||
|
||||
dns_message_gettempname(updatemsg, &name);
|
||||
dns_name_clone(zonename, name);
|
||||
dns_message_gettemprdataset(updatemsg, &rdataset);
|
||||
@@ -2829,20 +2830,21 @@ lookforsoa:
|
||||
goto lookforsoa;
|
||||
}
|
||||
|
||||
ISC_LIST_FOREACH (rcvmsg->sections[section], name, link) {
|
||||
ISC_LIST_FOREACH (rcvmsg->sections[section], n, link) {
|
||||
soaset = NULL;
|
||||
result = dns_message_findtype(name, dns_rdatatype_soa, 0,
|
||||
&soaset);
|
||||
result = dns_message_findtype(n, dns_rdatatype_soa, 0, &soaset);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
name = n;
|
||||
break;
|
||||
}
|
||||
if (section == DNS_SECTION_ANSWER) {
|
||||
dns_rdataset_t *tset = NULL;
|
||||
if (dns_message_findtype(name, dns_rdatatype_cname, 0,
|
||||
if (dns_message_findtype(n, dns_rdatatype_cname, 0,
|
||||
&tset) == ISC_R_SUCCESS ||
|
||||
dns_message_findtype(name, dns_rdatatype_dname, 0,
|
||||
dns_message_findtype(n, dns_rdatatype_dname, 0,
|
||||
&tset) == ISC_R_SUCCESS)
|
||||
{
|
||||
name = n;
|
||||
seencname = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -540,14 +540,14 @@ process_name(query_ctx_t *qctx, filter_a_t mode, const dns_name_t *name,
|
||||
dns_rdataset_t *rdataset = NULL, *sigrdataset = NULL;
|
||||
isc_result_t result;
|
||||
bool modified = false;
|
||||
dns_name_t *n = UNCONST(name);
|
||||
|
||||
if (only_if_aaaa_exists) {
|
||||
CHECK(dns_message_findtype(name, dns_rdatatype_aaaa, 0, NULL));
|
||||
CHECK(dns_message_findtype(n, dns_rdatatype_aaaa, 0, NULL));
|
||||
}
|
||||
|
||||
(void)dns_message_findtype(name, type, 0, &rdataset);
|
||||
(void)dns_message_findtype(name, dns_rdatatype_rrsig, type,
|
||||
&sigrdataset);
|
||||
(void)dns_message_findtype(n, type, 0, &rdataset);
|
||||
(void)dns_message_findtype(n, dns_rdatatype_rrsig, type, &sigrdataset);
|
||||
|
||||
if (rdataset != NULL &&
|
||||
(sigrdataset == NULL || !WANTDNSSEC(qctx->client) ||
|
||||
|
||||
@@ -544,14 +544,14 @@ process_name(query_ctx_t *qctx, filter_aaaa_t mode, const dns_name_t *name,
|
||||
dns_rdataset_t *rdataset = NULL, *sigrdataset = NULL;
|
||||
isc_result_t result;
|
||||
bool modified = false;
|
||||
dns_name_t *n = UNCONST(name);
|
||||
|
||||
if (only_if_a_exists) {
|
||||
CHECK(dns_message_findtype(name, dns_rdatatype_a, 0, NULL));
|
||||
CHECK(dns_message_findtype(n, dns_rdatatype_a, 0, NULL));
|
||||
}
|
||||
|
||||
(void)dns_message_findtype(name, type, 0, &rdataset);
|
||||
(void)dns_message_findtype(name, dns_rdatatype_rrsig, type,
|
||||
&sigrdataset);
|
||||
(void)dns_message_findtype(n, type, 0, &rdataset);
|
||||
(void)dns_message_findtype(n, dns_rdatatype_rrsig, type, &sigrdataset);
|
||||
|
||||
if (rdataset != NULL &&
|
||||
(sigrdataset == NULL || !WANTDNSSEC(qctx->client) ||
|
||||
|
||||
@@ -427,7 +427,6 @@ repopulate_buffer:
|
||||
}
|
||||
CHECK("dns_message_sectiontotext", result);
|
||||
} else if (display_answer) {
|
||||
dns_rdataset_t *rdataset;
|
||||
isc_result_t loopresult;
|
||||
dns_name_t empty_name;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
|
||||
+1
-5
@@ -462,11 +462,7 @@ dns_aclelement_match(const isc_netaddr_t *reqaddr, const dns_name_t *reqsigner,
|
||||
|
||||
static void
|
||||
dns__acl_destroy_port_transports(dns_acl_t *acl) {
|
||||
dns_acl_port_transports_t *port_proto = NULL;
|
||||
dns_acl_port_transports_t *next = NULL;
|
||||
ISC_LIST_FOREACH_SAFE (acl->ports_and_transports, port_proto, link,
|
||||
next)
|
||||
{
|
||||
ISC_LIST_FOREACH_SAFE (acl->ports_and_transports, port_proto, link) {
|
||||
ISC_LIST_DEQUEUE(acl->ports_and_transports, port_proto, link);
|
||||
isc_mem_put(acl->mctx, port_proto, sizeof(*port_proto));
|
||||
}
|
||||
|
||||
+7
-13
@@ -824,10 +824,9 @@ client_resfind(resctx_t *rctx, dns_fetchresponse_t *resp) {
|
||||
} while (want_restart);
|
||||
|
||||
if (send_event) {
|
||||
dns_name_t *next_name;
|
||||
ISC_LIST_FOREACH_SAFE (rctx->namelist, name, link, next_name) {
|
||||
ISC_LIST_UNLINK(rctx->namelist, name, link);
|
||||
ISC_LIST_APPEND(rctx->rev->answerlist, name, link);
|
||||
ISC_LIST_FOREACH_SAFE (rctx->namelist, n, link) {
|
||||
ISC_LIST_UNLINK(rctx->namelist, n, link);
|
||||
ISC_LIST_APPEND(rctx->rev->answerlist, n, link);
|
||||
}
|
||||
|
||||
rctx->rev->result = result;
|
||||
@@ -840,14 +839,12 @@ static void
|
||||
resolve_done(void *arg) {
|
||||
dns_clientresume_t *rev = (dns_clientresume_t *)arg;
|
||||
resarg_t *resarg = rev->arg;
|
||||
dns_name_t *name = NULL;
|
||||
isc_result_t result;
|
||||
|
||||
resarg->result = rev->result;
|
||||
resarg->vresult = rev->vresult;
|
||||
|
||||
dns_name_t *new_name;
|
||||
ISC_LIST_FOREACH_SAFE (rev->answerlist, name, link, new_name) {
|
||||
ISC_LIST_FOREACH_SAFE (rev->answerlist, name, link) {
|
||||
ISC_LIST_UNLINK(rev->answerlist, name, link);
|
||||
ISC_LIST_APPEND(*resarg->namelist, name, link);
|
||||
}
|
||||
@@ -1003,20 +1000,17 @@ dns_client_resolve(dns_client_t *client, const dns_name_t *name,
|
||||
|
||||
void
|
||||
dns_client_freeresanswer(dns_client_t *client, dns_namelist_t *namelist) {
|
||||
dns_name_t *name, *new_name;
|
||||
dns_rdataset_t *rdataset, *new_rdataset;
|
||||
|
||||
REQUIRE(DNS_CLIENT_VALID(client));
|
||||
REQUIRE(namelist != NULL);
|
||||
|
||||
ISC_LIST_FOREACH_SAFE (*namelist, name, link, new_name) {
|
||||
ISC_LIST_FOREACH_SAFE (*namelist, name, link) {
|
||||
ISC_LIST_UNLINK(*namelist, name, link);
|
||||
|
||||
ISC_LIST_FOREACH_SAFE (name->list, rdataset, link, new_rdataset)
|
||||
{
|
||||
ISC_LIST_FOREACH_SAFE (name->list, rdataset, link) {
|
||||
ISC_LIST_UNLINK(name->list, rdataset, link);
|
||||
putrdataset(client->mctx, &rdataset);
|
||||
}
|
||||
|
||||
dns_name_free(name, client->mctx);
|
||||
isc_mem_put(client->mctx, name, sizeof(*name));
|
||||
}
|
||||
|
||||
@@ -805,7 +805,7 @@ dns_message_findname(dns_message_t *msg, dns_section_t section,
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
dns_message_findtype(const dns_name_t *name, dns_rdatatype_t type,
|
||||
dns_message_findtype(dns_name_t *name, dns_rdatatype_t type,
|
||||
dns_rdatatype_t covers, dns_rdataset_t **rdataset);
|
||||
/*%<
|
||||
* Search the name for the specified type. If it is found, *rdataset is
|
||||
|
||||
+20
-48
@@ -440,11 +440,8 @@ msginit(dns_message_t *m) {
|
||||
|
||||
static void
|
||||
msgresetname(dns_message_t *msg, dns_name_t *name) {
|
||||
dns_rdataset_t *rds = NULL, *next_rds = NULL;
|
||||
|
||||
ISC_LIST_FOREACH_SAFE (name->list, rds, link, next_rds) {
|
||||
ISC_LIST_FOREACH_SAFE (name->list, rds, link) {
|
||||
ISC_LIST_UNLINK(name->list, rds, link);
|
||||
|
||||
dns__message_putassociatedrdataset(msg, &rds);
|
||||
}
|
||||
}
|
||||
@@ -453,14 +450,9 @@ static void
|
||||
msgresetnames(dns_message_t *msg, unsigned int first_section) {
|
||||
/* Clean up name lists. */
|
||||
for (size_t i = first_section; i < DNS_SECTION_MAX; i++) {
|
||||
dns_name_t *name = NULL, *next_name = NULL;
|
||||
|
||||
ISC_LIST_FOREACH_SAFE (msg->sections[i], name, link, next_name)
|
||||
{
|
||||
ISC_LIST_FOREACH_SAFE (msg->sections[i], name, link) {
|
||||
ISC_LIST_UNLINK(msg->sections[i], name, link);
|
||||
|
||||
msgresetname(msg, name);
|
||||
|
||||
dns_message_puttempname(msg, &name);
|
||||
}
|
||||
}
|
||||
@@ -763,8 +755,6 @@ name_match(void *node, const void *key) {
|
||||
static isc_result_t
|
||||
findname(dns_name_t **foundname, const dns_name_t *target,
|
||||
dns_namelist_t *section) {
|
||||
dns_name_t *name = NULL;
|
||||
|
||||
ISC_LIST_FOREACH_REV (*section, name, link) {
|
||||
if (dns_name_equal(name, target)) {
|
||||
if (foundname != NULL) {
|
||||
@@ -799,17 +789,14 @@ rds_match(void *node, const void *key0) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_message_findtype(const dns_name_t *name, dns_rdatatype_t type,
|
||||
dns_message_findtype(dns_name_t *name, dns_rdatatype_t type,
|
||||
dns_rdatatype_t covers, dns_rdataset_t **rdatasetp) {
|
||||
dns_rdataset_t *rds = NULL;
|
||||
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(rdatasetp == NULL || *rdatasetp == NULL);
|
||||
|
||||
ISC_LIST_FOREACH_REV (name->list, rds, link) {
|
||||
if (rds->type == type && rds->covers == covers) {
|
||||
SET_IF_NOT_NULL(rdatasetp, rds);
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -921,7 +908,6 @@ getrdata(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t dctx,
|
||||
|
||||
static void
|
||||
cleanup_name_hashmaps(dns_namelist_t *section) {
|
||||
dns_name_t *name = NULL;
|
||||
ISC_LIST_FOREACH (*section, name, link) {
|
||||
if (name->hashmap != NULL) {
|
||||
isc_hashmap_destroy(&name->hashmap);
|
||||
@@ -1881,9 +1867,9 @@ update_min_section_ttl(dns_message_t *restrict msg,
|
||||
isc_result_t
|
||||
dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid,
|
||||
unsigned int options) {
|
||||
dns_namelist_t *section;
|
||||
dns_name_t *name, *next_name;
|
||||
dns_rdataset_t *rdataset, *next_rdataset;
|
||||
dns_namelist_t *section = NULL;
|
||||
dns_name_t *name = NULL;
|
||||
dns_rdataset_t *rdataset = NULL;
|
||||
unsigned int count, total;
|
||||
isc_result_t result;
|
||||
isc_buffer_t st; /* for rollbacks */
|
||||
@@ -1987,24 +1973,20 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid,
|
||||
return ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
ISC_LIST_FOREACH_SAFE (*section, name, link, next_name) {
|
||||
rdataset = ISC_LIST_HEAD(name->list);
|
||||
while (rdataset != NULL) {
|
||||
next_rdataset = ISC_LIST_NEXT(rdataset, link);
|
||||
|
||||
if ((rdataset->attributes &
|
||||
ISC_LIST_FOREACH_SAFE (*section, n, link) {
|
||||
ISC_LIST_FOREACH_SAFE (n->list, rds, link) {
|
||||
if ((rds->attributes &
|
||||
DNS_RDATASETATTR_RENDERED) != 0)
|
||||
{
|
||||
goto next;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (((options & DNS_MESSAGERENDER_ORDERED) ==
|
||||
0) &&
|
||||
(sectionid == DNS_SECTION_ADDITIONAL) &&
|
||||
wrong_priority(rdataset, pass,
|
||||
preferred_glue))
|
||||
wrong_priority(rds, pass, preferred_glue))
|
||||
{
|
||||
goto next;
|
||||
continue;
|
||||
}
|
||||
|
||||
st = *(msg->buffer);
|
||||
@@ -2012,14 +1994,12 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid,
|
||||
count = 0;
|
||||
if (partial) {
|
||||
result = dns_rdataset_towirepartial(
|
||||
rdataset, name, msg->cctx,
|
||||
msg->buffer, rd_options, &count,
|
||||
NULL);
|
||||
rds, n, msg->cctx, msg->buffer,
|
||||
rd_options, &count, NULL);
|
||||
} else {
|
||||
result = dns_rdataset_towire(
|
||||
rdataset, name, msg->cctx,
|
||||
msg->buffer, rd_options,
|
||||
&count);
|
||||
rds, n, msg->cctx, msg->buffer,
|
||||
rd_options, &count);
|
||||
}
|
||||
|
||||
total += count;
|
||||
@@ -2057,24 +2037,19 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid,
|
||||
* If we have rendered non-validated data,
|
||||
* ensure that the AD bit is not set.
|
||||
*/
|
||||
if (rdataset->trust != dns_trust_secure &&
|
||||
if (rds->trust != dns_trust_secure &&
|
||||
(sectionid == DNS_SECTION_ANSWER ||
|
||||
sectionid == DNS_SECTION_AUTHORITY))
|
||||
{
|
||||
msg->flags &= ~DNS_MESSAGEFLAG_AD;
|
||||
}
|
||||
if (OPTOUT(rdataset)) {
|
||||
if (OPTOUT(rds)) {
|
||||
msg->flags &= ~DNS_MESSAGEFLAG_AD;
|
||||
}
|
||||
|
||||
update_min_section_ttl(msg, sectionid,
|
||||
rdataset);
|
||||
update_min_section_ttl(msg, sectionid, rds);
|
||||
|
||||
rdataset->attributes |=
|
||||
DNS_RDATASETATTR_RENDERED;
|
||||
|
||||
next:
|
||||
rdataset = next_rdataset;
|
||||
rds->attributes |= DNS_RDATASETATTR_RENDERED;
|
||||
}
|
||||
}
|
||||
} while (--pass != 0);
|
||||
@@ -2303,7 +2278,6 @@ dns_message_renderreset(dns_message_t *msg) {
|
||||
msg->cursors[i] = NULL;
|
||||
msg->counts[i] = 0;
|
||||
MSG_SECTION_FOREACH (msg, i, name) {
|
||||
dns_rdataset_t *rds = NULL;
|
||||
ISC_LIST_FOREACH (name->list, rds, link) {
|
||||
rds->attributes &= ~DNS_RDATASETATTR_RENDERED;
|
||||
}
|
||||
@@ -3305,7 +3279,6 @@ dns_message_sectiontotext(dns_message_t *msg, dns_section_t section,
|
||||
msg->indent.count += has_yaml;
|
||||
|
||||
MSG_SECTION_FOREACH (msg, section, name) {
|
||||
dns_rdataset_t *rds = NULL;
|
||||
ISC_LIST_FOREACH (name->list, rds, link) {
|
||||
if (section == DNS_SECTION_ANSWER &&
|
||||
rds->type == dns_rdatatype_soa)
|
||||
@@ -4861,7 +4834,6 @@ message_authority_soa_min(dns_message_t *msg, dns_ttl_t *ttlp) {
|
||||
}
|
||||
|
||||
MSG_SECTION_FOREACH (msg, DNS_SECTION_AUTHORITY, name) {
|
||||
dns_rdataset_t *rds = NULL;
|
||||
ISC_LIST_FOREACH (name->list, rds, link) {
|
||||
if ((rds->attributes & DNS_RDATASETATTR_RENDERED) == 0)
|
||||
{
|
||||
|
||||
@@ -128,7 +128,6 @@ addoptout(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
|
||||
dns_rdataset_t *addedrdataset) {
|
||||
isc_buffer_t buffer;
|
||||
isc_region_t r;
|
||||
dns_rdataset_t *rdataset;
|
||||
dns_rdatatype_t type;
|
||||
dns_ttl_t ttl;
|
||||
dns_trust_t trust;
|
||||
|
||||
+1
-2
@@ -172,10 +172,9 @@ dns_requestmgr_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr,
|
||||
static void
|
||||
requests_shutdown(void *arg) {
|
||||
dns_requestmgr_t *requestmgr = arg;
|
||||
dns_request_t *request = NULL, *next = NULL;
|
||||
uint32_t tid = isc_tid();
|
||||
|
||||
ISC_LIST_FOREACH_SAFE (requestmgr->requests[tid], request, link, next) {
|
||||
ISC_LIST_FOREACH_SAFE (requestmgr->requests[tid], request, link) {
|
||||
req_log(ISC_LOG_DEBUG(3), "%s(%" PRIu32 ": request %p",
|
||||
__func__, tid, request);
|
||||
if (DNS_REQUEST_COMPLETE(request)) {
|
||||
|
||||
+15
-32
@@ -4978,8 +4978,6 @@ cleanup_nameservers:
|
||||
*/
|
||||
static bool
|
||||
is_lame(fetchctx_t *fctx, dns_message_t *message) {
|
||||
dns_rdataset_t *rdataset;
|
||||
|
||||
if (message->rcode != dns_rcode_noerror &&
|
||||
message->rcode != dns_rcode_yxdomain &&
|
||||
message->rcode != dns_rcode_nxdomain)
|
||||
@@ -5308,8 +5306,6 @@ validated(void *arg) {
|
||||
dns_fetchresponse_t *hresp = NULL;
|
||||
dns_rdataset_t *ardataset = NULL;
|
||||
dns_rdataset_t *asigrdataset = NULL;
|
||||
dns_rdataset_t *rdataset = NULL;
|
||||
dns_rdataset_t *sigrdataset = NULL;
|
||||
dns_resolver_t *res = NULL;
|
||||
dns_valarg_t *valarg = NULL;
|
||||
fetchctx_t *fctx = NULL;
|
||||
@@ -5643,6 +5639,8 @@ answer_response:
|
||||
*/
|
||||
MSG_SECTION_FOREACH (message, DNS_SECTION_AUTHORITY, name) {
|
||||
ISC_LIST_FOREACH (name->list, rdataset, link) {
|
||||
dns_rdataset_t *sigrdataset = NULL;
|
||||
|
||||
if ((rdataset->type != dns_rdatatype_ns &&
|
||||
rdataset->type != dns_rdatatype_soa &&
|
||||
rdataset->type != dns_rdatatype_nsec) ||
|
||||
@@ -5651,13 +5649,13 @@ answer_response:
|
||||
continue;
|
||||
}
|
||||
|
||||
ISC_LIST_FOREACH (name->list, sigrdataset, link) {
|
||||
if (sigrdataset->type != dns_rdatatype_rrsig ||
|
||||
sigrdataset->covers != rdataset->type)
|
||||
ISC_LIST_FOREACH (name->list, s, link) {
|
||||
if (s->type == dns_rdatatype_rrsig &&
|
||||
s->covers == rdataset->type)
|
||||
{
|
||||
continue;
|
||||
sigrdataset = s;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (sigrdataset == NULL ||
|
||||
sigrdataset->trust != dns_trust_secure)
|
||||
@@ -5832,7 +5830,7 @@ fctx_log(void *arg, int level, const char *fmt, ...) {
|
||||
static isc_result_t
|
||||
findnoqname(fetchctx_t *fctx, dns_message_t *message, dns_name_t *name,
|
||||
dns_rdatatype_t type, dns_name_t **noqnamep) {
|
||||
dns_rdataset_t *nrdataset, *sigrdataset;
|
||||
dns_rdataset_t *sigrdataset = NULL;
|
||||
dns_rdata_rrsig_t rrsig;
|
||||
isc_result_t result;
|
||||
unsigned int labels;
|
||||
@@ -5852,12 +5850,9 @@ findnoqname(fetchctx_t *fctx, dns_message_t *message, dns_name_t *name,
|
||||
/*
|
||||
* Find the SIG for this rdataset, if we have it.
|
||||
*/
|
||||
for (sigrdataset = ISC_LIST_HEAD(name->list); sigrdataset != NULL;
|
||||
sigrdataset = ISC_LIST_NEXT(sigrdataset, link))
|
||||
{
|
||||
if (sigrdataset->type == dns_rdatatype_rrsig &&
|
||||
sigrdataset->covers == type)
|
||||
{
|
||||
ISC_LIST_FOREACH (name->list, sig, link) {
|
||||
if (sig->type == dns_rdatatype_rrsig && sig->covers == type) {
|
||||
sigrdataset = sig;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -6608,7 +6603,6 @@ ncache_message(fetchctx_t *fctx, dns_message_t *message,
|
||||
* Mark all rdatasets as pending.
|
||||
*/
|
||||
MSG_SECTION_FOREACH (message, DNS_SECTION_AUTHORITY, tname) {
|
||||
dns_rdataset_t *trdataset = NULL;
|
||||
ISC_LIST_FOREACH (tname->list, trdataset, link) {
|
||||
trdataset->trust = dns_trust_pending_answer;
|
||||
}
|
||||
@@ -7290,16 +7284,13 @@ cleanup:
|
||||
|
||||
static void
|
||||
checknamessection(dns_message_t *message, dns_section_t section) {
|
||||
isc_result_t result;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
dns_rdataset_t *rdataset;
|
||||
|
||||
MSG_SECTION_FOREACH (message, section, name) {
|
||||
ISC_LIST_FOREACH (name->list, rdataset, link) {
|
||||
for (result = dns_rdataset_first(rdataset);
|
||||
for (isc_result_t result = dns_rdataset_first(rdataset);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdataset_next(rdataset))
|
||||
{
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
if (!dns_rdata_checkowner(name, rdata.rdclass,
|
||||
rdata.type, false) ||
|
||||
@@ -7308,7 +7299,6 @@ checknamessection(dns_message_t *message, dns_section_t section) {
|
||||
rdataset->attributes |=
|
||||
DNS_RDATASETATTR_CHECKNAMES;
|
||||
}
|
||||
dns_rdata_reset(&rdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7367,9 +7357,8 @@ log_nsid(isc_buffer_t *opt, size_t nsid_len, resquery_t *query, int level,
|
||||
|
||||
static bool
|
||||
betterreferral(respctx_t *rctx) {
|
||||
dns_rdataset_t *rdataset;
|
||||
|
||||
dns_message_t *msg = rctx->query->rmessage;
|
||||
|
||||
MSG_SECTION_FOREACH (msg, DNS_SECTION_AUTHORITY, name) {
|
||||
if (!isstrictsubdomain(name, rctx->fctx->domain)) {
|
||||
continue;
|
||||
@@ -8430,9 +8419,8 @@ rctx_answer_positive(respctx_t *rctx) {
|
||||
static void
|
||||
rctx_answer_scan(respctx_t *rctx) {
|
||||
fetchctx_t *fctx = rctx->fctx;
|
||||
dns_rdataset_t *rdataset = NULL;
|
||||
|
||||
dns_message_t *msg = rctx->query->rmessage;
|
||||
|
||||
MSG_SECTION_FOREACH (msg, DNS_SECTION_ANSWER, name) {
|
||||
int order;
|
||||
unsigned int nlabels;
|
||||
@@ -8771,8 +8759,6 @@ rctx_authority_positive(respctx_t *rctx) {
|
||||
dns_message_t *msg = rctx->query->rmessage;
|
||||
MSG_SECTION_FOREACH (msg, DNS_SECTION_AUTHORITY, name) {
|
||||
if (!name_external(name, dns_rdatatype_ns, fctx)) {
|
||||
dns_rdataset_t *rdataset = NULL;
|
||||
|
||||
/*
|
||||
* We expect to find NS or SIG NS rdatasets, and
|
||||
* nothing else.
|
||||
@@ -8964,7 +8950,6 @@ static isc_result_t
|
||||
rctx_authority_negative(respctx_t *rctx) {
|
||||
fetchctx_t *fctx = rctx->fctx;
|
||||
dns_section_t section;
|
||||
dns_rdataset_t *rdataset = NULL;
|
||||
|
||||
section = DNS_SECTION_AUTHORITY;
|
||||
|
||||
@@ -9108,7 +9093,6 @@ static isc_result_t
|
||||
rctx_authority_dnssec(respctx_t *rctx) {
|
||||
isc_result_t result;
|
||||
fetchctx_t *fctx = rctx->fctx;
|
||||
dns_rdataset_t *rdataset = NULL;
|
||||
|
||||
dns_message_t *msg = rctx->query->rmessage;
|
||||
MSG_SECTION_FOREACH (msg, DNS_SECTION_AUTHORITY, name) {
|
||||
@@ -9367,7 +9351,6 @@ again:
|
||||
|
||||
dns_message_t *msg = rctx->query->rmessage;
|
||||
MSG_SECTION_FOREACH (msg, section, name) {
|
||||
dns_rdataset_t *rdataset;
|
||||
if (!name->attributes.chase) {
|
||||
continue;
|
||||
}
|
||||
|
||||
+6
-12
@@ -154,13 +154,9 @@ add_rdata_to_list(dns_message_t *msg, dns_name_t *name, dns_rdata_t *rdata,
|
||||
|
||||
static void
|
||||
free_namelist(dns_message_t *msg, dns_namelist_t *namelist) {
|
||||
dns_name_t *name = NULL, *new_name = NULL;
|
||||
|
||||
ISC_LIST_FOREACH_SAFE (*namelist, name, link, new_name) {
|
||||
dns_rdataset_t *set = NULL, *new_set = NULL;
|
||||
ISC_LIST_FOREACH_SAFE (*namelist, name, link) {
|
||||
ISC_LIST_UNLINK(*namelist, name, link);
|
||||
|
||||
ISC_LIST_FOREACH_SAFE (name->list, set, link, new_set) {
|
||||
ISC_LIST_FOREACH_SAFE (name->list, set, link) {
|
||||
ISC_LIST_UNLINK(name->list, set, link);
|
||||
if (dns_rdataset_isassociated(set)) {
|
||||
dns_rdataset_disassociate(set);
|
||||
@@ -354,7 +350,7 @@ dns_tkey_processquery(dns_message_t *msg, dns_tkeyctx_t *tctx,
|
||||
dns_tsigkeyring_t *ring) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
dns_rdata_tkey_t tkeyin, tkeyout;
|
||||
dns_name_t *qname = NULL, *name = NULL;
|
||||
dns_name_t *qname = NULL;
|
||||
dns_name_t *keyname = NULL, *signer = NULL;
|
||||
dns_name_t tsigner = DNS_NAME_INITEMPTY;
|
||||
dns_fixedname_t fkeyname;
|
||||
@@ -378,11 +374,10 @@ dns_tkey_processquery(dns_message_t *msg, dns_tkeyctx_t *tctx,
|
||||
|
||||
qname = ISC_LIST_HEAD(msg->sections[DNS_SECTION_QUESTION]);
|
||||
|
||||
/*
|
||||
* Look for a TKEY record that matches the question.
|
||||
/* * Look for a TKEY record that matches the question.
|
||||
*/
|
||||
result = dns_message_findname(msg, DNS_SECTION_ADDITIONAL, qname,
|
||||
dns_rdatatype_tkey, 0, &name, &tkeyset);
|
||||
dns_rdatatype_tkey, 0, NULL, &tkeyset);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
result = DNS_R_FORMERR;
|
||||
tkey_log("dns_tkey_processquery: couldn't find a TKEY "
|
||||
@@ -509,8 +504,7 @@ dns_tkey_processquery(dns_message_t *msg, dns_tkeyctx_t *tctx,
|
||||
RETERR(dns_message_reply(msg, true));
|
||||
add_rdata_to_list(msg, keyname, &rdata, 0, &namelist);
|
||||
|
||||
dns_name_t *new_name;
|
||||
ISC_LIST_FOREACH_SAFE (namelist, name, link, new_name) {
|
||||
ISC_LIST_FOREACH_SAFE (namelist, name, link) {
|
||||
ISC_LIST_UNLINK(namelist, name, link);
|
||||
dns_message_addname(msg, name, DNS_SECTION_ANSWER);
|
||||
}
|
||||
|
||||
@@ -1975,8 +1975,6 @@ xfrin_recv_done(isc_result_t result, isc_region_t *region, void *arg) {
|
||||
}
|
||||
|
||||
MSG_SECTION_FOREACH (msg, DNS_SECTION_ANSWER, name) {
|
||||
dns_rdataset_t *rds = NULL;
|
||||
|
||||
LIBDNS_XFRIN_RECV_ANSWER(xfr, xfr->info, msg);
|
||||
|
||||
ISC_LIST_FOREACH (name->list, rds, link) {
|
||||
|
||||
+2
-5
@@ -13555,7 +13555,7 @@ save_nsrrset(dns_message_t *message, dns_name_t *name,
|
||||
isc_result_t result;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
bool has_glue = false;
|
||||
dns_name_t *ns_name;
|
||||
|
||||
/*
|
||||
* List of NS entries in answer, keep names that will be used
|
||||
* to resolve missing A/AAAA glue for each entry.
|
||||
@@ -13683,9 +13683,8 @@ save_nsrrset(dns_message_t *message, dns_name_t *name,
|
||||
|
||||
result = ISC_R_SUCCESS;
|
||||
|
||||
dns_name_t *new_ns_name;
|
||||
done:
|
||||
ISC_LIST_FOREACH_SAFE (ns_list, ns_name, link, new_ns_name) {
|
||||
ISC_LIST_FOREACH_SAFE (ns_list, ns_name, link) {
|
||||
ISC_LIST_UNLINK(ns_list, ns_name, link);
|
||||
dns_name_free(ns_name, cb_args->stub->mctx);
|
||||
isc_mem_put(cb_args->stub->mctx, ns_name, sizeof(*ns_name));
|
||||
@@ -16148,7 +16147,6 @@ dnssec_log(dns_zone_t *zone, int level, const char *fmt, ...) {
|
||||
|
||||
static int
|
||||
message_count(dns_message_t *msg, dns_section_t section, dns_rdatatype_t type) {
|
||||
dns_rdataset_t *curr;
|
||||
int count = 0;
|
||||
|
||||
MSG_SECTION_FOREACH (msg, section, name) {
|
||||
@@ -21094,7 +21092,6 @@ checkds_done(void *arg) {
|
||||
/* Lookup DS RRset. */
|
||||
|
||||
MSG_SECTION_FOREACH (message, DNS_SECTION_ANSWER, name) {
|
||||
dns_rdataset_t *rdataset;
|
||||
if (dns_name_compare(&zone->origin, name) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
+5
-6
@@ -290,8 +290,7 @@ destroy_httpdmgr(isc_httpdmgr_t *httpdmgr) {
|
||||
* Clear out the list of all actions we know about. Just free the
|
||||
* memory.
|
||||
*/
|
||||
isc_httpdurl_t *url, *next;
|
||||
ISC_LIST_FOREACH_SAFE (httpdmgr->urls, url, link, next) {
|
||||
ISC_LIST_FOREACH_SAFE (httpdmgr->urls, url, link) {
|
||||
isc_mem_free(httpdmgr->mctx, url->url);
|
||||
ISC_LIST_UNLINK(httpdmgr->urls, url, link);
|
||||
isc_mem_put(httpdmgr->mctx, url, sizeof(isc_httpdurl_t));
|
||||
@@ -780,8 +779,9 @@ prepare_response(void *arg) {
|
||||
}
|
||||
|
||||
LOCK(&mgr->lock);
|
||||
ISC_LIST_FOREACH (mgr->urls, url, link) {
|
||||
if (strncmp(path, url->url, path_len) == 0) {
|
||||
ISC_LIST_FOREACH (mgr->urls, u, link) {
|
||||
if (strncmp(path, u->url, path_len) == 0) {
|
||||
url = u;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -978,8 +978,7 @@ isc_httpdmgr_shutdown(isc_httpdmgr_t **httpdmgrp) {
|
||||
|
||||
LOCK(&httpdmgr->lock);
|
||||
|
||||
isc_httpd_t *httpd = NULL, *next = NULL;
|
||||
ISC_LIST_FOREACH_SAFE (httpdmgr->running, httpd, link, next) {
|
||||
ISC_LIST_FOREACH_SAFE (httpdmgr->running, httpd, link) {
|
||||
if (httpd->handle != NULL) {
|
||||
httpd_request(httpd->handle, ISC_R_SUCCESS, NULL,
|
||||
httpd);
|
||||
|
||||
+18
-14
@@ -230,29 +230,33 @@
|
||||
}
|
||||
|
||||
/* clang-format off */
|
||||
#define ISC_LIST_FOREACH(list, elt, link) \
|
||||
for (elt = ISC_LIST_HEAD(list); \
|
||||
elt != NULL; \
|
||||
#define ISC_LIST_FOREACH(list, elt, link) \
|
||||
for (typeof((list).head) elt = ISC_LIST_HEAD(list); \
|
||||
elt != NULL; \
|
||||
elt = ISC_LIST_NEXT(elt, link))
|
||||
/* clang-format on */
|
||||
|
||||
/* clang-format off */
|
||||
#define ISC_LIST_FOREACH_SAFE(list, elt, link, next) \
|
||||
for (elt = ISC_LIST_HEAD(list), next = (elt != NULL) ? ISC_LIST_NEXT(elt, link) : NULL; \
|
||||
elt != NULL; \
|
||||
elt = next, next = (elt != NULL) ? ISC_LIST_NEXT(elt, link) : NULL)
|
||||
#define ISC_LIST_FOREACH_SAFE(list, elt, link) \
|
||||
for (typeof((list).head) elt = ISC_LIST_HEAD(list), \
|
||||
elt##_next = (elt != NULL) ? ISC_LIST_NEXT(elt, link) : NULL; \
|
||||
elt != NULL; \
|
||||
elt = elt##_next, \
|
||||
elt##_next = (elt != NULL) ? ISC_LIST_NEXT(elt, link) : NULL)
|
||||
/* clang-format on */
|
||||
|
||||
/* clang-format off */
|
||||
#define ISC_LIST_FOREACH_REV(list, elt, link) \
|
||||
for (elt = ISC_LIST_TAIL(list); \
|
||||
elt != NULL; \
|
||||
#define ISC_LIST_FOREACH_REV(list, elt, link) \
|
||||
for (typeof((list).tail) elt = ISC_LIST_TAIL(list); \
|
||||
elt != NULL; \
|
||||
elt = ISC_LIST_PREV(elt, link))
|
||||
/* clang-format on */
|
||||
|
||||
/* clang-format off */
|
||||
#define ISC_LIST_FOREACH_REV_SAFE(list, elt, link, prev) \
|
||||
for (elt = ISC_LIST_TAIL(list), prev = (elt != NULL) ? ISC_LIST_PREV(elt, link) : NULL; \
|
||||
elt != NULL; \
|
||||
elt = prev, prev = (elt != NULL) ? ISC_LIST_PREV(elt, link) : NULL)
|
||||
#define ISC_LIST_FOREACH_REV_SAFE(list, elt, link) \
|
||||
for (typeof((list).tail) elt = ISC_LIST_TAIL(list), \
|
||||
elt##_prev = (elt != NULL) ? ISC_LIST_PREV(elt, link) : NULL; \
|
||||
elt != NULL; \
|
||||
elt = elt##_prev, \
|
||||
elt##_prev = (elt != NULL) ? ISC_LIST_PREV(elt, link) : NULL)
|
||||
/* clang-format on */
|
||||
|
||||
+1
-3
@@ -436,9 +436,7 @@ isc_logconfig_destroy(isc_logconfig_t **lcfgp) {
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(lcfg->channellists); i++) {
|
||||
isc_logchannellist_t *item = NULL, *next = NULL;
|
||||
ISC_LIST_FOREACH_SAFE (lcfg->channellists[i], item, link, next)
|
||||
{
|
||||
ISC_LIST_FOREACH_SAFE (lcfg->channellists[i], item, link) {
|
||||
ISC_LIST_UNLINK(lcfg->channellists[i], item, link);
|
||||
isc_mem_put(mctx, item, sizeof(*item));
|
||||
}
|
||||
|
||||
+1
-4
@@ -6034,9 +6034,7 @@ message_clearrdataset(dns_message_t *msg, unsigned int attr) {
|
||||
* Clean up name lists by calling the rdataset disassociate function.
|
||||
*/
|
||||
for (i = DNS_SECTION_ANSWER; i < DNS_SECTION_MAX; i++) {
|
||||
dns_name_t *name, *next_name;
|
||||
ISC_LIST_FOREACH_SAFE (msg->sections[i], name, link, next_name)
|
||||
{
|
||||
ISC_LIST_FOREACH_SAFE (msg->sections[i], name, link) {
|
||||
rds = ISC_LIST_HEAD(name->list);
|
||||
while (rds != NULL) {
|
||||
next_rds = ISC_LIST_NEXT(rds, link);
|
||||
@@ -11297,7 +11295,6 @@ query_glueanswer(query_ctx_t *qctx) {
|
||||
const dns_namelist_t *secs = qctx->client->message->sections;
|
||||
const dns_section_t section = DNS_SECTION_ADDITIONAL;
|
||||
dns_message_t *msg;
|
||||
dns_rdataset_t *rdataset = NULL;
|
||||
|
||||
if (!ISC_LIST_EMPTY(secs[DNS_SECTION_ANSWER]) ||
|
||||
qctx->client->message->rcode != dns_rcode_noerror ||
|
||||
|
||||
@@ -732,7 +732,6 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
|
||||
rrstream_t *data_stream = NULL;
|
||||
rrstream_t *stream = NULL;
|
||||
dns_difftuple_t *current_soa_tuple = NULL;
|
||||
dns_rdataset_t *soa_rdataset;
|
||||
dns_rdata_t soa_rdata = DNS_RDATA_INIT;
|
||||
bool have_soa = false;
|
||||
const char *mnemonic = NULL;
|
||||
|
||||
Reference in New Issue
Block a user