+3501. [func] zone-statistics now takes three options: full,
+ terse, and none. "yes" and "no" are retained as
+ synonyms for full and terse, respectively. [RT #29165]
+
3500. [port] Support NAPTR regular expression validation on
all platforms. [RT #32688]
sig-signing-signatures 10;\n\
sig-signing-type 65534;\n\
inline-signing no;\n\
- zone-statistics false;\n\
+ zone-statistics terse;\n\
max-journal-size unlimited;\n\
ixfr-from-differences false;\n\
check-wildcard yes;\n\
}
static isc_result_t
-setquerystats(dns_zone_t *zone, isc_mem_t *mctx, isc_boolean_t on) {
+setquerystats(dns_zone_t *zone, isc_mem_t *mctx, dns_zonestat_level_t level) {
isc_result_t result;
isc_stats_t *zoneqrystats;
+ dns_zone_setstatlevel(zone, level);
+
zoneqrystats = NULL;
- if (on) {
+ if (level == dns_zonestat_full) {
result = isc_stats_create(mctx, &zoneqrystats,
dns_nsstatscounter_max);
if (result != ISC_R_SUCCESS)
dns_zone_setdialup(zone, dns_dialuptype_no);
dns_zone_setnotifytype(zone, dns_notifytype_no);
dns_zone_setoption(zone, DNS_ZONEOPT_NOCHECKNS, ISC_TRUE);
- CHECK(setquerystats(zone, mctx, ISC_FALSE)); /* XXXMPA */
+ CHECK(setquerystats(zone, mctx, dns_zonestat_none)); /* XXXMPA */
CHECK(dns_view_addzone(view, zone));
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
ISC_LOG_INFO, "dns64 reverse zone%s%s: %s", sep,
const char *empty_dbtype[4] =
{ "_builtin", "empty", NULL, NULL };
int empty_dbtypec = 4;
- isc_boolean_t zonestats_on;
+ dns_zonestat_level_t statlevel;
dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
obj = NULL;
result = ns_config_get(maps, "zone-statistics", &obj);
INSIST(result == ISC_R_SUCCESS);
- zonestats_on = cfg_obj_asboolean(obj);
+ if (cfg_obj_isboolean(obj)) {
+ if (cfg_obj_asboolean(obj))
+ statlevel = dns_zonestat_full;
+ else
+ statlevel = dns_zonestat_terse; /* XXX */
+ } else {
+ const char *levelstr = cfg_obj_asstring(obj);
+ if (strcasecmp(levelstr, "full") == 0)
+ statlevel = dns_zonestat_full;
+ else if (strcasecmp(levelstr, "terse") == 0)
+ statlevel = dns_zonestat_terse;
+ else if (strcasecmp(levelstr, "none") == 0)
+ statlevel = dns_zonestat_none;
+ else
+ INSIST(0);
+ }
for (empty = empty_zones[empty_zone];
empty != NULL;
dns_zone_setview(zone, view);
CHECK(dns_view_addzone(view, zone));
CHECK(setquerystats(zone, mctx,
- zonestats_on));
+ statlevel));
dns_zone_detach(&zone);
continue;
}
dns_zone_setnotifytype(zone, dns_notifytype_no);
dns_zone_setoption(zone, DNS_ZONEOPT_NOCHECKNS,
ISC_TRUE);
- CHECK(setquerystats(zone, mctx, zonestats_on));
+ CHECK(setquerystats(zone, mctx, statlevel));
CHECK(dns_view_addzone(view, zone));
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER, ISC_LOG_INFO,
dns_zone_setjournalsize(zone, 0);
dns_zone_setstats(zone, ns_g_server->zonestats);
- CHECK(setquerystats(zone, mctx, ISC_FALSE));
+ CHECK(setquerystats(zone, mctx, dns_zonestat_none));
if (view->managed_keys != NULL)
dns_zone_detach(&view->managed_keys);
static isc_result_t
zone_xmlrender(dns_zone_t *zone, void *arg) {
-
+ isc_result_t result;
char buf[1024 + 32]; /* sufficiently large for zone name and class */
char *zone_name_only = NULL;
dns_rdataclass_t rdclass;
xmlTextWriterPtr writer = arg;
isc_stats_t *zonestats;
dns_stats_t *rcvquerystats;
-
+ dns_zonestat_level_t statlevel;
isc_uint64_t nsstat_values[dns_nsstatscounter_max];
int xmlrc;
- isc_result_t result;
+
+ statlevel = dns_zone_getstatlevel(zone);
+ if (statlevel == dns_zonestat_none)
+ return (ISC_R_SUCCESS);
stats_dumparg_t dumparg;
dumparg.type = isc_statsformat_xml;
dumparg.arg = writer;
-
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "zone"));
dns_zone_name(zone, buf, sizeof(buf));
zone_name_only = strtok(buf, "/");
- if(zone_name_only == NULL){
+ if(zone_name_only == NULL)
zone_name_only = buf;
- }
+
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "name",
ISC_XMLCHAR zone_name_only));
-
rdclass = dns_zone_getclass(zone);
dns_rdataclass_format(rdclass, buf, sizeof(buf));
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "rdataclass",
zonestats = dns_zone_getrequeststats(zone);
rcvquerystats = dns_zone_getrcvquerystats(zone);
- if (zonestats != NULL ) {
+ if (statlevel == dns_zonestat_full && zonestats != NULL) {
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "counters"));
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "rcode"));
TRY0(xmlTextWriterEndElement(writer));
}
- if(rcvquerystats != NULL){
+ if (statlevel == dns_zonestat_full && rcvquerystats != NULL) {
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "counters"));
TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
ISC_XMLCHAR "qtype"));
dns_masterformat_t masterformat;
isc_stats_t *zoneqrystats;
dns_stats_t *rcvquerystats;
- isc_boolean_t zonestats_on;
+ dns_zonestat_level_t statlevel;
int seconds;
dns_zone_t *mayberaw = (raw != NULL) ? raw : zone;
obj = NULL;
result = ns_config_get(maps, "zone-statistics", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
- zonestats_on = cfg_obj_asboolean(obj);
+ if (cfg_obj_isboolean(obj)) {
+ if (cfg_obj_asboolean(obj))
+ statlevel = dns_zonestat_full;
+ else
+ statlevel = dns_zonestat_terse; /* XXX */
+ } else {
+ const char *levelstr = cfg_obj_asstring(obj);
+ if (strcasecmp(levelstr, "full") == 0)
+ statlevel = dns_zonestat_full;
+ else if (strcasecmp(levelstr, "terse") == 0)
+ statlevel = dns_zonestat_terse;
+ else if (strcasecmp(levelstr, "none") == 0)
+ statlevel = dns_zonestat_none;
+ else
+ INSIST(0);
+ }
+ dns_zone_setstatlevel(zone, statlevel);
zoneqrystats = NULL;
rcvquerystats = NULL;
- if (zonestats_on) {
+ if (statlevel == dns_zonestat_full) {
RETERR(isc_stats_create(mctx, &zoneqrystats,
dns_nsstatscounter_max));
RETERR(dns_rdatatypestats_create(mctx,
&rcvquerystats));
}
- dns_zone_setrequeststats(zone, zoneqrystats );
+ dns_zone_setrequeststats(zone, zoneqrystats);
dns_zone_setrcvquerystats(zone, rcvquerystats);
if (zoneqrystats != NULL)
serial-queries 10;
serial-query-rate 100;
server-id none;
+ zone-statistics none;
};
view "first" {
match-clients {
};
dnssec-lookaside auto;
dnssec-validation auto;
+ zone-statistics terse;
};
view "second" {
match-clients {
type master;
file "yyy";
update-policy local;
+ zone-statistics yes;
};
zone "example2" {
type static-stub;
forwarders {
10.53.0.4;
};
+ zone-statistics no;
};
dnssec-lookaside "." trust-anchor "dlv.isc.org.";
dnssec-validation auto;
+ zone-statistics full;
};
<optional> pid-file <replaceable>path_name</replaceable>; </optional>
<optional> recursing-file <replaceable>path_name</replaceable>; </optional>
<optional> statistics-file <replaceable>path_name</replaceable>; </optional>
- <optional> zone-statistics <replaceable>yes_or_no</replaceable>; </optional>
+ <optional> zone-statistics <replaceable>full</replaceable> | <replaceable>terse</replaceable> | <replaceable>none</replaceable>; </optional>
<optional> auth-nxdomain <replaceable>yes_or_no</replaceable>; </optional>
<optional> deallocate-on-exit <replaceable>yes_or_no</replaceable>; </optional>
<optional> dialup <replaceable>dialup_option</replaceable>; </optional>
</listitem>
</varlistentry>
-
+ <varlistentry>
+ <term><command>zone-statistics</command></term>
+ <listitem>
+ <para>
+ If <userinput>full</userinput>, the server will collect
+ statistical data on all zones (unless specifically
+ turned off on a per-zone basis by specifying
+ <command>zone-statistics terse</command> or
+ <command>zone-statistics none</command>
+ in the <command>zone</command> statement).
+ The default is <userinput>terse</userinput>, providing
+ minimal statistics on zones (including name and
+ current serial number, but not query type
+ counters).
+ </para>
+ <para>
+ These statistics may be accessed via the
+ <command>statistics-channel</command> or
+ using <command>rndc stats</command>, which
+ will dump them to the file listed
+ in the <command>statistics-file</command>. See
+ also <xref linkend="statsfile"/>.
+ </para>
+ <para>
+ For backward compatibility with earlier versions
+ of BIND 9, the <command>zone-statistics</command>
+ option can also accept <userinput>yes</userinput>
+ or <userinput>no</userinput>, which have the same
+ effect as <userinput>full</userinput> and
+ <userinput>terse</userinput>, respectively.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
<sect3 id="boolean_options">
</listitem>
</varlistentry>
- <varlistentry>
- <term><command>zone-statistics</command></term>
- <listitem>
- <para>
- If <userinput>yes</userinput>, the server will collect
- statistical data on all zones (unless specifically turned
- off
- on a per-zone basis by specifying <command>zone-statistics no</command>
- in the <command>zone</command> statement).
- The default is <userinput>no</userinput>.
- These statistics may be accessed
- using <command>rndc stats</command>, which will
- dump them to the file listed
- in the <command>statistics-file</command>. See
- also <xref linkend="statsfile"/>.
- </para>
- </listitem>
- </varlistentry>
-
<varlistentry>
<term><command>use-ixfr</command></term>
<listitem>
<optional> pubkey <replaceable>number</replaceable> <replaceable>number</replaceable> <replaceable>number</replaceable> <replaceable>string</replaceable> ; </optional>
<optional> notify-source (<replaceable>ip4_addr</replaceable> | <constant>*</constant>) <optional>port <replaceable>ip_port</replaceable></optional> ; </optional>
<optional> notify-source-v6 (<replaceable>ip6_addr</replaceable> | <constant>*</constant>) <optional>port <replaceable>ip_port</replaceable></optional> ; </optional>
- <optional> zone-statistics <replaceable>yes_or_no</replaceable> ; </optional>
+ <optional> zone-statistics <replaceable>full</replaceable> | <replaceable>terse</replaceable> | <replaceable>none</replaceable>; </optional>
<optional> sig-validity-interval <replaceable>number</replaceable> <optional><replaceable>number</replaceable></optional> ; </optional>
<optional> sig-signing-nodes <replaceable>number</replaceable> ; </optional>
<optional> sig-signing-signatures <replaceable>number</replaceable> ; </optional>
<optional> use-alt-transfer-source <replaceable>yes_or_no</replaceable>; </optional>
<optional> notify-source (<replaceable>ip4_addr</replaceable> | <constant>*</constant>) <optional>port <replaceable>ip_port</replaceable></optional> ; </optional>
<optional> notify-source-v6 (<replaceable>ip6_addr</replaceable> | <constant>*</constant>) <optional>port <replaceable>ip_port</replaceable></optional> ; </optional>
- <optional> zone-statistics <replaceable>yes_or_no</replaceable> ; </optional>
+ <optional> zone-statistics <replaceable>full</replaceable> | <replaceable>terse</replaceable> | <replaceable>none</replaceable>; </optional>
<optional> sig-validity-interval <replaceable>number</replaceable> <optional><replaceable>number</replaceable></optional> ; </optional>
<optional> sig-signing-nodes <replaceable>number</replaceable> ; </optional>
<optional> sig-signing-signatures <replaceable>number</replaceable> ; </optional>
dns_zone_redirect
} dns_zonetype_t;
+typedef enum {
+ dns_zonestat_none = 0,
+ dns_zonestat_terse,
+ dns_zonestat_full
+} dns_zonestat_level_t;
+
#define DNS_ZONEOPT_SERVERS 0x00000001U /*%< perform server checks */
#define DNS_ZONEOPT_PARENTS 0x00000002U /*%< perform parent checks */
#define DNS_ZONEOPT_CHILDREN 0x00000004U /*%< perform child checks */
void
dns_zone_setrequeststats(dns_zone_t *zone, isc_stats_t *stats);
+
+void
+dns_zone_setrcvquerystats(dns_zone_t *zone, dns_stats_t *stats);
/*%<
- * Set an additional statistics set to zone. It is attached in the zone
- * but is not counted in the zone module; only the caller updates the counters.
+ * Set additional statistics sets to zone. These are attached to the zone
+ * but are not counted in the zone module; only the caller updates the
+ * counters.
*
* Requires:
* \li 'zone' to be a valid zone.
*\li stats is a valid statistics.
*/
-void
-dns_zone_setrcvquerystats(dns_zone_t *zone, dns_stats_t *stats);
-
isc_stats_t *
dns_zone_getrequeststats(dns_zone_t *zone);
dns_stats_t *
dns_zone_getrcvquerystats(dns_zone_t *zone);
-
/*%<
* Get the additional statistics for zone, if one is installed.
*
dns_rpz_num_t
dns_zone_get_rpz_num(dns_zone_t *zone);
+void
+dns_zone_setstatlevel(dns_zone_t *zone, dns_zonestat_level_t level);
+
+dns_zonestat_level_t
+dns_zone_getstatlevel(dns_zone_t *zone);
+/*%
+ * Set and get the statistics reporting level for the zone;
+ * full, terse, or none.
+ */
+
ISC_LANG_ENDDECLS
dns_zone_getsigresigninginterval
dns_zone_getsigvalidityinterval
dns_zone_getssutable
+dns_zone_getstatlevel
dns_zone_getstatscounters
dns_zone_gettask
dns_zone_gettype
dns_zone_setsigvalidityinterval
dns_zone_setssutable
dns_zone_setstatistics
+dns_zone_setstatlevel
dns_zone_setstats
dns_zone_settask
dns_zone_settype
* Optional per-zone statistics counters. Counted outside of this
* module.
*/
+ dns_zonestat_level_t statlevel;
isc_boolean_t requeststats_on;
isc_stats_t *requeststats;
dns_stats_t *rcvquerystats;
zone->statelist = NULL;
zone->stats = NULL;
zone->requeststats_on = ISC_FALSE;
+ zone->statlevel = dns_zonestat_none;
zone->requeststats = NULL;
zone->rcvquerystats = NULL;
zone->notifydelay = 5;
UNLOCK_ZONE(zone);
return (n);
}
+
+void
+dns_zone_setstatlevel(dns_zone_t *zone, dns_zonestat_level_t level) {
+ REQUIRE(DNS_ZONE_VALID(zone));
+
+ zone->statlevel = level;
+}
+
+dns_zonestat_level_t
+dns_zone_getstatlevel(dns_zone_t *zone) {
+ REQUIRE(DNS_ZONE_VALID(zone));
+
+ return (zone->statlevel);
+}
parse_enum_or_other(cfg_parser_t *pctx, const cfg_type_t *enumtype,
const cfg_type_t *othertype, cfg_obj_t **ret);
+static void
+doc_enum_or_other(cfg_printer_t *pctx, const cfg_type_t *type);
+
static isc_result_t
parse_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret);
&cfg_rep_string, &updatemethods_enums
};
+/*
+ * zone-statistics: full, terse, or none.
+ *
+ * for backward compatibility, we also support boolean values.
+ * yes represents "full", no represents "terse". in the future we
+ * may change no to mean "none".
+ */
+static const char *zonestat_enums[] = { "full", "terse", "none", NULL };
+static isc_result_t
+parse_zonestat(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
+ return (parse_enum_or_other(pctx, type, &cfg_type_boolean, ret));
+}
+static cfg_type_t cfg_type_zonestat = {
+ "zonestat", parse_zonestat, cfg_print_ustring, doc_enum_or_other,
+ &cfg_rep_string, zonestat_enums
+};
+
static cfg_type_t cfg_type_rrsetorder = {
"rrsetorder", cfg_parse_bracketed_list, cfg_print_bracketed_list, cfg_doc_bracketed_list,
&cfg_rep_list, &cfg_type_rrsetorderingelement
{ "update-check-ksk", &cfg_type_boolean, 0 },
{ "use-alt-transfer-source", &cfg_type_boolean, 0 },
{ "zero-no-soa-ttl", &cfg_type_boolean, 0 },
- { "zone-statistics", &cfg_type_boolean, 0 },
+ { "zone-statistics", &cfg_type_zonestat, 0 },
{ NULL, NULL, 0 }
};