mirror of
https://github.com/isc-projects/bind9.git
synced 2026-04-24 07:41:10 -04:00
What used to be dns_view_find() is now dns_view_simplefind().
There's now a new dns_view_find() that will return DNS_R_CNAME and DNS_R_DNAME. Also, both find routines now also return DNS_R_NXDOMAIN and DNS_R_NXRRSET so that callers can tell whether or not a fetch might be useful.
This commit is contained in:
parent
daf83a2937
commit
8f5df5f1fe
2 changed files with 101 additions and 15 deletions
|
|
@ -255,8 +255,61 @@ dns_view_freeze(dns_view_t *view);
|
|||
|
||||
isc_result_t
|
||||
dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
|
||||
isc_stdtime_t now, unsigned int options, isc_boolean_t use_hints,
|
||||
isc_stdtime_t now, unsigned int options,
|
||||
isc_boolean_t use_hints, dns_name_t *foundname,
|
||||
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
|
||||
/*
|
||||
* Find an rdataset whose owner name is 'name', and whose type is
|
||||
* 'type'.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
* See the description of dns_db_find() for information about 'options'.
|
||||
* If the caller sets DNS_DBFIND_GLUEOK, it must ensure that 'name'
|
||||
* and 'type' are appropriate for glue retrieval.
|
||||
*
|
||||
* If 'now' is zero, then the current time will be used.
|
||||
*
|
||||
* If 'use_hints' is ISC_TRUE, and the view has a hints database, then
|
||||
* it will be searched last. If the answer is found in the hints
|
||||
* database, the result code will be DNS_R_HINT.
|
||||
*
|
||||
* 'foundname' must meet the requirements of dns_db_find().
|
||||
*
|
||||
* If 'sigrdataset' is not NULL, and there is a SIG rdataset which
|
||||
* covers 'type', then 'sigrdataset' will be bound to it.
|
||||
*
|
||||
* Requires:
|
||||
*
|
||||
* 'view' is a valid, frozen view.
|
||||
*
|
||||
* 'name' is valid name.
|
||||
*
|
||||
* 'type' is a valid dns_rdatatype_t, and is not a meta query type
|
||||
* (e.g. dns_rdatatype_any), or dns_rdatatype_sig.
|
||||
*
|
||||
* 'foundname' is
|
||||
*
|
||||
* 'rdataset' is a valid, disassociated rdataset.
|
||||
*
|
||||
* 'sigrdataset' is NULL, or is a valid, disassociated rdataset.
|
||||
*
|
||||
* Ensures:
|
||||
*
|
||||
* In successful cases, 'rdataset', and possibly 'sigrdataset', are
|
||||
* bound to the found data.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* Any result that dns_db_find() can return, with the exception of
|
||||
* DNS_R_DELEGATION.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
dns_view_simplefind(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
|
||||
isc_stdtime_t now, unsigned int options,
|
||||
isc_boolean_t use_hints,
|
||||
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
|
||||
/*
|
||||
* Find an rdataset whose owner name is 'name', and whose type is
|
||||
* 'type'.
|
||||
|
|
@ -300,11 +353,13 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
|
|||
*
|
||||
* Returns:
|
||||
*
|
||||
* ISC_R_SUCCESS Success.
|
||||
* ISC_R_SUCCESS Success; result is desired type.
|
||||
* DNS_R_GLUE Success; result is glue.
|
||||
* DNS_R_HINT Success; result is a hint.
|
||||
* DNS_R_NCACHENXDOMAIN Success; result is a ncache entry.
|
||||
* DNS_R_NCACHENXRRSET Success; result is a ncache entry.
|
||||
* DNS_R_NXDOMAIN The name does not exist.
|
||||
* DNS_R_NXRRSET The rrset does not exist.
|
||||
* ISC_R_NOTFOUND No matching data found,
|
||||
* or an error occurred.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -394,11 +394,11 @@ dns_view_findzone(dns_view_t *view, dns_name_t *name, dns_zone_t **zonep) {
|
|||
|
||||
isc_result_t
|
||||
dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
|
||||
isc_stdtime_t now, unsigned int options, isc_boolean_t use_hints,
|
||||
isc_stdtime_t now, unsigned int options,
|
||||
isc_boolean_t use_hints, dns_name_t *foundname,
|
||||
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_fixedname_t foundname;
|
||||
dns_db_t *db;
|
||||
dns_dbversion_t *version;
|
||||
isc_boolean_t is_zone;
|
||||
|
|
@ -443,10 +443,8 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
|
|||
/*
|
||||
* Now look for an answer in the database.
|
||||
*/
|
||||
dns_fixedname_init(&foundname);
|
||||
result = dns_db_find(db, name, NULL, type, options,
|
||||
now, NULL, dns_fixedname_name(&foundname),
|
||||
rdataset, sigrdataset);
|
||||
now, NULL, foundname, rdataset, sigrdataset);
|
||||
|
||||
if (result == DNS_R_DELEGATION ||
|
||||
result == DNS_R_NOTFOUND) {
|
||||
|
|
@ -515,21 +513,23 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
|
|||
dns_rdataset_disassociate(rdataset);
|
||||
if (sigrdataset != NULL && sigrdataset->methods != NULL)
|
||||
dns_rdataset_disassociate(sigrdataset);
|
||||
dns_fixedname_init(&foundname);
|
||||
result = dns_db_find(view->hints, name, NULL, type, options,
|
||||
now, NULL, dns_fixedname_name(&foundname),
|
||||
now, NULL, foundname,
|
||||
rdataset, sigrdataset);
|
||||
if (result == ISC_R_SUCCESS || result == DNS_R_GLUE)
|
||||
result = DNS_R_HINT;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (result != ISC_R_SUCCESS &&
|
||||
result != DNS_R_GLUE &&
|
||||
result != DNS_R_HINT &&
|
||||
result != DNS_R_NCACHENXDOMAIN &&
|
||||
result != DNS_R_NCACHENXRRSET)
|
||||
result = DNS_R_NOTFOUND;
|
||||
if (result == DNS_R_NXDOMAIN || result == DNS_R_NXRRSET) {
|
||||
/*
|
||||
* We don't care about any DNSSEC proof data in these cases.
|
||||
*/
|
||||
if (rdataset->methods != NULL)
|
||||
dns_rdataset_disassociate(rdataset);
|
||||
if (sigrdataset != NULL && sigrdataset->methods != NULL)
|
||||
dns_rdataset_disassociate(sigrdataset);
|
||||
}
|
||||
|
||||
if (zrdataset.methods != NULL) {
|
||||
dns_rdataset_disassociate(&zrdataset);
|
||||
|
|
@ -544,6 +544,37 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
|
|||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_view_simplefind(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
|
||||
isc_stdtime_t now, unsigned int options,
|
||||
isc_boolean_t use_hints,
|
||||
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_fixedname_t foundname;
|
||||
|
||||
dns_fixedname_init(&foundname);
|
||||
result = dns_view_find(view, name, type, now, options, use_hints,
|
||||
dns_fixedname_name(&foundname),
|
||||
rdataset, sigrdataset);
|
||||
if (result != ISC_R_SUCCESS &&
|
||||
result != DNS_R_GLUE &&
|
||||
result != DNS_R_HINT &&
|
||||
result != DNS_R_NCACHENXDOMAIN &&
|
||||
result != DNS_R_NCACHENXRRSET &&
|
||||
result != DNS_R_NXDOMAIN &&
|
||||
result != DNS_R_NXRRSET &&
|
||||
result != DNS_R_NOTFOUND) {
|
||||
if (rdataset->methods != NULL)
|
||||
dns_rdataset_disassociate(rdataset);
|
||||
if (sigrdataset != NULL && sigrdataset->methods != NULL)
|
||||
dns_rdataset_disassociate(sigrdataset);
|
||||
result = DNS_R_NOTFOUND;
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
|
||||
isc_stdtime_t now, unsigned int options,
|
||||
|
|
|
|||
Loading…
Reference in a new issue