2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-28 13:08:06 +00:00

3856. [bug] Configuring libjson without also configuring libxml

resulting in a REQUIRE assertion when retrieving
                        statistics using json. [RT #36009]
This commit is contained in:
Mark Andrews 2014-05-21 12:06:00 +10:00
parent 0fe0789181
commit a0f91e910b
4 changed files with 73 additions and 36 deletions

View File

@ -1,3 +1,7 @@
3856. [bug] Configuring libjson without also configuring libxml
resulting in a REQUIRE assertion when retrieving
statistics using json. [RT #36009]
3855. [bug] Limit smoothed round trip time aging to no more than 3855. [bug] Limit smoothed round trip time aging to no more than
once a second. [RT #32909] once a second. [RT #32909]

View File

@ -79,6 +79,12 @@ stats_dumparg {
static isc_once_t once = ISC_ONCE_INIT; static isc_once_t once = ISC_ONCE_INIT;
#if defined(HAVE_LIBXML2) || defined(HAVE_JSON)
#define EXTENDED_STATS
#else
#undef EXTENDED_STATS
#endif
/*% /*%
* Statistics descriptions. These could be statistically initialized at * Statistics descriptions. These could be statistically initialized at
* compile time, but we configure them run time in the init_desc() function * compile time, but we configure them run time in the init_desc() function
@ -90,7 +96,7 @@ static const char *adbstats_desc[dns_adbstats_max];
static const char *zonestats_desc[dns_zonestatscounter_max]; static const char *zonestats_desc[dns_zonestatscounter_max];
static const char *sockstats_desc[isc_sockstatscounter_max]; static const char *sockstats_desc[isc_sockstatscounter_max];
static const char *dnssecstats_desc[dns_dnssecstats_max]; static const char *dnssecstats_desc[dns_dnssecstats_max];
#ifdef HAVE_LIBXML2 #if defined(EXTENDED_STATS)
static const char *nsstats_xmldesc[dns_nsstatscounter_max]; static const char *nsstats_xmldesc[dns_nsstatscounter_max];
static const char *resstats_xmldesc[dns_resstatscounter_max]; static const char *resstats_xmldesc[dns_resstatscounter_max];
static const char *adbstats_xmldesc[dns_adbstats_max]; static const char *adbstats_xmldesc[dns_adbstats_max];
@ -104,7 +110,7 @@ static const char *dnssecstats_xmldesc[dns_dnssecstats_max];
#define zonestats_xmldesc NULL #define zonestats_xmldesc NULL
#define sockstats_xmldesc NULL #define sockstats_xmldesc NULL
#define dnssecstats_xmldesc NULL #define dnssecstats_xmldesc NULL
#endif /* HAVE_LIBXML2 */ #endif /* EXTENDED_STATS */
#define TRY0(a) do { xmlrc = (a); if (xmlrc < 0) goto error; } while(0) #define TRY0(a) do { xmlrc = (a); if (xmlrc < 0) goto error; } while(0)
@ -125,13 +131,13 @@ set_desc(int counter, int maxcounter, const char *fdesc, const char **fdescs,
const char *xdesc, const char **xdescs) const char *xdesc, const char **xdescs)
{ {
REQUIRE(counter < maxcounter); REQUIRE(counter < maxcounter);
REQUIRE(fdescs[counter] == NULL); REQUIRE(fdescs != NULL && fdescs[counter] == NULL);
#ifdef HAVE_LIBXML2 #if defined(EXTENDED_STATS)
REQUIRE(xdescs[counter] == NULL); REQUIRE(xdescs != NULL && xdescs[counter] == NULL);
#endif #endif
fdescs[counter] = fdesc; fdescs[counter] = fdesc;
#ifdef HAVE_LIBXML2 #if defined(EXTENDED_STATS)
xdescs[counter] = xdesc; xdescs[counter] = xdesc;
#else #else
UNUSED(xdesc); UNUSED(xdesc);
@ -146,7 +152,7 @@ init_desc(void) {
/* Initialize name server statistics */ /* Initialize name server statistics */
for (i = 0; i < dns_nsstatscounter_max; i++) for (i = 0; i < dns_nsstatscounter_max; i++)
nsstats_desc[i] = NULL; nsstats_desc[i] = NULL;
#ifdef HAVE_LIBXML2 #if defined(EXTENDED_STATS)
for (i = 0; i < dns_nsstatscounter_max; i++) for (i = 0; i < dns_nsstatscounter_max; i++)
nsstats_xmldesc[i] = NULL; nsstats_xmldesc[i] = NULL;
#endif #endif
@ -241,7 +247,7 @@ init_desc(void) {
/* Initialize resolver statistics */ /* Initialize resolver statistics */
for (i = 0; i < dns_resstatscounter_max; i++) for (i = 0; i < dns_resstatscounter_max; i++)
resstats_desc[i] = NULL; resstats_desc[i] = NULL;
#ifdef HAVE_LIBXML2 #if defined(EXTENDED_STATS)
for (i = 0; i < dns_resstatscounter_max; i++) for (i = 0; i < dns_resstatscounter_max; i++)
resstats_xmldesc[i] = NULL; resstats_xmldesc[i] = NULL;
#endif #endif
@ -326,7 +332,7 @@ init_desc(void) {
/* Initialize adb statistics */ /* Initialize adb statistics */
for (i = 0; i < dns_adbstats_max; i++) for (i = 0; i < dns_adbstats_max; i++)
adbstats_desc[i] = NULL; adbstats_desc[i] = NULL;
#ifdef HAVE_LIBXML2 #if defined(EXTENDED_STATS)
for (i = 0; i < dns_adbstats_max; i++) for (i = 0; i < dns_adbstats_max; i++)
adbstats_xmldesc[i] = NULL; adbstats_xmldesc[i] = NULL;
#endif #endif
@ -348,7 +354,7 @@ init_desc(void) {
/* Initialize zone statistics */ /* Initialize zone statistics */
for (i = 0; i < dns_zonestatscounter_max; i++) for (i = 0; i < dns_zonestatscounter_max; i++)
zonestats_desc[i] = NULL; zonestats_desc[i] = NULL;
#ifdef HAVE_LIBXML2 #if defined(EXTENDED_STATS)
for (i = 0; i < dns_zonestatscounter_max; i++) for (i = 0; i < dns_zonestatscounter_max; i++)
zonestats_xmldesc[i] = NULL; zonestats_xmldesc[i] = NULL;
#endif #endif
@ -381,7 +387,7 @@ init_desc(void) {
/* Initialize socket statistics */ /* Initialize socket statistics */
for (i = 0; i < isc_sockstatscounter_max; i++) for (i = 0; i < isc_sockstatscounter_max; i++)
sockstats_desc[i] = NULL; sockstats_desc[i] = NULL;
#ifdef HAVE_LIBXML2 #if defined(EXTENDED_STATS)
for (i = 0; i < isc_sockstatscounter_max; i++) for (i = 0; i < isc_sockstatscounter_max; i++)
sockstats_xmldesc[i] = NULL; sockstats_xmldesc[i] = NULL;
#endif #endif
@ -500,7 +506,7 @@ init_desc(void) {
/* Initialize DNSSEC statistics */ /* Initialize DNSSEC statistics */
for (i = 0; i < dns_dnssecstats_max; i++) for (i = 0; i < dns_dnssecstats_max; i++)
dnssecstats_desc[i] = NULL; dnssecstats_desc[i] = NULL;
#ifdef HAVE_LIBXML2 #if defined(EXTENDED_STATS)
for (i = 0; i < dns_dnssecstats_max; i++) for (i = 0; i < dns_dnssecstats_max; i++)
dnssecstats_xmldesc[i] = NULL; dnssecstats_xmldesc[i] = NULL;
#endif #endif
@ -537,7 +543,7 @@ init_desc(void) {
INSIST(sockstats_desc[i] != NULL); INSIST(sockstats_desc[i] != NULL);
for (i = 0; i < dns_dnssecstats_max; i++) for (i = 0; i < dns_dnssecstats_max; i++)
INSIST(dnssecstats_desc[i] != NULL); INSIST(dnssecstats_desc[i] != NULL);
#ifdef HAVE_LIBXML2 #if defined(EXTENDED_STATS)
for (i = 0; i < dns_nsstatscounter_max; i++) for (i = 0; i < dns_nsstatscounter_max; i++)
INSIST(nsstats_xmldesc[i] != NULL); INSIST(nsstats_xmldesc[i] != NULL);
for (i = 0; i < dns_resstatscounter_max; i++) for (i = 0; i < dns_resstatscounter_max; i++)
@ -581,7 +587,7 @@ dump_counters(isc_stats_t *stats, isc_statsformat_t type, void *arg,
json_object *job, *cat, *counter; json_object *job, *cat, *counter;
#endif #endif
#if !defined(HAVE_LIBXML2) && !defined(HAVE_JSON) #if !defined(EXTENDED_STATS)
UNUSED(category); UNUSED(category);
#endif #endif
@ -2353,7 +2359,7 @@ ns_statschannels_configure(ns_server_t *server, const cfg_obj_t *config,
* address-in-use error. * address-in-use error.
*/ */
if (statschannellist != NULL) { if (statschannellist != NULL) {
#if !defined(HAVE_LIBXML2) && !defined(HAVE_JSON) #ifndef EXTENDED_STATS
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER, ISC_LOG_WARNING, NS_LOGMODULE_SERVER, ISC_LOG_WARNING,
"statistics-channels specified but not effective " "statistics-channels specified but not effective "

35
configure vendored
View File

@ -16480,15 +16480,26 @@ case "$use_libjson" in
libjson_libs="" libjson_libs=""
;; ;;
auto|yes) auto|yes)
if test -f "/usr/include/json/json.h" for d in /usr /usr/local /opt/local
then do
libjson_cflags="-I /usr/include/json" if test -f "${d}/include/json/json.h"
have_libjson="yes" then
elif test -f "/usr/include/json-c/json.h" libjson_cflags="-I ${d}/include/json"
then if test ${d} != /usr
libjson_cflags="-I /usr/include/json-c" then
have_libjson="yes" LIBS="$LIBS -L${d}/lib"
fi fi
have_libjson="yes"
elif test -f "${d}/include/json-c/json.h"
then
libjson_cflags="-I ${d}/include/json-c"
if test ${d} != /usr
then
LIBS="$LIBS -L${d}/lib"
fi
have_libjson="yes"
fi
done
;; ;;
*) *)
if test -f "${use_libjson}/include/json/json.h" if test -f "${use_libjson}/include/json/json.h"
@ -16566,11 +16577,13 @@ if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: found libjson include but not library." >&5 as_fn_error $? "found libjson include but not library." "$LINENO" 5
$as_echo "$as_me: WARNING: found libjson include but not library." >&2;}
have_libjson="" have_libjson=""
fi fi
elif test "X$use_libjson" = Xyes
then
as_fn_error $? "include/json{,-c}/json.h not found." "$LINENO" 5
else else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; } $as_echo "no" >&6; }

View File

@ -2104,15 +2104,26 @@ case "$use_libjson" in
libjson_libs="" libjson_libs=""
;; ;;
auto|yes) auto|yes)
if test -f "/usr/include/json/json.h" for d in /usr /usr/local /opt/local
then do
libjson_cflags="-I /usr/include/json" if test -f "${d}/include/json/json.h"
have_libjson="yes" then
elif test -f "/usr/include/json-c/json.h" libjson_cflags="-I ${d}/include/json"
then if test ${d} != /usr
libjson_cflags="-I /usr/include/json-c" then
have_libjson="yes" LIBS="$LIBS -L${d}/lib"
fi fi
have_libjson="yes"
elif test -f "${d}/include/json-c/json.h"
then
libjson_cflags="-I ${d}/include/json-c"
if test ${d} != /usr
then
LIBS="$LIBS -L${d}/lib"
fi
have_libjson="yes"
fi
done
;; ;;
*) *)
if test -f "${use_libjson}/include/json/json.h" if test -f "${use_libjson}/include/json/json.h"
@ -2135,8 +2146,11 @@ if test "X${have_libjson}" != "X"
then then
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_SEARCH_LIBS([json_object_new_int64], [json json-c], [], AC_SEARCH_LIBS([json_object_new_int64], [json json-c], [],
[AC_MSG_WARN([found libjson include but not library.]) [AC_MSG_ERROR([found libjson include but not library.])
have_libjson=""]) have_libjson=""])
elif test "X$use_libjson" = Xyes
then
AC_MSG_ERROR([include/json{,-c}/json.h not found.])
else else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi fi