* (query_lookup() again, using the cache database) to find a better
* answer. If an answer is found, go to 7.
*
- * 5. If recursion is allowed, begin recursion (query_recurse()).
+ * 5. If recursion is allowed, begin recursion (ns_query_recurse()).
* Go to 15 to clean up this phase of the query. When recursion
* is complete, processing will resume at 6.
*
recparam_update(ns_query_recparam_t *param, dns_rdatatype_t qtype,
const dns_name_t *qname, const dns_name_t *qdomain);
-static isc_result_t
-query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname,
- dns_name_t *qdomain, dns_rdataset_t *nameservers,
- bool resuming);
-
static isc_result_t
query_resume(query_ctx_t *qctx);
static void
query_addauth(query_ctx_t *qctx);
-static isc_result_t
-query_done(query_ctx_t *qctx);
-
/*
* XXX:
* This is a temporary hooks table, pre-populated with functions
UNLOCK(&client->query.fetchlock);
}
-static inline void
-query_putrdataset(ns_client_t *client, dns_rdataset_t **rdatasetp) {
- dns_rdataset_t *rdataset = *rdatasetp;
-
- CTRACE(ISC_LOG_DEBUG(3), "query_putrdataset");
- if (rdataset != NULL) {
- if (dns_rdataset_isassociated(rdataset))
- dns_rdataset_disassociate(rdataset);
- dns_message_puttemprdataset(client->message, rdatasetp);
- }
- CTRACE(ISC_LOG_DEBUG(3), "query_putrdataset: done");
-}
-
static inline void
query_reset(ns_client_t *client, bool everything) {
isc_buffer_t *dbuf, *dbuf_next;
dns_zone_detach(&client->query.authzone);
if (client->query.dns64_aaaa != NULL)
- query_putrdataset(client, &client->query.dns64_aaaa);
+ ns_client_putrdataset(client, &client->query.dns64_aaaa);
if (client->query.dns64_sigaaaa != NULL)
- query_putrdataset(client, &client->query.dns64_sigaaaa);
+ ns_client_putrdataset(client, &client->query.dns64_sigaaaa);
if (client->query.dns64_aaaaok != NULL) {
isc_mem_put(client->mctx, client->query.dns64_aaaaok,
client->query.dns64_aaaaoklen *
client->query.dns64_aaaaoklen = 0;
}
- query_putrdataset(client, &client->query.redirect.rdataset);
- query_putrdataset(client, &client->query.redirect.sigrdataset);
+ ns_client_putrdataset(client, &client->query.redirect.rdataset);
+ ns_client_putrdataset(client, &client->query.redirect.sigrdataset);
if (client->query.redirect.db != NULL) {
if (client->query.redirect.node != NULL)
dns_db_detachnode(client->query.redirect.db,
query_reset(client, true);
}
-/*%
- * Allocate a name buffer.
- */
-static inline isc_result_t
-query_newnamebuf(ns_client_t *client) {
- isc_buffer_t *dbuf;
- isc_result_t result;
-
- CTRACE(ISC_LOG_DEBUG(3), "query_newnamebuf");
-
- dbuf = NULL;
- result = isc_buffer_allocate(client->mctx, &dbuf, 1024);
- if (result != ISC_R_SUCCESS) {
- CTRACE(ISC_LOG_DEBUG(3),
- "query_newnamebuf: isc_buffer_allocate failed: done");
- return (result);
- }
- ISC_LIST_APPEND(client->query.namebufs, dbuf, link);
-
- CTRACE(ISC_LOG_DEBUG(3), "query_newnamebuf: done");
- return (ISC_R_SUCCESS);
-}
-
-/*%
- * Get a name buffer from the pool, or allocate a new one if needed.
- */
-static inline isc_buffer_t *
-query_getnamebuf(ns_client_t *client) {
- isc_buffer_t *dbuf;
- isc_result_t result;
- isc_region_t r;
-
- CTRACE(ISC_LOG_DEBUG(3), "query_getnamebuf");
- /*%
- * Return a name buffer with space for a maximal name, allocating
- * a new one if necessary.
- */
-
- if (ISC_LIST_EMPTY(client->query.namebufs)) {
- result = query_newnamebuf(client);
- if (result != ISC_R_SUCCESS) {
- CTRACE(ISC_LOG_DEBUG(3),
- "query_getnamebuf: query_newnamebuf failed: done");
- return (NULL);
- }
- }
-
- dbuf = ISC_LIST_TAIL(client->query.namebufs);
- INSIST(dbuf != NULL);
- isc_buffer_availableregion(dbuf, &r);
- if (r.length < DNS_NAME_MAXWIRE) {
- result = query_newnamebuf(client);
- if (result != ISC_R_SUCCESS) {
- CTRACE(ISC_LOG_DEBUG(3),
- "query_getnamebuf: query_newnamebuf failed: done");
- return (NULL);
-
- }
- dbuf = ISC_LIST_TAIL(client->query.namebufs);
- isc_buffer_availableregion(dbuf, &r);
- INSIST(r.length >= 255);
- }
- CTRACE(ISC_LOG_DEBUG(3), "query_getnamebuf: done");
- return (dbuf);
-}
-
-static inline void
-query_keepname(ns_client_t *client, dns_name_t *name, isc_buffer_t *dbuf) {
- isc_region_t r;
-
- CTRACE(ISC_LOG_DEBUG(3), "query_keepname");
- /*%
- * 'name' is using space in 'dbuf', but 'dbuf' has not yet been
- * adjusted to take account of that. We do the adjustment.
- */
-
- REQUIRE((client->query.attributes & NS_QUERYATTR_NAMEBUFUSED) != 0);
-
- dns_name_toregion(name, &r);
- isc_buffer_add(dbuf, r.length);
- dns_name_setbuffer(name, NULL);
- client->query.attributes &= ~NS_QUERYATTR_NAMEBUFUSED;
-}
-
-static inline void
-query_releasename(ns_client_t *client, dns_name_t **namep) {
- dns_name_t *name = *namep;
-
- /*%
- * 'name' is no longer needed. Return it to our pool of temporary
- * names. If it is using a name buffer, relinquish its exclusive
- * rights on the buffer.
- */
-
- CTRACE(ISC_LOG_DEBUG(3), "query_releasename");
- if (dns_name_hasbuffer(name)) {
- INSIST((client->query.attributes & NS_QUERYATTR_NAMEBUFUSED)
- != 0);
- client->query.attributes &= ~NS_QUERYATTR_NAMEBUFUSED;
- }
- dns_message_puttempname(client->message, namep);
- CTRACE(ISC_LOG_DEBUG(3), "query_releasename: done");
-}
-
-static inline dns_name_t *
-query_newname(ns_client_t *client, isc_buffer_t *dbuf, isc_buffer_t *nbuf) {
- dns_name_t *name;
- isc_region_t r;
- isc_result_t result;
-
- REQUIRE((client->query.attributes & NS_QUERYATTR_NAMEBUFUSED) == 0);
-
- CTRACE(ISC_LOG_DEBUG(3), "query_newname");
- name = NULL;
- result = dns_message_gettempname(client->message, &name);
- if (result != ISC_R_SUCCESS) {
- CTRACE(ISC_LOG_DEBUG(3),
- "query_newname: dns_message_gettempname failed: done");
- return (NULL);
- }
- isc_buffer_availableregion(dbuf, &r);
- isc_buffer_init(nbuf, r.base, r.length);
- dns_name_init(name, NULL);
- dns_name_setbuffer(name, nbuf);
- client->query.attributes |= NS_QUERYATTR_NAMEBUFUSED;
-
- CTRACE(ISC_LOG_DEBUG(3), "query_newname: done");
- return (name);
-}
-
-static inline dns_rdataset_t *
-query_newrdataset(ns_client_t *client) {
- dns_rdataset_t *rdataset;
- isc_result_t result;
-
- CTRACE(ISC_LOG_DEBUG(3), "query_newrdataset");
- rdataset = NULL;
- result = dns_message_gettemprdataset(client->message, &rdataset);
- if (result != ISC_R_SUCCESS) {
- CTRACE(ISC_LOG_DEBUG(3), "query_newrdataset: "
- "dns_message_gettemprdataset failed: done");
- return (NULL);
- }
-
- CTRACE(ISC_LOG_DEBUG(3), "query_newrdataset: done");
- return (rdataset);
-}
-
-static inline isc_result_t
-query_newdbversion(ns_client_t *client, unsigned int n) {
- unsigned int i;
- ns_dbversion_t *dbversion;
-
- for (i = 0; i < n; i++) {
- dbversion = isc_mem_get(client->mctx, sizeof(*dbversion));
- if (dbversion != NULL) {
- dbversion->db = NULL;
- dbversion->version = NULL;
- ISC_LIST_INITANDAPPEND(client->query.freeversions,
- dbversion, link);
- } else {
- /*
- * We only return ISC_R_NOMEMORY if we couldn't
- * allocate anything.
- */
- if (i == 0)
- return (ISC_R_NOMEMORY);
- else
- return (ISC_R_SUCCESS);
- }
- }
-
- return (ISC_R_SUCCESS);
-}
-
-static inline ns_dbversion_t *
-query_getdbversion(ns_client_t *client) {
- isc_result_t result;
- ns_dbversion_t *dbversion;
-
- if (ISC_LIST_EMPTY(client->query.freeversions)) {
- result = query_newdbversion(client, 1);
- if (result != ISC_R_SUCCESS)
- return (NULL);
- }
- dbversion = ISC_LIST_HEAD(client->query.freeversions);
- INSIST(dbversion != NULL);
- ISC_LIST_UNLINK(client->query.freeversions, dbversion, link);
-
- return (dbversion);
-}
-
isc_result_t
ns_query_init(ns_client_t *client) {
isc_result_t result;
client->query.redirect.fname =
dns_fixedname_initname(&client->query.redirect.fixed);
query_reset(client, false);
- result = query_newdbversion(client, 3);
+ result = ns_client_newdbversion(client, 3);
if (result != ISC_R_SUCCESS) {
isc_mutex_destroy(&client->query.fetchlock);
return (result);
}
- result = query_newnamebuf(client);
+ result = ns_client_newnamebuf(client);
if (result != ISC_R_SUCCESS) {
query_freefreeversions(client, true);
isc_mutex_destroy(&client->query.fetchlock);
return (result);
}
-static ns_dbversion_t *
-query_findversion(ns_client_t *client, dns_db_t *db) {
- ns_dbversion_t *dbversion;
-
- /*%
- * We may already have done a query related to this
- * database. If so, we must be sure to make subsequent
- * queries from the same version.
- */
- for (dbversion = ISC_LIST_HEAD(client->query.activeversions);
- dbversion != NULL;
- dbversion = ISC_LIST_NEXT(dbversion, link)) {
- if (dbversion->db == db)
- break;
- }
-
- if (dbversion == NULL) {
- /*
- * This is a new zone for this query. Add it to
- * the active list.
- */
- dbversion = query_getdbversion(client);
- if (dbversion == NULL)
- return (NULL);
- dns_db_attach(db, &dbversion->db);
- dns_db_currentversion(db, &dbversion->version);
- dbversion->acl_checked = false;
- dbversion->queryok = false;
- ISC_LIST_APPEND(client->query.activeversions,
- dbversion, link);
- }
-
- return (dbversion);
-}
-
/*%
* Check if 'client' is allowed to query the cache of its associated view.
* Unless 'options' has DNS_GETDB_NOLOG set, log the result of cache ACL
/*
* Get the current version of this database.
*/
- dbversion = query_findversion(client, db);
+ dbversion = ns_client_findversion(client, db);
if (dbversion == NULL) {
CTRACE(ISC_LOG_ERROR, "unable to get db version");
return (DNS_R_SERVFAIL);
*/
*versionp = NULL;
- dbversion = query_findversion(client, tdbp);
+ dbversion = ns_client_findversion(client, tdbp);
if (dbversion == NULL) {
tresult = ISC_R_NOMEMORY;
} else {
/*
* Get some resources.
*/
- dbuf = query_getnamebuf(client);
+ dbuf = ns_client_getnamebuf(client);
if (dbuf == NULL) {
goto cleanup;
}
- fname = query_newname(client, dbuf, &b);
- rdataset = query_newrdataset(client);
+ fname = ns_client_newname(client, dbuf, &b);
+ rdataset = ns_client_newrdataset(client);
if (fname == NULL || rdataset == NULL) {
goto cleanup;
}
if (WANTDNSSEC(client)) {
- sigrdataset = query_newrdataset(client);
+ sigrdataset = ns_client_newrdataset(client);
if (sigrdataset == NULL) {
goto cleanup;
}
goto try_cache;
}
- dbversion = query_findversion(client, client->query.authdb);
+ dbversion = ns_client_findversion(client, client->query.authdb);
if (dbversion == NULL) {
goto try_cache;
}
* Attempt to validate glue.
*/
if (sigrdataset == NULL) {
- sigrdataset = query_newrdataset(client);
+ sigrdataset = ns_client_newrdataset(client);
if (sigrdataset == NULL) {
goto cleanup;
}
dns_cache_updatestats(client->view->cache, result);
if (!WANTDNSSEC(client)) {
- query_putrdataset(client, &sigrdataset);
+ ns_client_putrdataset(client, &sigrdataset);
}
if (result == ISC_R_SUCCESS)
goto found;
goto cleanup;
}
- dbversion = query_findversion(client, client->query.gluedb);
+ dbversion = ns_client_findversion(client, client->query.gluedb);
if (dbversion == NULL) {
goto cleanup;
}
* We have found a potential additional data rdataset, or
* at least a node to iterate over.
*/
- query_keepname(client, fname, dbuf);
+ ns_client_keepname(client, fname, dbuf);
/*
* If we have an rdataset, add it to the additional data
{
if (mname != NULL) {
INSIST(mname != fname);
- query_releasename(client, &fname);
+ ns_client_releasename(client, &fname);
fname = mname;
} else {
need_addname = true;
dns_rdataset_disassociate(rdataset);
}
} else {
- rdataset = query_newrdataset(client);
+ rdataset = ns_client_newrdataset(client);
if (rdataset == NULL) {
goto addname;
}
dns_rdataset_disassociate(sigrdataset);
}
} else if (WANTDNSSEC(client)) {
- sigrdataset = query_newrdataset(client);
+ sigrdataset = ns_client_newrdataset(client);
if (sigrdataset == NULL) {
goto addname;
}
dns_rdatatype_a, &mname)) {
if (mname != fname) {
if (mname != NULL) {
- query_releasename(client,
- &fname);
+ ns_client_releasename(client,
+ &fname);
fname = mname;
} else {
need_addname = true;
ISC_LIST_APPEND(fname->list,
sigrdataset, link);
sigrdataset =
- query_newrdataset(client);
+ ns_client_newrdataset(client);
}
- rdataset = query_newrdataset(client);
+ rdataset = ns_client_newrdataset(client);
if (rdataset == NULL) {
goto addname;
}
{
if (mname != fname) {
if (mname != NULL) {
- query_releasename(client,
- &fname);
+ ns_client_releasename(client,
+ &fname);
fname = mname;
} else {
need_addname = true;
cleanup:
CTRACE(ISC_LOG_DEBUG(3), "query_additional_cb: cleanup");
- query_putrdataset(client, &rdataset);
+ ns_client_putrdataset(client, &rdataset);
if (sigrdataset != NULL) {
- query_putrdataset(client, &sigrdataset);
+ ns_client_putrdataset(client, &sigrdataset);
}
if (fname != NULL) {
- query_releasename(client, &fname);
+ ns_client_releasename(client, &fname);
}
if (node != NULL) {
dns_db_detachnode(db, &node);
isc_result_t result;
ns_dbversion_t *dbversion;
- dbversion = query_findversion(client, client->query.gluedb);
+ dbversion = ns_client_findversion(client, client->query.gluedb);
if (dbversion == NULL) {
goto regular;
}
CTRACE(ISC_LOG_DEBUG(3),
"query_addrrset: dns_message_findname succeeded: done");
if (dbuf != NULL) {
- query_releasename(client, namep);
+ ns_client_releasename(client, namep);
}
if ((rdataset->attributes & DNS_RDATASETATTR_REQUIRED) != 0) {
mrdataset->attributes |= DNS_RDATASETATTR_REQUIRED;
* The name doesn't exist.
*/
if (dbuf != NULL) {
- query_keepname(client, name, dbuf);
+ ns_client_keepname(client, name, dbuf);
}
dns_message_addname(client->message, name, section);
*namep = NULL;
} else {
RUNTIME_CHECK(result == DNS_R_NXRRSET);
if (dbuf != NULL) {
- query_releasename(client, namep);
+ ns_client_releasename(client, namep);
}
}
static void
fixrdataset(ns_client_t *client, dns_rdataset_t **rdataset) {
if (*rdataset == NULL)
- *rdataset = query_newrdataset(client);
+ *rdataset = ns_client_newrdataset(client);
else if (dns_rdataset_isassociated(*rdataset))
dns_rdataset_disassociate(*rdataset);
}
isc_buffer_t *nbuf)
{
if (*fname == NULL) {
- *dbuf = query_getnamebuf(client);
+ *dbuf = ns_client_getnamebuf(client);
if (*dbuf == NULL)
return;
- *fname = query_newname(client, *dbuf, nbuf);
+ *fname = ns_client_newname(client, *dbuf, nbuf);
}
}
REQUIRE((void*)(*eventp) == (void *)(*deventp));
- if (devent->fetch != NULL)
+ if (devent->fetch != NULL) {
dns_resolver_destroyfetch(&devent->fetch);
- if (devent->node != NULL)
+ }
+ if (devent->node != NULL) {
dns_db_detachnode(devent->db, &devent->node);
- if (devent->db != NULL)
+ }
+ if (devent->db != NULL) {
dns_db_detach(&devent->db);
- if (devent->rdataset != NULL)
- query_putrdataset(client, &devent->rdataset);
- if (devent->sigrdataset != NULL)
- query_putrdataset(client, &devent->sigrdataset);
+ }
+ if (devent->rdataset != NULL) {
+ ns_client_putrdataset(client, &devent->rdataset);
+ }
+ if (devent->sigrdataset != NULL) {
+ ns_client_putrdataset(client, &devent->sigrdataset);
+ }
/*
* If the two pointers are the same then leave the setting of
* (*deventp) to NULL to isc_event_free.
ns_statscounter_recursclients);
}
- tmprdataset = query_newrdataset(client);
+ tmprdataset = ns_client_newrdataset(client);
if (tmprdataset == NULL)
return;
if (!TCP(client))
tmprdataset, NULL,
&client->query.prefetch);
if (result != ISC_R_SUCCESS) {
- query_putrdataset(client, &tmprdataset);
+ ns_client_putrdataset(client, &tmprdataset);
ns_client_detach(&dummy);
}
dns_rdataset_clearprefetch(rdataset);
CTRACE(ISC_LOG_DEBUG(3), "rpz_ready");
if (*rdatasetp == NULL) {
- *rdatasetp = query_newrdataset(client);
+ *rdatasetp = ns_client_newrdataset(client);
if (*rdatasetp == NULL) {
CTRACE(ISC_LOG_ERROR,
- "rpz_ready: query_newrdataset failed");
+ "rpz_ready: ns_client_newrdataset failed");
return (DNS_R_SERVFAIL);
}
} else if (dns_rdataset_isassociated(*rdatasetp)) {
CTRACE(ISC_LOG_DEBUG(3), "rpz_st_clear");
if (st->m.rdataset != NULL) {
- query_putrdataset(client, &st->m.rdataset);
+ ns_client_putrdataset(client, &st->m.rdataset);
}
rpz_match_clear(st);
rpz_clean(NULL, &st->r.db, NULL, NULL);
if (st->r.ns_rdataset != NULL) {
- query_putrdataset(client, &st->r.ns_rdataset);
+ ns_client_putrdataset(client, &st->r.ns_rdataset);
}
if (st->r.r_rdataset != NULL) {
- query_putrdataset(client, &st->r.r_rdataset);
+ ns_client_putrdataset(client, &st->r.r_rdataset);
}
rpz_clean(&st->q.zone, &st->q.db, &st->q.node, NULL);
if (st->q.rdataset != NULL) {
- query_putrdataset(client, &st->q.rdataset);
+ ns_client_putrdataset(client, &st->q.rdataset);
}
if (st->q.sigrdataset != NULL) {
- query_putrdataset(client, &st->q.sigrdataset);
+ ns_client_putrdataset(client, &st->q.sigrdataset);
}
st->state = 0;
st->m.type = DNS_RPZ_TYPE_BAD;
ns_statscounter_recursclients);
}
- tmprdataset = query_newrdataset(client);
+ tmprdataset = ns_client_newrdataset(client);
if (tmprdataset == NULL)
return;
if (!TCP(client))
client, tmprdataset, NULL,
&client->query.prefetch);
if (result != ISC_R_SUCCESS) {
- query_putrdataset(client, &tmprdataset);
+ ns_client_putrdataset(client, &tmprdataset);
ns_client_detach(&dummy);
}
}
!dns_rdataset_isassociated(*rdatasetp));
st->state &= ~DNS_RPZ_RECURSING;
RESTORE(*dbp, st->r.db);
- if (*rdatasetp != NULL)
- query_putrdataset(client, rdatasetp);
+ if (*rdatasetp != NULL) {
+ ns_client_putrdataset(client, rdatasetp);
+ }
RESTORE(*rdatasetp, st->r.r_rdataset);
result = st->r.r_result;
if (result == DNS_R_DELEGATION) {
result = DNS_R_NXRRSET;
} else {
dns_name_copy(name, st->r_name, NULL);
- result = query_recurse(client, type, st->r_name,
- NULL, NULL, resuming);
+ result = ns_query_recurse(client, type, st->r_name,
+ NULL, NULL, resuming);
if (result == ISC_R_SUCCESS) {
st->state |= DNS_RPZ_RECURSING;
result = DNS_R_DELEGATION;
}
if (ip_db != NULL)
dns_db_detach(&ip_db);
- query_putrdataset(client, &p_rdataset);
+ ns_client_putrdataset(client, &p_rdataset);
return (result);
}
st->m.type = DNS_RPZ_TYPE_BAD;
result = DNS_R_SERVFAIL;
}
- query_putrdataset(client, &rdataset);
+ ns_client_putrdataset(client, &rdataset);
if ((st->state & DNS_RPZ_RECURSING) == 0)
rpz_clean(NULL, &st->r.db, NULL, &st->r.ns_rdataset);
if (result != ISC_R_SUCCESS)
return (ISC_R_NOTFOUND);
- dbversion = query_findversion(client, db);
+ dbversion = ns_client_findversion(client, db);
if (dbversion == NULL) {
dns_db_detach(&db);
return (ISC_R_NOTFOUND);
* Don't loop forever if the lookup failed last time.
*/
if (!REDIRECT(client)) {
- result = query_recurse(client, qtype, redirectname,
- NULL, NULL, true);
+ result = ns_query_recurse(client, qtype, redirectname,
+ NULL, NULL, true);
if (result == ISC_R_SUCCESS) {
client->query.attributes |=
NS_QUERYATTR_RECURSING;
static void
qctx_freedata(query_ctx_t *qctx) {
if (qctx->rdataset != NULL) {
- query_putrdataset(qctx->client, &qctx->rdataset);
+ ns_client_putrdataset(qctx->client, &qctx->rdataset);
}
if (qctx->sigrdataset != NULL) {
- query_putrdataset(qctx->client, &qctx->sigrdataset);
+ ns_client_putrdataset(qctx->client, &qctx->sigrdataset);
}
if (qctx->fname != NULL) {
- query_releasename(qctx->client, &qctx->fname);
+ ns_client_releasename(qctx->client, &qctx->fname);
}
if (qctx->db != NULL) {
}
if (qctx->zdb != NULL) {
- query_putrdataset(qctx->client, &qctx->zsigrdataset);
- query_putrdataset(qctx->client, &qctx->zrdataset);
- query_releasename(qctx->client, &qctx->zfname);
+ ns_client_putrdataset(qctx->client, &qctx->zsigrdataset);
+ ns_client_putrdataset(qctx->client, &qctx->zrdataset);
+ ns_client_releasename(qctx->client, &qctx->zfname);
dns_db_detachnode(qctx->zdb, &qctx->znode);
dns_db_detach(&qctx->zdb);
}
qctx->client->message->flags &= ~DNS_MESSAGEFLAG_AA;
qctx->client->message->flags &= ~DNS_MESSAGEFLAG_AD;
qctx->client->message->rcode = dns_rcode_badcookie;
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
if (qctx->client->view->checknames &&
"check-names failure %s/%s/%s", namebuf,
typebuf, classbuf);
QUERY_ERROR(qctx, DNS_R_REFUSED);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
/*
* zone to query context, set result to ISC_R_SUCCESS.
*/
qctx->options &= ~DNS_GETDB_NOEXACT;
- query_putrdataset(qctx->client, &qctx->rdataset);
+ ns_client_putrdataset(qctx->client, &qctx->rdataset);
if (qctx->db != NULL) {
dns_db_detach(&qctx->db);
}
"ns__query_start: query_getdb failed");
QUERY_ERROR(qctx, result);
}
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
/*
/*%
* Perform a local database lookup, in either an authoritative or
- * cache database. If unable to answer, call query_done(); otherwise
+ * cache database. If unable to answer, call ns_query_done(); otherwise
* hand off processing to query_gotanswer().
*/
static isc_result_t
/*
* We'll need some resources...
*/
- qctx->dbuf = query_getnamebuf(qctx->client);
+ qctx->dbuf = ns_client_getnamebuf(qctx->client);
if (ISC_UNLIKELY(qctx->dbuf == NULL)) {
CCTRACE(ISC_LOG_ERROR,
- "query_lookup: query_getnamebuf failed (2)");
+ "query_lookup: ns_client_getnamebuf failed (2)");
QUERY_ERROR(qctx, ISC_R_NOMEMORY);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
- qctx->fname = query_newname(qctx->client, qctx->dbuf, &b);
- qctx->rdataset = query_newrdataset(qctx->client);
+ qctx->fname = ns_client_newname(qctx->client, qctx->dbuf, &b);
+ qctx->rdataset = ns_client_newrdataset(qctx->client);
if (ISC_UNLIKELY(qctx->fname == NULL || qctx->rdataset == NULL)) {
CCTRACE(ISC_LOG_ERROR,
- "query_lookup: query_newname failed (2)");
+ "query_lookup: ns_client_newname failed (2)");
QUERY_ERROR(qctx, ISC_R_NOMEMORY);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
if ((WANTDNSSEC(qctx->client) || qctx->findcoveringnsec) &&
(!qctx->is_zone || dns_db_issecure(qctx->db)))
{
- qctx->sigrdataset = query_newrdataset(qctx->client);
+ qctx->sigrdataset = ns_client_newrdataset(qctx->client);
if (qctx->sigrdataset == NULL) {
CCTRACE(ISC_LOG_ERROR,
- "query_lookup: query_newrdataset failed (2)");
+ "query_lookup: ns_client_newrdataset failed (2)");
QUERY_ERROR(qctx, ISC_R_NOMEMORY);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
}
if (!success) {
QUERY_ERROR(qctx, DNS_R_SERVFAIL);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
}
* this phase of the query, and resume with a new query context when
* recursion completes.
*/
-static isc_result_t
-query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname,
- dns_name_t *qdomain, dns_rdataset_t *nameservers,
- bool resuming)
+isc_result_t
+ns_query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname,
+ dns_name_t *qdomain, dns_rdataset_t *nameservers,
+ bool resuming)
{
isc_result_t result;
dns_rdataset_t *rdataset, *sigrdataset;
isc_sockaddr_t *peeraddr = NULL;
- CTRACE(ISC_LOG_DEBUG(3), "query_recurse");
+ CTRACE(ISC_LOG_DEBUG(3), "ns_query_recurse");
/*
* Check recursion parameters from the previous query to see if they
REQUIRE(nameservers == NULL || nameservers->type == dns_rdatatype_ns);
REQUIRE(client->query.fetch == NULL);
- rdataset = query_newrdataset(client);
+ rdataset = ns_client_newrdataset(client);
if (rdataset == NULL) {
return (ISC_R_NOMEMORY);
}
if (WANTDNSSEC(client)) {
- sigrdataset = query_newrdataset(client);
+ sigrdataset = ns_client_newrdataset(client);
if (sigrdataset == NULL) {
- query_putrdataset(client, &rdataset);
+ ns_client_putrdataset(client, &rdataset);
return (ISC_R_NOMEMORY);
}
} else {
client, rdataset, sigrdataset,
&client->query.fetch);
if (result != ISC_R_SUCCESS) {
- query_putrdataset(client, &rdataset);
+ ns_client_putrdataset(client, &rdataset);
if (sigrdataset != NULL) {
- query_putrdataset(client, &sigrdataset);
+ ns_client_putrdataset(client, &sigrdataset);
}
}
SAVE(qctx->rpz_st->r.db, qctx->event->db);
qctx->rpz_st->r.r_type = qctx->event->qtype;
SAVE(qctx->rpz_st->r.r_rdataset, qctx->event->rdataset);
- query_putrdataset(qctx->client, &qctx->event->sigrdataset);
+ ns_client_putrdataset(qctx->client, &qctx->event->sigrdataset);
} else if (REDIRECT(qctx->client)) {
/*
* Restore saved state.
/*
* Free resources used while recursing.
*/
- query_putrdataset(qctx->client, &qctx->event->rdataset);
- query_putrdataset(qctx->client, &qctx->event->sigrdataset);
+ ns_client_putrdataset(qctx->client, &qctx->event->rdataset);
+ ns_client_putrdataset(qctx->client, &qctx->event->sigrdataset);
if (qctx->event->node != NULL)
dns_db_detachnode(qctx->event->db, &qctx->event->node);
if (qctx->event->db != NULL)
qctx->client->view->rpzs->rpz_ver,
qctx->rpz_st->rpz_ver);
QUERY_ERROR(qctx, DNS_R_SERVFAIL);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
}
/*
* We'll need some resources...
*/
- qctx->dbuf = query_getnamebuf(qctx->client);
+ qctx->dbuf = ns_client_getnamebuf(qctx->client);
if (qctx->dbuf == NULL) {
CCTRACE(ISC_LOG_ERROR,
- "query_resume: query_getnamebuf failed (1)");
+ "query_resume: ns_client_getnamebuf failed (1)");
QUERY_ERROR(qctx, ISC_R_NOMEMORY);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
- qctx->fname = query_newname(qctx->client, qctx->dbuf, &b);
+ qctx->fname = ns_client_newname(qctx->client, qctx->dbuf, &b);
if (qctx->fname == NULL) {
CCTRACE(ISC_LOG_ERROR,
- "query_resume: query_newname failed (1)");
+ "query_resume: ns_client_newname failed (1)");
QUERY_ERROR(qctx, ISC_R_NOMEMORY);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
if (qctx->rpz_st != NULL &&
CCTRACE(ISC_LOG_ERROR,
"query_resume: dns_name_copy failed");
QUERY_ERROR(qctx, result);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
if (qctx->rpz_st != NULL &&
qctx->client->attributes |= NS_CLIENTATTR_NOSETFC;
QUERY_ERROR(qctx, DNS_R_SERVFAIL);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
return (ISC_R_COMPLETE);
RUNTIME_CHECK(rresult == ISC_R_SUCCESS);
rpz_clean(&qctx->zone, &qctx->db, &qctx->node, NULL);
if (qctx->rpz_st->m.rdataset != NULL) {
- query_putrdataset(qctx->client, &qctx->rdataset);
+ ns_client_putrdataset(qctx->client, &qctx->rdataset);
RESTORE(qctx->rdataset, qctx->rpz_st->m.rdataset);
} else {
qctx_clean(qctx);
qctx->client->attributes &= ~(NS_CLIENTATTR_WANTDNSSEC |
NS_CLIENTATTR_WANTAD);
qctx->client->message->flags &= ~DNS_MESSAGEFLAG_AD;
- query_putrdataset(qctx->client, &qctx->sigrdataset);
+ ns_client_putrdataset(qctx->client, &qctx->sigrdataset);
qctx->rpz_st->q.is_zone = qctx->is_zone;
qctx->is_zone = true;
rpz_log_rewrite(qctx->client, false,
RUNTIME_CHECK(result == ISC_R_SUCCESS);
}
- query_keepname(client, qctx->fname, qctx->dbuf);
+ ns_client_keepname(client, qctx->fname, qctx->dbuf);
result = query_addcname(qctx, dns_trust_authanswer,
qctx->rpz_st->m.ttl);
if (result != ISC_R_SUCCESS) {
PROCESS_HOOK(NS_QUERY_GOT_ANSWER_BEGIN, qctx);
if (query_checkrrl(qctx, result) != ISC_R_SUCCESS) {
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
if (!RECURSING(qctx->client) &&
{
result = query_checkrpz(qctx, result);
if (result == ISC_R_COMPLETE)
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
/*
*/
qctx->client->attributes |= NS_CLIENTATTR_NOSETFC;
QUERY_ERROR(qctx, DNS_R_SERVFAIL);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
switch (result) {
case DNS_R_FORMERR:
QUERY_ERROR(qctx, DNS_R_SERVFAIL);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
default:
/*
return (query_lookup(qctx));
}
QUERY_ERROR(qctx, result);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
}
return;
}
- dbuf = query_getnamebuf(client);
+ dbuf = ns_client_getnamebuf(client);
if (dbuf == NULL) {
goto cleanup;
}
- fname = query_newname(client, dbuf, &b);
- neg = query_newrdataset(client);
- negsig = query_newrdataset(client);
+ fname = ns_client_newname(client, dbuf, &b);
+ neg = ns_client_newrdataset(client);
+ negsig = ns_client_newrdataset(client);
if (fname == NULL || neg == NULL || negsig == NULL) {
goto cleanup;
}
}
if (fname == NULL) {
- dbuf = query_getnamebuf(client);
+ dbuf = ns_client_getnamebuf(client);
if (dbuf == NULL)
goto cleanup;
- fname = query_newname(client, dbuf, &b);
+ fname = ns_client_newname(client, dbuf, &b);
}
if (neg == NULL) {
- neg = query_newrdataset(client);
+ neg = ns_client_newrdataset(client);
} else if (dns_rdataset_isassociated(neg)) {
dns_rdataset_disassociate(neg);
}
if (negsig == NULL) {
- negsig = query_newrdataset(client);
+ negsig = ns_client_newrdataset(client);
} else if (dns_rdataset_isassociated(negsig)) {
dns_rdataset_disassociate(negsig);
}
cleanup:
if (neg != NULL) {
- query_putrdataset(client, &neg);
+ ns_client_putrdataset(client, &neg);
}
if (negsig != NULL) {
- query_putrdataset(client, &negsig);
+ ns_client_putrdataset(client, &negsig);
}
if (fname != NULL) {
- query_releasename(client, &fname);
+ ns_client_releasename(client, &fname);
}
}
CCTRACE(ISC_LOG_ERROR,
"query_respond_any: allrdatasets failed");
QUERY_ERROR(qctx, result);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
/*
* Calling query_addrrset() with a non-NULL dbuf is going
* to either keep or release the name. We don't want it to
* release fname, since we may have to call query_addrrset()
- * more than once. That means we have to call query_keepname()
+ * more than once. That means we have to call ns_client_keepname()
* now, and pass a NULL dbuf to query_addrrset().
*
* If we do a query_addrrset() below, we must set qctx->fname to
* NULL before leaving this block, otherwise we might try to
* cleanup qctx->fname even though we're using it!
*/
- query_keepname(qctx->client, qctx->fname, qctx->dbuf);
+ ns_client_keepname(qctx->client, qctx->fname, qctx->dbuf);
qctx->tname = qctx->fname;
result = dns_rdatasetiter_first(rdsiter);
* pathological cases involving DNAMEs.
*/
if (qctx->rdataset != NULL) {
- query_putrdataset(qctx->client,
- &qctx->rdataset);
+ ns_client_putrdataset(qctx->client,
+ &qctx->rdataset);
}
- qctx->rdataset = query_newrdataset(qctx->client);
+ qctx->rdataset = ns_client_newrdataset(qctx->client);
if (qctx->rdataset == NULL)
break;
} else {
qctx->authoritative = false;
qctx->client->attributes &= ~NS_CLIENTATTR_RA;
query_addauth(qctx);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
if (qctx->qtype == dns_rdatatype_rrsig &&
namebuf);
}
- qctx->fname = query_newname(qctx->client,
- qctx->dbuf, &b);
+ qctx->fname = ns_client_newname(qctx->client,
+ qctx->dbuf, &b);
return (query_sign_nodata(qctx));
} else {
CCTRACE(ISC_LOG_ERROR,
query_addauth(qctx);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
/*
qctx_clean(qctx);
INSIST(!REDIRECT(qctx->client));
- result = query_recurse(qctx->client, qctx->qtype,
- qctx->client->query.qname,
- NULL, NULL, qctx->resuming);
+ result = ns_query_recurse(qctx->client, qctx->qtype,
+ qctx->client->query.qname,
+ NULL, NULL, qctx->resuming);
if (result == ISC_R_SUCCESS) {
qctx->client->query.attributes |=
NS_QUERYATTR_RECURSING;
QUERY_ERROR(qctx, result);
}
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
/*
qctx->client->query.dns64_ttl = qctx->rdataset->ttl;
SAVE(qctx->client->query.dns64_aaaa, qctx->rdataset);
SAVE(qctx->client->query.dns64_sigaaaa, qctx->sigrdataset);
- query_releasename(qctx->client, &qctx->fname);
+ ns_client_releasename(qctx->client, &qctx->fname);
dns_db_detachnode(qctx->db, &qctx->node);
qctx->type = qctx->qtype = dns_rdatatype_a;
qctx->dns64_exclude = qctx->dns64 = true;
#ifndef dns64_bis_return_excluded_addresses
if (qctx->dns64_exclude) {
if (!qctx->is_zone)
- return (query_done(qctx));
+ return (ns_query_done(qctx));
/*
* Add a fake SOA record.
*/
(void)query_addsoa(qctx, 600,
DNS_SECTION_AUTHORITY);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
#endif
if (qctx->is_zone) {
}
} else if (result != ISC_R_SUCCESS) {
qctx->result = result;
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
} else if (qctx->client->query.dns64_aaaaok != NULL) {
query_filter64(qctx);
- query_putrdataset(qctx->client, &qctx->rdataset);
+ ns_client_putrdataset(qctx->client, &qctx->rdataset);
} else {
if (!qctx->is_zone && RECURSIONOK(qctx->client))
query_prefetch(qctx->client, qctx->fname,
query_addauth(qctx);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
static isc_result_t
*/
CTRACE(ISC_LOG_DEBUG(3),
"query_dns64: dns_message_findname succeeded: done");
- if (qctx->dbuf != NULL)
- query_releasename(client, &qctx->fname);
+ if (qctx->dbuf != NULL) {
+ ns_client_releasename(client, &qctx->fname);
+ }
return (ISC_R_SUCCESS);
} else if (result == DNS_R_NXDOMAIN) {
/*
* The name doesn't exist.
*/
- if (qctx->dbuf != NULL)
- query_keepname(client, name, qctx->dbuf);
+ if (qctx->dbuf != NULL) {
+ ns_client_keepname(client, name, qctx->dbuf);
+ }
dns_message_addname(client->message, name, section);
qctx->fname = NULL;
mname = name;
} else {
RUNTIME_CHECK(result == DNS_R_NXRRSET);
- if (qctx->dbuf != NULL)
- query_releasename(client, &qctx->fname);
+ if (qctx->dbuf != NULL) {
+ ns_client_releasename(client, &qctx->fname);
+ }
}
if (qctx->rdataset->trust != dns_trust_secure) {
*/
CTRACE(ISC_LOG_DEBUG(3),
"query_filter64: dns_message_findname succeeded: done");
- if (qctx->dbuf != NULL)
- query_releasename(client, &qctx->fname);
+ if (qctx->dbuf != NULL) {
+ ns_client_releasename(client, &qctx->fname);
+ }
return;
} else if (result == DNS_R_NXDOMAIN) {
mname = name;
qctx->fname = NULL;
} else {
RUNTIME_CHECK(result == DNS_R_NXRRSET);
- if (qctx->dbuf != NULL)
- query_releasename(client, &qctx->fname);
+ if (qctx->dbuf != NULL) {
+ ns_client_releasename(client, &qctx->fname);
+ }
qctx->dbuf = NULL;
}
dns_rdataset_setownercase(myrdataset, name);
client->query.attributes |= NS_QUERYATTR_NOADDITIONAL;
if (mname == name) {
- if (qctx->dbuf != NULL)
- query_keepname(client, name, qctx->dbuf);
+ if (qctx->dbuf != NULL) {
+ ns_client_keepname(client, name, qctx->dbuf);
+ }
dns_message_addname(client->message, name,
section);
qctx->dbuf = NULL;
}
dns_message_puttemprdatalist(client->message, &myrdatalist);
}
- if (qctx->dbuf != NULL)
- query_releasename(client, &name);
+ if (qctx->dbuf != NULL) {
+ ns_client_releasename(client, &name);
+ }
CTRACE(ISC_LOG_DEBUG(3), "query_filter64: done");
}
*/
if (RECURSIONOK(qctx->client)) {
INSIST(!REDIRECT(qctx->client));
- result = query_recurse(qctx->client, qctx->qtype,
- qctx->client->query.qname,
- NULL, NULL, qctx->resuming);
+ result = ns_query_recurse(qctx->client, qctx->qtype,
+ qctx->client->query.qname,
+ NULL, NULL, qctx->resuming);
if (result == ISC_R_SUCCESS) {
qctx->client->query.attributes |=
NS_QUERYATTR_RECURSING;
} else {
QUERY_ERROR(qctx, result);
}
- return (query_done(qctx));
+ return (ns_query_done(qctx));
} else {
/* Unable to give root server referral. */
CCTRACE(ISC_LOG_ERROR,
"unable to give root server referral");
QUERY_ERROR(qctx, result);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
}
*/
query_addds(qctx);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
/*%
* Handle a delegation response from an authoritative lookup. This
* may trigger additional lookups, e.g. from the cache database to
* see if we have a better answer; if that is not allowed, return the
- * delegation to the client and call query_done().
+ * delegation to the client and call ns_query_done().
*/
static isc_result_t
query_zone_delegation(query_ctx_t *qctx) {
dns_zone_detach(&tzone);
} else {
qctx->options &= ~DNS_GETDB_NOEXACT;
- query_putrdataset(qctx->client,
- &qctx->rdataset);
- if (qctx->sigrdataset != NULL)
- query_putrdataset(qctx->client,
- &qctx->sigrdataset);
- if (qctx->fname != NULL)
- query_releasename(qctx->client,
- &qctx->fname);
+ ns_client_putrdataset(qctx->client,
+ &qctx->rdataset);
+ if (qctx->sigrdataset != NULL) {
+ ns_client_putrdataset(qctx->client,
+ &qctx->sigrdataset);
+ }
+ if (qctx->fname != NULL) {
+ ns_client_releasename(qctx->client,
+ &qctx->fname);
+ }
if (qctx->node != NULL)
dns_db_detachnode(qctx->db,
&qctx->node);
* query_notfound() which calls query_delegation(), and
* we'll restore these values there.
*/
- query_keepname(qctx->client, qctx->fname, qctx->dbuf);
+ ns_client_keepname(qctx->client, qctx->fname, qctx->dbuf);
SAVE(qctx->zdb, qctx->db);
SAVE(qctx->znode, qctx->node);
SAVE(qctx->zfname, qctx->fname);
* If the delegation was returned from authoritative data,
* call query_zone_delgation(). Otherwise, we can start
* recursion if allowed; or else return the delegation to the
- * client and call query_done().
+ * client and call ns_query_done().
*/
static isc_result_t
query_delegation(query_ctx_t *qctx) {
* the nameservers configured in the
* static-stub zone.
*/
- query_releasename(qctx->client, &qctx->fname);
+ ns_client_releasename(qctx->client, &qctx->fname);
/*
- * We've already done query_keepname() on
+ * We've already done ns_client_keepname() on
* qctx->zfname, so we must set dbuf to NULL to
* prevent query_addrrset() from trying to
- * call query_keepname() again.
+ * call ns_client_keepname() again.
*/
qctx->dbuf = NULL;
- query_putrdataset(qctx->client, &qctx->rdataset);
- if (qctx->sigrdataset != NULL)
- query_putrdataset(qctx->client,
- &qctx->sigrdataset);
+ ns_client_putrdataset(qctx->client, &qctx->rdataset);
+ if (qctx->sigrdataset != NULL) {
+ ns_client_putrdataset(qctx->client,
+ &qctx->sigrdataset);
+ }
qctx->version = NULL;
dns_db_detachnode(qctx->db, &qctx->node);
if (RECURSIONOK(qctx->client)) {
/*
* We have a delegation and recursion is allowed,
- * so we call query_recurse() to follow it.
+ * so we call ns_query_recurse() to follow it.
* This phase of the query processing is done;
* we'll resume via fetch_callback() and
* query_resume() when the recursion is complete.
* Parent is recursive for this rdata
* type (i.e., DS)
*/
- result = query_recurse(qctx->client,
- qctx->qtype, qname,
- NULL, NULL,
- qctx->resuming);
+ result = ns_query_recurse(qctx->client,
+ qctx->qtype, qname,
+ NULL, NULL,
+ qctx->resuming);
} else if (qctx->dns64) {
/*
* Look up an A record so we can
* synthesize DNS64
*/
- result = query_recurse(qctx->client,
- dns_rdatatype_a, qname,
- NULL, NULL,
- qctx->resuming);
+ result = ns_query_recurse(qctx->client,
+ dns_rdatatype_a, qname,
+ NULL, NULL,
+ qctx->resuming);
} else {
/*
* Any other recursion
*/
- result = query_recurse(qctx->client,
- qctx->qtype, qname,
- qctx->fname,
- qctx->rdataset,
- qctx->resuming);
+ result = ns_query_recurse(qctx->client,
+ qctx->qtype, qname,
+ qctx->fname,
+ qctx->rdataset,
+ qctx->resuming);
}
if (result == ISC_R_SUCCESS) {
qctx->client->query.attributes |=
QUERY_ERROR(qctx, result);
}
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
return (query_prepare_delegation_response(qctx));
/*
* We'll need some resources...
*/
- rdataset = query_newrdataset(client);
- sigrdataset = query_newrdataset(client);
+ rdataset = ns_client_newrdataset(client);
+ sigrdataset = ns_client_newrdataset(client);
if (rdataset == NULL || sigrdataset == NULL)
goto cleanup;
/*
* Add the NSEC3 which proves the DS does not exist.
*/
- dbuf = query_getnamebuf(client);
+ dbuf = ns_client_getnamebuf(client);
if (dbuf == NULL)
goto cleanup;
- fname = query_newname(client, dbuf, &b);
+ fname = ns_client_newname(client, dbuf, &b);
dns_fixedname_init(&fixed);
if (dns_rdataset_isassociated(rdataset))
dns_rdataset_disassociate(rdataset);
}
cleanup:
- if (rdataset != NULL)
- query_putrdataset(client, &rdataset);
- if (sigrdataset != NULL)
- query_putrdataset(client, &sigrdataset);
- if (fname != NULL)
- query_releasename(client, &fname);
+ if (rdataset != NULL) {
+ ns_client_putrdataset(client, &rdataset);
+ }
+ if (sigrdataset != NULL) {
+ ns_client_putrdataset(client, &sigrdataset);
+ }
+ if (fname != NULL) {
+ ns_client_releasename(client, &fname);
+ }
}
/*%
* Restore the answers from the previous AAAA lookup.
*/
if (qctx->rdataset != NULL)
- query_putrdataset(qctx->client, &qctx->rdataset);
+ ns_client_putrdataset(qctx->client, &qctx->rdataset);
if (qctx->sigrdataset != NULL)
- query_putrdataset(qctx->client, &qctx->sigrdataset);
+ ns_client_putrdataset(qctx->client, &qctx->sigrdataset);
RESTORE(qctx->rdataset, qctx->client->query.dns64_aaaa);
RESTORE(qctx->sigrdataset, qctx->client->query.dns64_sigaaaa);
if (qctx->fname == NULL) {
- qctx->dbuf = query_getnamebuf(qctx->client);
+ qctx->dbuf = ns_client_getnamebuf(qctx->client);
if (qctx->dbuf == NULL) {
CCTRACE(ISC_LOG_ERROR,
"query_nodata: "
- "query_getnamebuf failed (3)");
+ "ns_client_getnamebuf failed (3)");
QUERY_ERROR(qctx, ISC_R_NOMEMORY);
- return (query_done(qctx));;
+ return (ns_query_done(qctx));;
}
- qctx->fname = query_newname(qctx->client,
- qctx->dbuf, &b);
+ qctx->fname = ns_client_newname(qctx->client,
+ qctx->dbuf, &b);
if (qctx->fname == NULL) {
CCTRACE(ISC_LOG_ERROR,
"query_nodata: "
- "query_newname failed (3)");
+ "ns_client_newname failed (3)");
QUERY_ERROR(qctx, ISC_R_NOMEMORY);
- return (query_done(qctx));;
+ return (ns_query_done(qctx));;
}
}
dns_name_copy(qctx->client->query.qname, qctx->fname, NULL);
SAVE(qctx->client->query.dns64_aaaa, qctx->rdataset);
SAVE(qctx->client->query.dns64_sigaaaa, qctx->sigrdataset);
- query_releasename(qctx->client, &qctx->fname);
+ ns_client_releasename(qctx->client, &qctx->fname);
dns_db_detachnode(qctx->db, &qctx->node);
qctx->type = qctx->qtype = dns_rdatatype_a;
qctx->dns64 = true;
* of its extra features (and things would probably break!).
*/
if (dns_rdataset_isassociated(qctx->rdataset)) {
- query_keepname(qctx->client, qctx->fname, qctx->dbuf);
+ ns_client_keepname(qctx->client, qctx->fname,
+ qctx->dbuf);
dns_message_addname(qctx->client->message,
qctx->fname,
DNS_SECTION_AUTHORITY);
}
}
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
/*%
* Look for a NSEC3 record if we don't have a NSEC record.
*/
if (qctx->redirected)
- return (query_done(qctx));
+ return (ns_query_done(qctx));
if (!dns_rdataset_isassociated(qctx->rdataset) &&
WANTDNSSEC(qctx->client))
{
"failure getting "
"closest encloser");
QUERY_ERROR(qctx, ISC_R_NOMEMORY);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
/*
* 'nearest' doesn't exist so
NULL);
}
} else {
- query_releasename(qctx->client, &qctx->fname);
+ ns_client_releasename(qctx->client, &qctx->fname);
query_addwildcardproof(qctx, false, true);
}
}
* name now because we're going call query_addsoa()
* below, and it needs to use the name buffer.
*/
- query_keepname(qctx->client, qctx->fname, qctx->dbuf);
+ ns_client_keepname(qctx->client, qctx->fname, qctx->dbuf);
} else if (qctx->fname != NULL) {
/*
* We're not going to use fname, and need to release
* our hold on the name buffer so query_addsoa()
* may use it.
*/
- query_releasename(qctx->client, &qctx->fname);
+ ns_client_releasename(qctx->client, &qctx->fname);
}
/*
DNS_SECTION_AUTHORITY);
if (result != ISC_R_SUCCESS) {
QUERY_ERROR(qctx, result);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
}
query_addnxrrsetnsec(qctx);
}
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
static void
/*
* We'll need some resources...
*/
- dbuf = query_getnamebuf(client);
+ dbuf = ns_client_getnamebuf(client);
if (dbuf == NULL) {
return;
}
- fname = query_newname(client, dbuf, &b);
+ fname = ns_client_newname(client, dbuf, &b);
if (fname == NULL) {
return;
}
* name now because we're going call query_addsoa()
* below, and it needs to use the name buffer.
*/
- query_keepname(qctx->client, qctx->fname, qctx->dbuf);
+ ns_client_keepname(qctx->client, qctx->fname, qctx->dbuf);
} else if (qctx->fname != NULL) {
/*
* We're not going to use fname, and need to release
* our hold on the name buffer so query_addsoa()
* may use it.
*/
- query_releasename(qctx->client, &qctx->fname);
+ ns_client_releasename(qctx->client, &qctx->fname);
}
/*
result = query_addsoa(qctx, ttl, section);
if (result != ISC_R_SUCCESS) {
QUERY_ERROR(qctx, result);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
if (WANTDNSSEC(qctx->client)) {
else
qctx->client->message->rcode = dns_rcode_nxdomain;
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
/*
qctx->client->query.redirect.authoritative =
qctx->authoritative;
qctx->client->query.redirect.is_zone = qctx->is_zone;
- return (query_done(qctx));
+ return (ns_query_done(qctx));
case DNS_R_NXRRSET:
qctx->redirected = true;
qctx->is_zone = true;
* NODATA proof's name now or else discard it.
*/
if (WANTDNSSEC(qctx->client)) {
- query_keepname(qctx->client, qctx->fname, qctx->dbuf);
+ ns_client_keepname(qctx->client, qctx->fname, qctx->dbuf);
} else {
- query_releasename(qctx->client, &qctx->fname);
+ ns_client_releasename(qctx->client, &qctx->fname);
}
- dbuf = query_getnamebuf(qctx->client);
+ dbuf = ns_client_getnamebuf(qctx->client);
if (dbuf == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
- name = query_newname(qctx->client, dbuf, &b);
+ name = ns_client_newname(qctx->client, dbuf, &b);
if (name == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
cleanup:
if (name != NULL) {
- query_releasename(qctx->client, &name);
+ ns_client_releasename(qctx->client, &name);
}
return (result);
}
* NOQNAME proof's name now or else discard it.
*/
if (WANTDNSSEC(qctx->client)) {
- query_keepname(qctx->client, qctx->fname, qctx->dbuf);
+ ns_client_keepname(qctx->client, qctx->fname, qctx->dbuf);
} else {
- query_releasename(qctx->client, &qctx->fname);
+ ns_client_releasename(qctx->client, &qctx->fname);
}
- dbuf = query_getnamebuf(qctx->client);
+ dbuf = ns_client_getnamebuf(qctx->client);
if (dbuf == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
- name = query_newname(qctx->client, dbuf, &b);
+ name = ns_client_newname(qctx->client, dbuf, &b);
if (name == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
dns_name_copy(qctx->client->query.qname, name, NULL);
- clone = query_newrdataset(qctx->client);
+ clone = ns_client_newrdataset(qctx->client);
if (clone == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
* Add answer RRset. Omit the RRSIG if DNSSEC was not requested.
*/
if (WANTDNSSEC(qctx->client)) {
- sigclone = query_newrdataset(qctx->client);
+ sigclone = ns_client_newrdataset(qctx->client);
if (sigclone == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
cleanup:
if (name != NULL) {
- query_releasename(qctx->client, &name);
+ ns_client_releasename(qctx->client, &name);
}
if (clone != NULL) {
- query_putrdataset(qctx->client, &clone);
+ ns_client_putrdataset(qctx->client, &clone);
}
if (sigclone != NULL) {
- query_putrdataset(qctx->client, &sigclone);
+ ns_client_putrdataset(qctx->client, &sigclone);
}
return (result);
}
* NOQNAME proof's name now or else discard it.
*/
if (WANTDNSSEC(qctx->client)) {
- query_keepname(qctx->client, qctx->fname, qctx->dbuf);
+ ns_client_keepname(qctx->client, qctx->fname, qctx->dbuf);
} else {
- query_releasename(qctx->client, &qctx->fname);
+ ns_client_releasename(qctx->client, &qctx->fname);
}
- dbuf = query_getnamebuf(qctx->client);
+ dbuf = ns_client_getnamebuf(qctx->client);
if (dbuf == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
- name = query_newname(qctx->client, dbuf, &b);
+ name = ns_client_newname(qctx->client, dbuf, &b);
if (name == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
&qctx->rdataset, &qctx->sigrdataset,
NULL, DNS_SECTION_AUTHORITY);
- dbuf = query_getnamebuf(qctx->client);
+ dbuf = ns_client_getnamebuf(qctx->client);
if (dbuf == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
- name = query_newname(qctx->client, dbuf, &b);
+ name = ns_client_newname(qctx->client, dbuf, &b);
if (name == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
dns_name_copy(nowild, name, NULL);
- clone = query_newrdataset(qctx->client);
- sigclone = query_newrdataset(qctx->client);
+ clone = ns_client_newrdataset(qctx->client);
+ sigclone = ns_client_newrdataset(qctx->client);
if (clone == NULL || sigclone == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
cleanup:
if (name != NULL) {
- query_releasename(qctx->client, &name);
+ ns_client_releasename(qctx->client, &name);
}
if (clone != NULL) {
- query_putrdataset(qctx->client, &clone);
+ ns_client_putrdataset(qctx->client, &clone);
}
if (sigclone != NULL) {
- query_putrdataset(qctx->client, &sigclone);
+ ns_client_putrdataset(qctx->client, &sigclone);
}
return (result);
}
goto cleanup;
}
- soardataset = query_newrdataset(qctx->client);
- sigsoardataset = query_newrdataset(qctx->client);
+ soardataset = ns_client_newrdataset(qctx->client);
+ sigsoardataset = ns_client_newrdataset(qctx->client);
if (soardataset == NULL || sigsoardataset == NULL) {
goto cleanup;
}
dns_db_detachnode(db, &node);
}
- soardataset = query_newrdataset(qctx->client);
- sigsoardataset = query_newrdataset(qctx->client);
+ soardataset = ns_client_newrdataset(qctx->client);
+ sigsoardataset = ns_client_newrdataset(qctx->client);
if (soardataset == NULL || sigsoardataset == NULL) {
goto cleanup;
}
dns_rdataset_disassociate(&sigrdataset);
}
if (soardataset != NULL) {
- query_putrdataset(qctx->client, &soardataset);
+ ns_client_putrdataset(qctx->client, &soardataset);
}
if (sigsoardataset != NULL) {
- query_putrdataset(qctx->client, &sigsoardataset);
+ ns_client_putrdataset(qctx->client, &sigsoardataset);
}
if (db != NULL) {
if (node != NULL) {
*/
qctx->findcoveringnsec = false;
if (qctx->fname != NULL) {
- query_releasename(qctx->client, &qctx->fname);
+ ns_client_releasename(qctx->client, &qctx->fname);
}
if (qctx->node != NULL) {
dns_db_detachnode(qctx->db, &qctx->node);
}
- query_putrdataset(qctx->client, &qctx->rdataset);
+ ns_client_putrdataset(qctx->client, &qctx->rdataset);
if (qctx->sigrdataset != NULL) {
- query_putrdataset(qctx->client, &qctx->sigrdataset);
+ ns_client_putrdataset(qctx->client, &qctx->sigrdataset);
}
return (query_lookup(qctx));
}
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
/*%
INSIST(!REDIRECT(qctx->client));
- result = query_recurse(qctx->client, qctx->qtype,
- qctx->client->query.qname,
- NULL, NULL, qctx->resuming);
+ result = ns_query_recurse(qctx->client, qctx->qtype,
+ qctx->client->query.qname,
+ NULL, NULL, qctx->resuming);
if (result == ISC_R_SUCCESS) {
qctx->client->query.attributes |=
NS_QUERYATTR_RECURSING;
QUERY_ERROR(qctx, result);
}
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
/*
tname = NULL;
result = dns_message_gettempname(qctx->client->message, &tname);
if (result != ISC_R_SUCCESS)
- return (query_done(qctx));
+ return (ns_query_done(qctx));
result = dns_rdataset_first(trdataset);
if (result != ISC_R_SUCCESS) {
dns_message_puttempname(qctx->client->message, &tname);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
dns_rdataset_current(trdataset, &rdata);
if (result != ISC_R_SUCCESS) {
dns_message_puttempname(qctx->client->message, &tname);
dns_rdata_freestruct(&cname);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
dns_rdata_freestruct(&cname);
query_addauth(qctx);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
/*
tname = NULL;
result = dns_message_gettempname(qctx->client->message, &tname);
if (result != ISC_R_SUCCESS)
- return (query_done(qctx));
+ return (ns_query_done(qctx));
result = dns_rdataset_first(trdataset);
if (result != ISC_R_SUCCESS) {
dns_message_puttempname(qctx->client->message, &tname);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
dns_rdataset_current(trdataset, &rdata);
prefix = dns_fixedname_initname(&fixed);
dns_name_split(qctx->client->query.qname, nlabels, prefix, NULL);
INSIST(qctx->fname == NULL);
- qctx->dbuf = query_getnamebuf(qctx->client);
+ qctx->dbuf = ns_client_getnamebuf(qctx->client);
if (qctx->dbuf == NULL) {
dns_message_puttempname(qctx->client->message, &tname);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
- qctx->fname = query_newname(qctx->client, qctx->dbuf, &b);
+ qctx->fname = ns_client_newname(qctx->client, qctx->dbuf, &b);
if (qctx->fname == NULL) {
dns_message_puttempname(qctx->client->message, &tname);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
result = dns_name_concatenate(prefix, tname, qctx->fname, NULL);
dns_message_puttempname(qctx->client->message, &tname);
if (result == DNS_R_NAMETOOLONG)
qctx->client->message->rcode = dns_rcode_yxdomain;
if (result != ISC_R_SUCCESS)
- return (query_done(qctx));
+ return (ns_query_done(qctx));
- query_keepname(qctx->client, qctx->fname, qctx->dbuf);
+ ns_client_keepname(qctx->client, qctx->fname, qctx->dbuf);
/*
* Synthesize a CNAME consisting of
*/
result = query_addcname(qctx, trdataset->trust, trdataset->ttl);
if (result != ISC_R_SUCCESS)
- return (query_done(qctx));
+ return (ns_query_done(qctx));
/*
* Switch to the new qname and restart.
query_addauth(qctx);
- return (query_done(qctx));
+ return (ns_query_done(qctx));
}
/*%
return (result);
dns_name_init(name, NULL);
dns_name_clone(dns_db_origin(qctx->db), name);
- rdataset = query_newrdataset(client);
+ rdataset = ns_client_newrdataset(client);
if (rdataset == NULL) {
CTRACE(ISC_LOG_ERROR, "unable to allocate rdataset");
eresult = DNS_R_SERVFAIL;
goto cleanup;
}
if (WANTDNSSEC(client) && dns_db_issecure(qctx->db)) {
- sigrdataset = query_newrdataset(client);
+ sigrdataset = ns_client_newrdataset(client);
if (sigrdataset == NULL) {
CTRACE(ISC_LOG_ERROR, "unable to allocate sigrdataset");
eresult = DNS_R_SERVFAIL;
}
cleanup:
- query_putrdataset(client, &rdataset);
+ ns_client_putrdataset(client, &rdataset);
if (sigrdataset != NULL)
- query_putrdataset(client, &sigrdataset);
+ ns_client_putrdataset(client, &sigrdataset);
if (name != NULL)
- query_releasename(client, &name);
+ ns_client_releasename(client, &name);
if (node != NULL)
dns_db_detachnode(qctx->db, &node);
}
dns_name_init(name, NULL);
dns_name_clone(dns_db_origin(qctx->db), name);
- rdataset = query_newrdataset(client);
+ rdataset = ns_client_newrdataset(client);
if (rdataset == NULL) {
CTRACE(ISC_LOG_ERROR,
- "query_addns: query_newrdataset failed");
+ "query_addns: ns_client_newrdataset failed");
eresult = DNS_R_SERVFAIL;
goto cleanup;
}
if (WANTDNSSEC(client) && dns_db_issecure(qctx->db)) {
- sigrdataset = query_newrdataset(client);
+ sigrdataset = ns_client_newrdataset(client);
if (sigrdataset == NULL) {
CTRACE(ISC_LOG_ERROR,
- "query_addns: query_newrdataset failed");
+ "query_addns: ns_client_newrdataset failed");
eresult = DNS_R_SERVFAIL;
goto cleanup;
}
cleanup:
CTRACE(ISC_LOG_DEBUG(3), "query_addns: cleanup");
- query_putrdataset(client, &rdataset);
+ ns_client_putrdataset(client, &rdataset);
if (sigrdataset != NULL) {
- query_putrdataset(client, &sigrdataset);
+ ns_client_putrdataset(client, &sigrdataset);
}
if (name != NULL) {
- query_releasename(client, &name);
+ ns_client_releasename(client, &name);
}
if (node != NULL) {
dns_db_detachnode(qctx->db, &node);
/*
* We'll need some resources...
*/
- dbuf = query_getnamebuf(client);
+ dbuf = ns_client_getnamebuf(client);
if (dbuf == NULL) {
goto cleanup;
}
- fname = query_newname(client, dbuf, &b);
- rdataset = query_newrdataset(client);
+ fname = ns_client_newname(client, dbuf, &b);
+ rdataset = ns_client_newrdataset(client);
if (fname == NULL || rdataset == NULL) {
goto cleanup;
}
* need to validate answers from the cache.
*/
if (WANTDNSSEC(client) || !is_zone) {
- sigrdataset = query_newrdataset(client);
+ sigrdataset = ns_client_newrdataset(client);
if (sigrdataset == NULL) {
goto cleanup;
}
goto cleanup;
}
if (USECACHE(client)) {
- query_keepname(client, fname, dbuf);
+ ns_client_keepname(client, fname, dbuf);
dns_db_detachnode(db, &node);
SAVE(zdb, db);
SAVE(zfname, fname);
}
if (use_zone) {
- query_releasename(client, &fname);
+ ns_client_releasename(client, &fname);
/*
- * We've already done query_keepname() on
+ * We've already done ns_client_keepname() on
* zfname, so we must set dbuf to NULL to
* prevent query_addrrset() from trying to
- * call query_keepname() again.
+ * call ns_client_keepname() again.
*/
dbuf = NULL;
- query_putrdataset(client, &rdataset);
+ ns_client_putrdataset(client, &rdataset);
if (sigrdataset != NULL) {
- query_putrdataset(client, &sigrdataset);
+ ns_client_putrdataset(client, &sigrdataset);
}
if (node != NULL) {
* now.
*/
if (!WANTDNSSEC(client)) {
- query_putrdataset(client, &sigrdataset);
+ ns_client_putrdataset(client, &sigrdataset);
}
query_addrrset(qctx, &fname, &rdataset, &sigrdataset, dbuf,
cleanup:
if (rdataset != NULL) {
- query_putrdataset(client, &rdataset);
+ ns_client_putrdataset(client, &rdataset);
}
if (sigrdataset != NULL) {
- query_putrdataset(client, &sigrdataset);
+ ns_client_putrdataset(client, &sigrdataset);
}
if (fname != NULL) {
- query_releasename(client, &fname);
+ ns_client_releasename(client, &fname);
}
if (node != NULL) {
dns_db_detachnode(db, &node);
dns_zone_detach(&zone);
}
if (zdb != NULL) {
- query_putrdataset(client, &zrdataset);
- if (zsigrdataset != NULL)
- query_putrdataset(client, &zsigrdataset);
- if (zfname != NULL)
- query_releasename(client, &zfname);
+ ns_client_putrdataset(client, &zrdataset);
+ if (zsigrdataset != NULL) {
+ ns_client_putrdataset(client, &zsigrdataset);
+ }
+ if (zfname != NULL) {
+ ns_client_releasename(client, &zfname);
+ }
dns_db_detach(&zdb);
}
}
/*
* We'll need some resources...
*/
- dbuf = query_getnamebuf(client);
+ dbuf = ns_client_getnamebuf(client);
if (dbuf == NULL)
goto cleanup;
- fname = query_newname(client, dbuf, &b);
- rdataset = query_newrdataset(client);
- sigrdataset = query_newrdataset(client);
+ fname = ns_client_newname(client, dbuf, &b);
+ rdataset = ns_client_newrdataset(client);
+ sigrdataset = ns_client_newrdataset(client);
if (fname == NULL || rdataset == NULL || sigrdataset == NULL)
goto cleanup;
* Replace resources which were consumed by query_addrrset.
*/
if (fname == NULL) {
- dbuf = query_getnamebuf(client);
+ dbuf = ns_client_getnamebuf(client);
if (dbuf == NULL)
goto cleanup;
- fname = query_newname(client, dbuf, &b);
+ fname = ns_client_newname(client, dbuf, &b);
}
if (rdataset == NULL)
- rdataset = query_newrdataset(client);
+ rdataset = ns_client_newrdataset(client);
else if (dns_rdataset_isassociated(rdataset))
dns_rdataset_disassociate(rdataset);
if (sigrdataset == NULL)
- sigrdataset = query_newrdataset(client);
+ sigrdataset = ns_client_newrdataset(client);
else if (dns_rdataset_isassociated(sigrdataset))
dns_rdataset_disassociate(sigrdataset);
* Replace resources which were consumed by query_addrrset.
*/
if (fname == NULL) {
- dbuf = query_getnamebuf(client);
+ dbuf = ns_client_getnamebuf(client);
if (dbuf == NULL)
goto cleanup;
- fname = query_newname(client, dbuf, &b);
+ fname = ns_client_newname(client, dbuf, &b);
}
if (rdataset == NULL)
- rdataset = query_newrdataset(client);
+ rdataset = ns_client_newrdataset(client);
else if (dns_rdataset_isassociated(rdataset))
dns_rdataset_disassociate(rdataset);
if (sigrdataset == NULL)
- sigrdataset = query_newrdataset(client);
+ sigrdataset = ns_client_newrdataset(client);
else if (dns_rdataset_isassociated(sigrdataset))
dns_rdataset_disassociate(sigrdataset);
query_addrrset(qctx, &fname, &rdataset, &sigrdataset,
dbuf, DNS_SECTION_AUTHORITY);
}
- if (rdataset != NULL)
- query_putrdataset(client, &rdataset);
- if (sigrdataset != NULL)
- query_putrdataset(client, &sigrdataset);
- if (fname != NULL)
- query_releasename(client, &fname);
+ if (rdataset != NULL) {
+ ns_client_putrdataset(client, &rdataset);
+ }
+ if (sigrdataset != NULL) {
+ ns_client_putrdataset(client, &sigrdataset);
+ }
+ if (fname != NULL) {
+ ns_client_releasename(client, &fname);
+ }
if (have_wname) {
ispositive = true; /* prevent loop */
if (!dns_name_equal(name, wname)) {
}
}
cleanup:
- if (rdataset != NULL)
- query_putrdataset(client, &rdataset);
- if (sigrdataset != NULL)
- query_putrdataset(client, &sigrdataset);
- if (fname != NULL)
- query_releasename(client, &fname);
+ if (rdataset != NULL) {
+ ns_client_putrdataset(client, &rdataset);
+ }
+ if (sigrdataset != NULL) {
+ ns_client_putrdataset(client, &sigrdataset);
+ }
+ if (fname != NULL) {
+ ns_client_releasename(client, &fname);
+ }
}
/*%
qctx->qtype != dns_rdatatype_ns)
{
if (qctx->fname != NULL) {
- query_releasename(qctx->client, &qctx->fname);
+ ns_client_releasename(qctx->client,
+ &qctx->fname);
}
query_addbestns(qctx);
}
}
}
-/*%
- * Finalize this phase of the query process:
- *
- * - Clean up
- * - If we have an answer ready (positive or negative), send it.
- * - If we need to restart for a chaining query, call ns__query_start() again.
- * - If we've started recursion, then just clean up; things will be
- * restarted via fetch_callback()/query_resume().
- */
-static isc_result_t
-query_done(query_ctx_t *qctx) {
+isc_result_t
+ns_query_done(query_ctx_t *qctx) {
const dns_namelist_t *secs = qctx->client->message->sections;
- CCTRACE(ISC_LOG_DEBUG(3), "query_done");
+ CCTRACE(ISC_LOG_DEBUG(3), "ns_query_done");
PROCESS_HOOK(NS_QUERY_DONE_BEGIN, qctx);
if (qctx->qtype == dns_rdatatype_aaaa) {
dns_rdataset_t *trdataset;
- trdataset = query_newrdataset(qctx->client);
+ trdataset = ns_client_newrdataset(qctx->client);
result = dns_db_findrdataset(qctx->db, qctx->node,
qctx->version,
dns_rdatatype_a, 0,
if (dns_rdataset_isassociated(trdataset)) {
dns_rdataset_disassociate(trdataset);
}
- query_putrdataset(qctx->client, &trdataset);
+ ns_client_putrdataset(qctx->client, &trdataset);
/*
* We found an AAAA. If we also found an A, then the AAAA
* if the recursion for the A succeeds.
*/
INSIST(!REDIRECT(qctx->client));
- result = query_recurse(qctx->client,
- dns_rdatatype_a,
- qctx->client->query.qname,
- NULL, NULL, qctx->resuming);
+ result = ns_query_recurse(qctx->client,
+ dns_rdatatype_a,
+ qctx->client->query.qname,
+ NULL, NULL, qctx->resuming);
if (result == ISC_R_SUCCESS) {
qctx->client->hookflags |=
FILTER_AAAA_RECURSING;
qctx->client->hookflags &= ~FILTER_AAAA_RECURSING;
- result = query_done(qctx);
+ result = ns_query_done(qctx);
*resp = result;
return (true);