Commit 33399d6a authored by Mark Andrews's avatar Mark Andrews
Browse files

3888. [func] 'rndc status' now reports the number of automatic

                        zones. [RT #36015]
parent 65eba0a5
3888. [func] 'rndc status' now reports the number of automatic
zones. [RT #36015]
3887. [cleanup] Make all static symbols in rbtdb64 end in "64" so
they are easier to use in a debugger. [RT #36373]
......
......@@ -2259,6 +2259,7 @@ create_empty_zone(dns_zone_t *zone, dns_name_t *name, dns_view_t *view,
dns_zone_setoption(zone, DNS_ZONEOPT_NOCHECKNS, ISC_TRUE);
dns_zone_setnotifytype(zone, dns_notifytype_no);
dns_zone_setdialup(zone, dns_dialuptype_no);
dns_zone_setautomatic(zone, ISC_TRUE);
if (view->queryacl)
dns_zone_setqueryacl(zone, view->queryacl);
else
......@@ -8227,7 +8228,8 @@ ns_server_flushnode(ns_server_t *server, char *args, isc_boolean_t tree) {
isc_result_t
ns_server_status(ns_server_t *server, isc_buffer_t *text) {
int zonecount, xferrunning, xferdeferred, soaqueries;
unsigned int zonecount, xferrunning, xferdeferred, soaqueries;
unsigned int automatic;
unsigned int n;
const char *ob = "", *cb = "", *alt = "";
char boottime[80], configtime[80];
......@@ -8247,6 +8249,8 @@ ns_server_status(ns_server_t *server, isc_buffer_t *text) {
DNS_ZONESTATE_XFERDEFERRED);
soaqueries = dns_zonemgr_getcount(server->zonemgr,
DNS_ZONESTATE_SOAQUERY);
automatic = dns_zonemgr_getcount(server->zonemgr,
DNS_ZONESTATE_AUTOMATIC);
isc_time_formathttptimestamp(&ns_g_boottime, boottime,
sizeof(boottime));
......@@ -8263,7 +8267,7 @@ ns_server_status(ns_server_t *server, isc_buffer_t *text) {
"worker threads: %u\n"
"UDP listeners per interface: %u\n"
#endif
"number of zones: %u\n"
"number of zones: %u (%u automatic)\n"
"debug level: %d\n"
"xfers running: %u\n"
"xfers deferred: %u\n"
......@@ -8277,8 +8281,9 @@ ns_server_status(ns_server_t *server, isc_buffer_t *text) {
#ifdef ISC_PLATFORM_USETHREADS
ns_g_cpus_detected, ns_g_cpus, ns_g_udpdisp,
#endif
zonecount, ns_g_debuglevel, xferrunning, xferdeferred,
soaqueries, server->log_queries ? "ON" : "OFF",
zonecount, automatic, ns_g_debuglevel, xferrunning,
xferdeferred, soaqueries,
server->log_queries ? "ON" : "OFF",
server->recursionquota.used, server->recursionquota.soft,
server->recursionquota.max,
server->tcpquota.used, server->tcpquota.max);
......
......@@ -21,3 +21,4 @@ rm -f ns3/named_dump.db
rm -f ns*/named.memstats
rm -f ns*/named.run
rm -f ns4/*.conf
rm -f rndc.status
......@@ -23,6 +23,6 @@ options {
pid-file "named.pid";
listen-on { 10.53.0.4; };
listen-on-v6 { none; };
recursion no;
recursion yes;
};
......@@ -341,5 +341,12 @@ done
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:testing automatic zones are reported"
ret=0
$RNDC -s 10.53.0.4 -p 9956 -c ns4/key6.conf status > rndc.status || ret=1
grep "number of zones: 98 (97 automatic)" rndc.status > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:exit status: $status"
exit $status
......@@ -135,6 +135,7 @@ typedef enum {
#define DNS_ZONESTATE_XFERDEFERRED 2
#define DNS_ZONESTATE_SOAQUERY 3
#define DNS_ZONESTATE_ANY 4
#define DNS_ZONESTATE_AUTOMATIC 5
ISC_LANG_BEGINDECLS
......@@ -2128,6 +2129,25 @@ dns_zone_getadded(dns_zone_t *zone);
* \li 'zone' to be valid.
*/
void
dns_zone_setautomatic(dns_zone_t *zone, isc_boolean_t automatic);
/*%
* Sets the value of zone->automatic, which should be ISC_TRUE for
* zones that were automatically added by named.
*
* Requires:
* \li 'zone' to be valid.
*/
isc_boolean_t
dns_zone_getautomatic(dns_zone_t *zone);
/*%
* Returns ISC_TRUE if the zone was added automatically by named.
*
* Requires:
* \li 'zone' to be valid.
*/
isc_result_t
dns_zone_dlzpostload(dns_zone_t *zone, dns_db_t *db);
/*%
......
......@@ -893,6 +893,7 @@ dns_zone_get_rpz_num
dns_zone_getadded
dns_zone_getaltxfrsource4dscp
dns_zone_getaltxfrsource6dscp
dns_zone_getautomatic
dns_zone_getchecknames
dns_zone_getclass
dns_zone_getdb
......@@ -978,6 +979,7 @@ dns_zone_setaltxfrsource4
dns_zone_setaltxfrsource4dscp
dns_zone_setaltxfrsource6
dns_zone_setaltxfrsource6dscp
dns_zone_setautomatic
dns_zone_setcheckmx
dns_zone_setchecknames
dns_zone_setcheckns
......
......@@ -371,6 +371,11 @@ struct dns_zone {
*/
isc_boolean_t added;
/*%
* True if added by automatically by named.
*/
isc_boolean_t automatic;
/*%
* response policy data to be relayed to the database
*/
......@@ -986,6 +991,7 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) {
zone->nodes = 100;
zone->privatetype = (dns_rdatatype_t)0xffffU;
zone->added = ISC_FALSE;
zone->automatic = ISC_FALSE;
zone->rpzs = NULL;
zone->rpz_num = DNS_RPZ_INVALID_NUM;
ISC_LIST_INIT(zone->forwards);
......@@ -16192,6 +16198,17 @@ dns_zonemgr_getcount(dns_zonemgr_t *zmgr, int state) {
count++;
}
break;
case DNS_ZONESTATE_AUTOMATIC:
for (zone = ISC_LIST_HEAD(zmgr->zones);
zone != NULL;
zone = ISC_LIST_NEXT(zone, link)) {
dns_view_t *view = zone->view;
if (view != NULL && strcmp(view->name, "_bind") == 0)
continue;
if (zone->automatic)
count++;
}
break;
default:
INSIST(0);
}
......@@ -17198,6 +17215,21 @@ dns_zone_nscheck(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version,
return (result);
}
void
dns_zone_setautomatic(dns_zone_t *zone, isc_boolean_t automatic) {
REQUIRE(DNS_ZONE_VALID(zone));
LOCK_ZONE(zone);
zone->automatic = automatic;
UNLOCK_ZONE(zone);
}
isc_boolean_t
dns_zone_getautomatic(dns_zone_t *zone) {
REQUIRE(DNS_ZONE_VALID(zone));
return (zone->automatic);
}
void
dns_zone_setadded(dns_zone_t *zone, isc_boolean_t added) {
REQUIRE(DNS_ZONE_VALID(zone));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment