]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] include serial number in JSON zone stats
authorEvan Hunt <each@isc.org>
Thu, 26 Feb 2015 00:55:25 +0000 (16:55 -0800)
committerEvan Hunt <each@isc.org>
Thu, 26 Feb 2015 00:55:25 +0000 (16:55 -0800)
4068. [bug] Serial number was omitted from JSON zone statistics.
[RT #38604]

CHANGES
bin/named/statschannel.c

diff --git a/CHANGES b/CHANGES
index 30291a8b2ce7d3fcfc4e56bdcf3cee0a971cfea1..73eed4f47e98fd19656698a7601d9560fda71598 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4068.  [bug]           Serial number was omitted from JSON zone statistics.
+                       [RT #38604]
+
 4067.  [cleanup]       Reduce noise from RRL when query logging is
                        disabled. [RT #38648]
 
index f0584c3ac8308a026e4c1636692adb4350c7a15e..ed213017863f2e4991cbd715778a9e511040cefd 100644 (file)
@@ -14,8 +14,6 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: statschannel.c,v 1.28.224.1 2011/12/22 07:48:27 marka Exp $ */
-
 /*! \file */
 
 #include <config.h>
@@ -1437,7 +1435,9 @@ wrap_jsonfree(isc_buffer_t *buffer, void *arg) {
 }
 
 static json_object *
-addzone(char *name, char *class, isc_uint32_t serial) {
+addzone(char *name, char *class, isc_uint32_t serial,
+       isc_boolean_t add_serial)
+{
        json_object *node = json_object_new_object();
 
        if (node == NULL)
@@ -1445,7 +1445,9 @@ addzone(char *name, char *class, isc_uint32_t serial) {
 
        json_object_object_add(node, "name", json_object_new_string(name));
        json_object_object_add(node, "class", json_object_new_string(class));
-       json_object_object_add(node, "serial", json_object_new_int64(serial));
+       if (add_serial)
+               json_object_object_add(node, "serial",
+                                      json_object_new_int64(serial));
        return (node);
 }
 
@@ -1479,9 +1481,10 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
        class_only = class;
 
        if (dns_zone_getserial2(zone, &serial) != ISC_R_SUCCESS)
-               serial = -1;
+               zoneobj = addzone(zone_name_only, class_only, 0, ISC_FALSE);
+       else
+               zoneobj = addzone(zone_name_only, class_only, serial, ISC_TRUE);
 
-       zoneobj = addzone(zone_name_only, class_only, serial);
        if (zoneobj == NULL)
                return (ISC_R_NOMEMORY);
 
@@ -1569,7 +1572,7 @@ generatejson(ns_server_t *server, size_t *msglen,
        /*
         * These statistics are included no matter which URL we use.
         */
-       obj = json_object_new_string("1.0");
+       obj = json_object_new_string("1.1");
        CHECKMEM(obj);
        json_object_object_add(bindstats, "json-stats-version", obj);