Commit 8b9230aa authored by Mark Andrews's avatar Mark Andrews

also log the error path

parent 6e85ad84
Pipeline #46822 failed with stages
in 78 minutes and 43 seconds
......@@ -521,7 +521,7 @@ inc_stats(ns_client_t *client, isc_statscounter_t counter) {
}
static inline void
log_response(ns_client_t *client) {
log_response(ns_client_t *client, dns_rcode_t rcode) {
char namebuf[DNS_NAME_FORMATSIZE];
char typebuf[DNS_RDATATYPE_FORMATSIZE];
char classbuf[DNS_RDATACLASS_FORMATSIZE];
......@@ -537,7 +537,7 @@ log_response(ns_client_t *client) {
sizeof(classbuf));
dns_rdatatype_format(client->query.qtype, typebuf, sizeof(typebuf));
isc_buffer_init(&b, rcodebuf, sizeof(rcodebuf));
dns_rcode_totext(client->message->rcode, &b);
dns_rcode_totext(rcode, &b);
ns_client_log(client, NS_LOGCATEGORY_QUERIES, NS_LOGMODULE_QUERY, level,
"response: %s %s %s %.*s", namebuf, classbuf, typebuf,
......@@ -574,7 +574,7 @@ query_send(ns_client_t *client) {
}
if ((client->sctx->options & NS_SERVER_LOGRESPONSES) != 0) {
log_response(client);
log_response(client, client->message->rcode);
}
inc_stats(client, counter);
......@@ -585,8 +585,10 @@ query_send(ns_client_t *client) {
static void
query_error(ns_client_t *client, isc_result_t result, int line) {
int loglevel = ISC_LOG_DEBUG(3);
dns_rcode_t rcode;
switch (dns_result_torcode(result)) {
rcode = dns_result_torcode(result);
switch (rcode) {
case dns_rcode_servfail:
loglevel = ISC_LOG_DEBUG(1);
inc_stats(client, ns_statscounter_servfail);
......@@ -605,6 +607,12 @@ query_error(ns_client_t *client, isc_result_t result, int line) {
log_queryerror(client, result, line, loglevel);
if (client->query.origqname != NULL &&
(client->sctx->options & NS_SERVER_LOGRESPONSES) != 0)
{
log_response(client, rcode);
}
ns_client_error(client, result);
isc_nmhandle_unref(client->handle);
}
......
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