2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-22 10:10: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
once a second. [RT #32909]

View File

@ -79,6 +79,12 @@ stats_dumparg {
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
* 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 *sockstats_desc[isc_sockstatscounter_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 *resstats_xmldesc[dns_resstatscounter_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 sockstats_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)
@ -125,13 +131,13 @@ set_desc(int counter, int maxcounter, const char *fdesc, const char **fdescs,
const char *xdesc, const char **xdescs)
{
REQUIRE(counter < maxcounter);
REQUIRE(fdescs[counter] == NULL);
#ifdef HAVE_LIBXML2
REQUIRE(xdescs[counter] == NULL);
REQUIRE(fdescs != NULL && fdescs[counter] == NULL);
#if defined(EXTENDED_STATS)
REQUIRE(xdescs != NULL && xdescs[counter] == NULL);
#endif
fdescs[counter] = fdesc;
#ifdef HAVE_LIBXML2
#if defined(EXTENDED_STATS)
xdescs[counter] = xdesc;
#else
UNUSED(xdesc);
@ -146,7 +152,7 @@ init_desc(void) {
/* Initialize name server statistics */
for (i = 0; i < dns_nsstatscounter_max; i++)
nsstats_desc[i] = NULL;
#ifdef HAVE_LIBXML2
#if defined(EXTENDED_STATS)
for (i = 0; i < dns_nsstatscounter_max; i++)
nsstats_xmldesc[i] = NULL;
#endif
@ -241,7 +247,7 @@ init_desc(void) {
/* Initialize resolver statistics */
for (i = 0; i < dns_resstatscounter_max; i++)
resstats_desc[i] = NULL;
#ifdef HAVE_LIBXML2
#if defined(EXTENDED_STATS)
for (i = 0; i < dns_resstatscounter_max; i++)
resstats_xmldesc[i] = NULL;
#endif
@ -326,7 +332,7 @@ init_desc(void) {
/* Initialize adb statistics */
for (i = 0; i < dns_adbstats_max; i++)
adbstats_desc[i] = NULL;
#ifdef HAVE_LIBXML2
#if defined(EXTENDED_STATS)
for (i = 0; i < dns_adbstats_max; i++)
adbstats_xmldesc[i] = NULL;
#endif
@ -348,7 +354,7 @@ init_desc(void) {
/* Initialize zone statistics */
for (i = 0; i < dns_zonestatscounter_max; i++)
zonestats_desc[i] = NULL;
#ifdef HAVE_LIBXML2
#if defined(EXTENDED_STATS)
for (i = 0; i < dns_zonestatscounter_max; i++)
zonestats_xmldesc[i] = NULL;
#endif
@ -381,7 +387,7 @@ init_desc(void) {
/* Initialize socket statistics */
for (i = 0; i < isc_sockstatscounter_max; i++)
sockstats_desc[i] = NULL;
#ifdef HAVE_LIBXML2
#if defined(EXTENDED_STATS)
for (i = 0; i < isc_sockstatscounter_max; i++)
sockstats_xmldesc[i] = NULL;
#endif
@ -500,7 +506,7 @@ init_desc(void) {
/* Initialize DNSSEC statistics */
for (i = 0; i < dns_dnssecstats_max; i++)
dnssecstats_desc[i] = NULL;
#ifdef HAVE_LIBXML2
#if defined(EXTENDED_STATS)
for (i = 0; i < dns_dnssecstats_max; i++)
dnssecstats_xmldesc[i] = NULL;
#endif
@ -537,7 +543,7 @@ init_desc(void) {
INSIST(sockstats_desc[i] != NULL);
for (i = 0; i < dns_dnssecstats_max; i++)
INSIST(dnssecstats_desc[i] != NULL);
#ifdef HAVE_LIBXML2
#if defined(EXTENDED_STATS)
for (i = 0; i < dns_nsstatscounter_max; i++)
INSIST(nsstats_xmldesc[i] != NULL);
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;
#endif
#if !defined(HAVE_LIBXML2) && !defined(HAVE_JSON)
#if !defined(EXTENDED_STATS)
UNUSED(category);
#endif
@ -2353,7 +2359,7 @@ ns_statschannels_configure(ns_server_t *server, const cfg_obj_t *config,
* address-in-use error.
*/
if (statschannellist != NULL) {
#if !defined(HAVE_LIBXML2) && !defined(HAVE_JSON)
#ifndef EXTENDED_STATS
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER, ISC_LOG_WARNING,
"statistics-channels specified but not effective "

35
configure vendored
View File

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

View File

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