diff --git a/lib/dns/probes.d b/lib/dns/probes.d index d2c87748c0..2d9f2c3d62 100644 --- a/lib/dns/probes.d +++ b/lib/dns/probes.d @@ -12,21 +12,21 @@ */ provider libdns { - probe xfrin_axfr_finalize_begin(void *); - probe xfrin_axfr_finalize_end(void *, int); - probe xfrin_connected(void *, int); - probe xfrin_done_callback_begin(void *, int); - probe xfrin_done_callback_end(void *, int); - probe xfrin_journal_destroy_begin(void *, int); - probe xfrin_journal_destroy_end(void *, int); - probe xfrin_read(void *, int); - probe xfrin_recv_answer(void *, void *); - probe xfrin_recv_done(void *, int); - probe xfrin_recv_parsed(void *, int); - probe xfrin_recv_question(void *, void *); - probe xfrin_recv_send_request(void *); - probe xfrin_recv_start(void *, int); - probe xfrin_recv_try_axfr(void *, int); - probe xfrin_sent(void *, int); - probe xfrin_start(void *); + probe xfrin_axfr_finalize_begin(void *, char *); + probe xfrin_axfr_finalize_end(void *, char *, int); + probe xfrin_connected(void *, char *, int); + probe xfrin_done_callback_begin(void *, char *, int); + probe xfrin_done_callback_end(void *, char *, int); + probe xfrin_journal_destroy_begin(void *, char *, int); + probe xfrin_journal_destroy_end(void *, char *, int); + probe xfrin_read(void *, char *, int); + probe xfrin_recv_answer(void *, char *, void *); + probe xfrin_recv_done(void *, char *, int); + probe xfrin_recv_parsed(void *, char *, int); + probe xfrin_recv_question(void *, char *, void *); + probe xfrin_recv_send_request(void *, char *); + probe xfrin_recv_start(void *, char *, int); + probe xfrin_recv_try_axfr(void *, char *, int); + probe xfrin_sent(void *, char *, int); + probe xfrin_start(void *, char *); }; diff --git a/lib/ns/probes.d b/lib/ns/probes.d index 316ca37a1f..fccb6185cb 100644 --- a/lib/ns/probes.d +++ b/lib/ns/probes.d @@ -12,4 +12,5 @@ */ provider libns { + probe rrl_drop(const char *, const char *, const char *, int); }; diff --git a/lib/ns/query.c b/lib/ns/query.c index e2e00b28c6..8edfc9814c 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -73,6 +73,8 @@ #include #include +#include "probes.h" + #if 0 /* * It has been recommended that DNS64 be changed to return excluded @@ -7051,6 +7053,25 @@ ns__query_sfcache(query_ctx_t *qctx) { return (ISC_R_COMPLETE); } +static void +query_trace_rrldrop(query_ctx_t *qctx, + dns_rrl_result_t rrl_result ISC_ATTR_UNUSED) { + if (!LIBNS_RRL_DROP_ENABLED()) { + return; + } + + char peerbuf[ISC_SOCKADDR_FORMATSIZE]; + isc_netaddr_t peer; + isc_netaddr_fromsockaddr(&peer, &qctx->client->peeraddr); + isc_netaddr_format(&peer, peerbuf, sizeof(peerbuf)); + + char qnamebuf[DNS_NAME_FORMATSIZE]; + char fnamebuf[DNS_NAME_FORMATSIZE]; + dns_name_format(qctx->client->query.qname, qnamebuf, sizeof(qnamebuf)); + dns_name_format(qctx->fname, fnamebuf, sizeof(fnamebuf)); + LIBNS_RRL_DROP(peerbuf, qnamebuf, fnamebuf, rrl_result); +} + /*% * Handle response rate limiting (RRL). */ @@ -7184,6 +7205,12 @@ query_checkrrl(query_ctx_t *qctx, isc_result_t result) { DNS_RRL_LOG_DROP, "%s", log_buf); } + /* + * If tracing is enabled, format some extra information + * to pass along. + */ + query_trace_rrldrop(qctx, rrl_result); + if (!qctx->view->rrl->log_only) { if (rrl_result == DNS_RRL_RESULT_DROP) { /*