if (result == ISC_R_SUCCESS) {
/*
* We've already got an RRset of the given name and type.
- * There's nothing else to do;
*/
CTRACE("query_addrrset: dns_message_findname succeeded: done");
if (dbuf != NULL)
query_releasename(client, namep);
+ if ((rdataset->attributes & DNS_RDATASETATTR_REQUIRED) != 0)
+ mrdataset->attributes |= DNS_RDATASETATTR_REQUIRED;
return;
} else if (result == DNS_R_NXDOMAIN) {
/*
static inline isc_result_t
query_addsoa(ns_client_t *client, dns_db_t *db, dns_dbversion_t *version,
- unsigned int override_ttl, isc_boolean_t isassociated)
+ unsigned int override_ttl, isc_boolean_t isassociated,
+ dns_section_t section)
{
dns_name_t *name;
dns_dbnode_t *node;
sigrdatasetp = &sigrdataset;
else
sigrdatasetp = NULL;
+
+ if (section == DNS_SECTION_ADDITIONAL)
+ rdataset->attributes |= DNS_RDATASETATTR_REQUIRED;
query_addrrset(client, &name, &rdataset, sigrdatasetp, NULL,
- DNS_SECTION_AUTHORITY);
+ section);
}
cleanup:
ISC_LIST_PREPEND(msg->sections[section], name, link);
ISC_LIST_UNLINK(name->list, rdataset, link);
ISC_LIST_PREPEND(name->list, rdataset, link);
- rdataset->attributes |= DNS_RDATASETATTR_REQUIREDGLUE;
+ rdataset->attributes |= DNS_RDATASETATTR_REQUIRED;
}
}
int line = -1;
isc_boolean_t dns64_exclude, dns64;
isc_boolean_t nxrewrite = ISC_FALSE;
+ isc_boolean_t associated;
+ dns_section_t section;
+ dns_ttl_t ttl;
CTRACE("query_find");
}
/*
- * Add SOA if NXRRSET was not generated by RPZ rewrite
+ * Add SOA to the additional section if generated by a RPZ
+ * rewrite.
*/
- if (!nxrewrite) {
- isc_boolean_t associated =
- dns_rdataset_isassociated(rdataset);
- result = query_addsoa(client, db, version,
- ISC_UINT32_MAX, associated);
- if (result != ISC_R_SUCCESS) {
- QUERY_ERROR(result);
- goto cleanup;
- }
+ associated = dns_rdataset_isassociated(rdataset);
+ section = nxrewrite ? DNS_SECTION_ADDITIONAL :
+ DNS_SECTION_AUTHORITY;
+
+ result = query_addsoa(client, db, version, ISC_UINT32_MAX,
+ associated, section);
+ if (result != ISC_R_SUCCESS) {
+ QUERY_ERROR(result);
+ goto cleanup;
}
/*
}
/*
- * Add SOA if NXDOMAIN was not generated by RPZ rewrite.
+ * Add SOA to the additional section if generated by a
+ * RPZ rewrite.
*
* If the query was for a SOA record force the
* ttl to zero so that it is possible for clients to find
* the containing zone of an arbitrary name with a stub
* resolver and not have it cached.
*/
+ associated = dns_rdataset_isassociated(rdataset);
+ section = nxrewrite ? DNS_SECTION_ADDITIONAL :
+ DNS_SECTION_AUTHORITY;
+ ttl = ISC_UINT32_MAX;
if (!nxrewrite && qtype == dns_rdatatype_soa &&
zone != NULL && dns_zone_getzeronosoattl(zone))
- result = query_addsoa(client, db, version, 0,
- dns_rdataset_isassociated(rdataset));
- else if (!nxrewrite)
- result = query_addsoa(client, db, version,
- ISC_UINT32_MAX,
- dns_rdataset_isassociated(rdataset));
+ ttl = 0;
+ result = query_addsoa(client, db, version, ttl, associated,
+ section);
if (result != ISC_R_SUCCESS) {
QUERY_ERROR(result);
goto cleanup;
* Add a fake SOA record.
*/
(void)query_addsoa(client, db, version,
- 600, ISC_FALSE);
+ 600, ISC_FALSE,
+ DNS_SECTION_AUTHORITY);
goto cleanup;
}
#endif