mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
add separate query counters for new protocols
Add query counters for DoT, DoH, unencrypted DoH and their proxied counterparts. The protocols don't increment TCP/UDP counters anymore since they aren't the same as plain DNS-over-53.
This commit is contained in:
parent
44de1d5bef
commit
d987e2d745
@ -339,6 +339,21 @@ init_desc(void) {
|
|||||||
"RPZRewrites");
|
"RPZRewrites");
|
||||||
SET_NSSTATDESC(udp, "UDP queries received", "QryUDP");
|
SET_NSSTATDESC(udp, "UDP queries received", "QryUDP");
|
||||||
SET_NSSTATDESC(tcp, "TCP queries received", "QryTCP");
|
SET_NSSTATDESC(tcp, "TCP queries received", "QryTCP");
|
||||||
|
SET_NSSTATDESC(dot, "DoT queries received", "QryDoT");
|
||||||
|
SET_NSSTATDESC(doh, "DoH queries received", "QryDoH");
|
||||||
|
SET_NSSTATDESC(dohplain, "DoH-Plain queries received", "QryDoHPlain");
|
||||||
|
SET_NSSTATDESC(proxyudp, "PROXYv2 UDP queries received", "QryProxyUDP");
|
||||||
|
SET_NSSTATDESC(proxytcp, "PROXYv2 TCP queries received", "QryProxyTCP");
|
||||||
|
SET_NSSTATDESC(proxydot, "PROXYv2 DoT queries received", "QryProxyDoT");
|
||||||
|
SET_NSSTATDESC(proxydoh, "PROXYv2 DoH queries received", "QryProxyDoH");
|
||||||
|
SET_NSSTATDESC(proxydohplain, "PROXYv2/DoH-Plain queries received",
|
||||||
|
"QryProxyDoHPlain");
|
||||||
|
SET_NSSTATDESC(encryptedproxydot,
|
||||||
|
"Encrypted PROXYv2 DoT queries received",
|
||||||
|
"QryEncryptedProxyDoT");
|
||||||
|
SET_NSSTATDESC(encryptedproxydoh,
|
||||||
|
"Encrypted PROXYv2 DoH queries received",
|
||||||
|
"QryEncryptedProxyDoH");
|
||||||
SET_NSSTATDESC(nsidopt, "NSID option received", "NSIDOpt");
|
SET_NSSTATDESC(nsidopt, "NSID option received", "NSIDOpt");
|
||||||
SET_NSSTATDESC(expireopt, "Expire option received", "ExpireOpt");
|
SET_NSSTATDESC(expireopt, "Expire option received", "ExpireOpt");
|
||||||
SET_NSSTATDESC(keepaliveopt, "EDNS TCP keepalive option received",
|
SET_NSSTATDESC(keepaliveopt, "EDNS TCP keepalive option received",
|
||||||
|
@ -657,6 +657,12 @@ isc_nm_is_proxy_handle(isc_nmhandle_t *handle);
|
|||||||
* connection.
|
* connection.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
isc_nm_proxy_type_t
|
||||||
|
isc_nmhandle_proxy_type(isc_nmhandle_t *handle);
|
||||||
|
/*%<
|
||||||
|
* Returns the PROXYv2 type associated with 'handle'.
|
||||||
|
*/
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
isc_nm_listentls(isc_nm_t *mgr, uint32_t workers, isc_sockaddr_t *iface,
|
isc_nm_listentls(isc_nm_t *mgr, uint32_t workers, isc_sockaddr_t *iface,
|
||||||
isc_nm_accept_cb_t accept_cb, void *accept_cbarg, int backlog,
|
isc_nm_accept_cb_t accept_cb, void *accept_cbarg, int backlog,
|
||||||
|
@ -2397,6 +2397,26 @@ isc_nm_socket_type(const isc_nmhandle_t *handle) {
|
|||||||
return handle->sock->type;
|
return handle->sock->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isc_nm_proxy_type_t
|
||||||
|
isc_nmhandle_proxy_type(isc_nmhandle_t *handle) {
|
||||||
|
isc_nmhandle_t *proxyhandle;
|
||||||
|
|
||||||
|
REQUIRE(VALID_NMHANDLE(handle));
|
||||||
|
REQUIRE(VALID_NMSOCK(handle->sock));
|
||||||
|
|
||||||
|
proxyhandle = get_proxy_handle(handle);
|
||||||
|
|
||||||
|
if (proxyhandle == NULL) {
|
||||||
|
return ISC_NM_PROXY_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isc_nm_has_encryption(proxyhandle)) {
|
||||||
|
return ISC_NM_PROXY_ENCRYPTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ISC_NM_PROXY_PLAIN;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isc_nm_has_encryption(const isc_nmhandle_t *handle) {
|
isc_nm_has_encryption(const isc_nmhandle_t *handle) {
|
||||||
REQUIRE(VALID_NMHANDLE(handle));
|
REQUIRE(VALID_NMHANDLE(handle));
|
||||||
|
@ -114,7 +114,19 @@ enum {
|
|||||||
|
|
||||||
ns_statscounter_recurshighwater = 68,
|
ns_statscounter_recurshighwater = 68,
|
||||||
|
|
||||||
ns_statscounter_max = 69,
|
ns_statscounter_dot = 69,
|
||||||
|
ns_statscounter_doh = 70,
|
||||||
|
ns_statscounter_dohplain = 71,
|
||||||
|
|
||||||
|
ns_statscounter_proxyudp = 72,
|
||||||
|
ns_statscounter_proxytcp = 73,
|
||||||
|
ns_statscounter_proxydot = 74,
|
||||||
|
ns_statscounter_proxydoh = 75,
|
||||||
|
ns_statscounter_proxydohplain = 76,
|
||||||
|
ns_statscounter_encryptedproxydot = 77,
|
||||||
|
ns_statscounter_encryptedproxydoh = 78,
|
||||||
|
|
||||||
|
ns_statscounter_max = 79,
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -5622,11 +5622,84 @@ ns__query_start(query_ctx_t *qctx) {
|
|||||||
}
|
}
|
||||||
qctx->client->query.authdbset = true;
|
qctx->client->query.authdbset = true;
|
||||||
|
|
||||||
/* Track TCP vs UDP stats per zone */
|
isc_nmhandle_t *handle = qctx->client->handle;
|
||||||
if (TCP(qctx->client)) {
|
|
||||||
inc_stats(qctx->client, ns_statscounter_tcp);
|
/* Track protocol stats per zone */
|
||||||
|
switch (isc_nm_socket_type(handle)) {
|
||||||
|
case isc_nm_httpsocket:
|
||||||
|
switch (isc_nmhandle_proxy_type(handle)) {
|
||||||
|
case ISC_NM_PROXY_ENCRYPTED:
|
||||||
|
/* Encrypted PROXYv2 cannot carry plain DoH */
|
||||||
|
INSIST(isc_nm_has_encryption(handle));
|
||||||
|
inc_stats(qctx->client,
|
||||||
|
ns_statscounter_encryptedproxydoh);
|
||||||
|
break;
|
||||||
|
case ISC_NM_PROXY_PLAIN:
|
||||||
|
if (isc_nm_has_encryption(handle)) {
|
||||||
|
inc_stats(qctx->client,
|
||||||
|
ns_statscounter_proxydoh);
|
||||||
} else {
|
} else {
|
||||||
|
inc_stats(
|
||||||
|
qctx->client,
|
||||||
|
ns_statscounter_proxydohplain);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ISC_NM_PROXY_NONE:
|
||||||
|
if (isc_nm_has_encryption(handle)) {
|
||||||
|
inc_stats(qctx->client,
|
||||||
|
ns_statscounter_doh);
|
||||||
|
} else {
|
||||||
|
inc_stats(qctx->client,
|
||||||
|
ns_statscounter_dohplain);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case isc_nm_streamdnssocket:
|
||||||
|
switch (isc_nmhandle_proxy_type(handle)) {
|
||||||
|
case ISC_NM_PROXY_ENCRYPTED:
|
||||||
|
inc_stats(qctx->client,
|
||||||
|
ns_statscounter_encryptedproxydot);
|
||||||
|
break;
|
||||||
|
case ISC_NM_PROXY_PLAIN:
|
||||||
|
if (isc_nm_has_encryption(handle)) {
|
||||||
|
inc_stats(qctx->client,
|
||||||
|
ns_statscounter_proxydot);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* If the StreamDNS socket doesn't have
|
||||||
|
* encryption, it has to be plain TCP
|
||||||
|
* DNS.
|
||||||
|
*/
|
||||||
|
inc_stats(qctx->client,
|
||||||
|
ns_statscounter_proxytcp);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ISC_NM_PROXY_NONE:
|
||||||
|
if (isc_nm_has_encryption(handle)) {
|
||||||
|
inc_stats(qctx->client,
|
||||||
|
ns_statscounter_dot);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* If the StreamDNS socket doesn't have
|
||||||
|
* encryption, it has to be plain TCP
|
||||||
|
* DNS.
|
||||||
|
*/
|
||||||
|
inc_stats(qctx->client,
|
||||||
|
ns_statscounter_tcp);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case isc_nm_proxyudpsocket:
|
||||||
|
inc_stats(qctx->client, ns_statscounter_proxyudp);
|
||||||
|
break;
|
||||||
|
case isc_nm_udpsocket:
|
||||||
inc_stats(qctx->client, ns_statscounter_udp);
|
inc_stats(qctx->client, ns_statscounter_udp);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user