}
}
- obj = NULL;
- result = named_config_get(maps, "send-report-channel", &obj);
- if (view->rad != NULL) {
- dns_name_free(view->rad, view->mctx);
- isc_mem_put(view->mctx, view->rad, sizeof(*view->rad));
- }
- if (result == ISC_R_SUCCESS) {
- str = cfg_obj_asstring(obj);
- if (strcmp(str, ".") != 0 && strcmp(str, "") != 0) {
- view->rad = isc_mem_get(mctx, sizeof(*view->rad));
- dns_name_init(view->rad, NULL);
- CHECK(dns_name_fromstring(view->rad, str, dns_rootname,
- 0, mctx));
- }
- }
-
obj = NULL;
result = named_config_get(maps, "dnssec-accept-expired", &obj);
INSIST(result == ISC_R_SUCCESS);
if (ztype != dns_zone_stub && ztype != dns_zone_staticstub &&
ztype != dns_zone_redirect)
{
+ bool logreports = false;
+
/* Make a reference to the default policy. */
result = dns_kasplist_find(kasplist, "default", &kasp);
INSIST(result == ISC_R_SUCCESS && kasp != NULL);
dns_zone_setoption(zone, DNS_ZONEOPT_NSEC3TESTZONE,
cfg_obj_asboolean(obj));
- obj = NULL;
- (void)cfg_map_get(zoptions, "send-report-channel", &obj);
- if (obj != NULL) {
- dns_fixedname_t fixed;
- dns_name_t *rad = dns_fixedname_initname(&fixed);
- CHECK(dns_name_fromstring(rad, cfg_obj_asstring(obj),
- dns_rootname, 0, mctx));
- dns_zone_setrad(zone, rad);
- } else {
- dns_zone_setrad(zone, NULL);
- }
-
obj = NULL;
result = cfg_map_get(zoptions, "log-report-channel", &obj);
if (result == ISC_R_SUCCESS) {
+ logreports = cfg_obj_asboolean(obj);
dns_zone_setoption(zone, DNS_ZONEOPT_LOGREPORTS,
- cfg_obj_asboolean(obj));
+ logreports);
+ }
+ obj = NULL;
+ result = named_config_get(maps, "send-report-channel", &obj);
+ if (result == ISC_R_SUCCESS && obj != NULL) {
+ dns_fixedname_t fixed;
+ dns_name_t *rad = dns_fixedname_initname(&fixed);
+ const char *adstr = cfg_obj_asstring(obj);
+ dns_name_t *zn = dns_zone_getorigin(zone);
+
+ CHECK(dns_name_fromstring(rad, adstr, dns_rootname, 0,
+ mctx));
+ if (logreports || dns_name_equal(rad, dns_rootname)) {
+ /* Disable RC for error-logging zones or root */
+ dns_zone_setrad(zone, NULL);
+ } else if (dns_name_equal(rad, zn)) {
+ /*
+ * It's illegal to set a matching agent
+ * domain at the zone level, but it could
+ * be set in options/view. If so, and the
+ * matching zone doesn't log reports, warn.
+ */
+ cfg_obj_log(obj, ISC_LOG_WARNING,
+ "send-report-channel is set to "
+ "'%s' but that zone does not have "
+ "log-report-channel set",
+ zname);
+ dns_zone_setrad(zone, NULL);
+ } else if (dns_name_issubdomain(rad, zn)) {
+ cfg_obj_log(obj, ISC_LOG_WARNING,
+ "send-report-channel '%s' ignored "
+ "for zone '%s' because it is a "
+ "subdomain of the zone",
+ adstr, zname);
+ dns_zone_setrad(zone, NULL);
+ } else {
+ dns_zone_setrad(zone, rad);
+ }
}
} else if (ztype == dns_zone_redirect) {
dns_zone_setnotifytype(zone, dns_notifytype_no);
--- /dev/null
+; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+;
+; SPDX-License-Identifier: MPL-2.0
+;
+; This Source Code Form is subject to the terms of the Mozilla Public
+; License, v. 2.0. If a copy of the MPL was not distributed with this
+; file, you can obtain one at https://mozilla.org/MPL/2.0/.
+;
+; See the COPYRIGHT file distributed with this work for additional
+; information regarding copyright ownership.
+
+$TTL 300 ; 5 minutes
+@ IN SOA ns root (
+ 2018010100 ; serial
+ 1800 ; refresh (30 minutes)
+ 1800 ; retry (30 minutes)
+ 1814400 ; expire (3 weeks)
+ 3600 ; minimum (1 hour)
+ )
+ NS ns
+ns A 10.53.0.1
+server A 10.53.0.100
+*._er TXT "Report received"
[ $ret -eq 0 ] || echo_i "failed"
status=$((status + ret))
+n=$((n + 1))
+echo_i "check that Report-Channel option is omitted for names in error-logging zones ($n)"
+ret=0
+$DIG $DIGOPTS @10.53.0.1 example.rad >dig.out.test$n
+grep "; Report-Channel: example.rad" dig.out.test$n >/dev/null && ret=1
+[ $ret -eq 0 ] || echo_i "failed"
+status=$((status + ret))
+
+n=$((n + 1))
+echo_i "check that Report-Channel option is omitted for zones above the agent-domain ($n)"
+ret=0
+$DIG $DIGOPTS @10.53.0.1 rad >dig.out.test$n
+grep "; Report-Channel: example.rad" dig.out.test$n >/dev/null && ret=1
+[ $ret -eq 0 ] || echo_i "failed"
+status=$((status + ret))
+
n=$((n + 1))
echo_i "check that a zone-level Report-Channel EDNS option is added to responses ($n)"
ret=0