Commit 52fd57c9 authored by Mark Andrews's avatar Mark Andrews
Browse files

4681. [bug] Log messages from the validator now include the

                        associated view unless the view is "_default/IN"
                        or "_dnsclient/IN". [RT #45770]
parent e85a2c56
4681. [bug] Log messages from the validator now include the
associated view unless the view is "_default/IN"
or "_dnsclient/IN". [RT #45770]
4680. [bug] Fix failing over to another master server address when
nsupdate is used with GSS-API. [RT #45380]
......
......@@ -3320,5 +3320,12 @@ n=`expr $n + 1`
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:check that the view is logged in messages from the validator when using views ($n)"
ret=0
grep "view rec: *validat" ns4/named.run > /dev/null || ret=1
n=`expr $n + 1`
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:exit status: $status"
[ $status -eq 0 ] || exit 1
......@@ -475,6 +475,12 @@
[RT #42793]
</para>
</listitem>
<listitem>
<para>
The view associated with the query is now logged unless it
it is "_default/IN" or "_dnsclient/IN".
</para>
</listitem>
</itemizedlist>
</section>
......
......@@ -110,8 +110,6 @@ struct dns_client {
#define DNS_CLIENTATTR_OWNCTX 0x01
#define DNS_CLIENTVIEW_NAME "dnsclient"
/*%
* Internal state for a single name resolution procedure
*/
......
......@@ -96,6 +96,11 @@ ISC_LANG_BEGINDECLS
/*%< Use TCP transport. */
#define DNS_CLIENTUPDOPT_TCP 0x02
/*%
* View name used in dns_client.
*/
#define DNS_CLIENTVIEW_NAME "_dnsclient"
/*%
* A dns_clientresevent_t is sent when name resolution performed by a client
* completes. 'result' stores the result code of the entire resolution
......
......@@ -16,6 +16,7 @@
#include <isc/task.h>
#include <isc/util.h>
#include <dns/client.h>
#include <dns/db.h>
#include <dns/dnssec.h>
#include <dns/ds.h>
......@@ -3939,12 +3940,31 @@ validator_logv(dns_validator_t *val, isc_logcategory_t *category,
char msgbuf[2048];
static const char spaces[] = " *";
int depth = val->depth * 2;
const char *viewname, *sep1, *sep2;
vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap);
if ((unsigned int) depth >= sizeof spaces)
depth = sizeof spaces - 1;
/*
* Log the view name unless it's:
* * "_default/IN" (which means there's only one view
* configured in the server), or
* * "_dnsclient/IN" (which means this is being called
* from an application using dns/client.c).
*/
if (val->view->rdclass == dns_rdataclass_in &&
(strcmp(val->view->name, "_default") == 0 ||
strcmp(val->view->name, DNS_CLIENTVIEW_NAME) == 0))
{
sep1 = viewname = sep2 = "";
} else {
sep1 = "view ";
viewname = val->view->name;
sep2 = ": ";
}
if (val->event != NULL && val->event->name != NULL) {
char namebuf[DNS_NAME_FORMATSIZE];
char typebuf[DNS_RDATATYPE_FORMATSIZE];
......@@ -3953,12 +3973,14 @@ validator_logv(dns_validator_t *val, isc_logcategory_t *category,
dns_rdatatype_format(val->event->type, typebuf,
sizeof(typebuf));
isc_log_write(dns_lctx, category, module, level,
"%.*svalidating %s/%s: %s", depth, spaces,
"%s%s%s%.*svalidating %s/%s: %s",
sep1, viewname, sep2, depth, spaces,
namebuf, typebuf, msgbuf);
} else {
isc_log_write(dns_lctx, category, module, level,
"%.*svalidator @%p: %s", depth, spaces,
val, msgbuf);
"%s%s%s%.*svalidator @%p: %s",
sep1, viewname, sep2, depth, spaces,
val, msgbuf);
}
}
......
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