2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

Fix tcp-highwater stats updating

After the network manager rewrite, tcp-higwater stats was only being
updated when a valid DNS query was received over tcp.

It turns out tcp-quota is updated right after a tcp connection is
accepted, before any data is read, so in the event that some client
connect but don't send a valid query, it wouldn't be taken into
account to update tcp-highwater stats, that is wrong.

This commit fix tcp-highwater to update its stats whenever a tcp connection
is established, independent of what happens after (timeout/invalid
request, etc).
This commit is contained in:
Diego Fronza
2019-11-25 18:36:14 -03:00
committed by Evan Hunt
parent ead7b3dc53
commit ed9853e739
6 changed files with 50 additions and 24 deletions

View File

@@ -1657,11 +1657,6 @@ ns__client_request(isc_nmhandle_t *handle, isc_region_t *region, void *arg) {
}
if (isc_nmhandle_is_stream(handle)) {
client->attributes |= NS_CLIENTATTR_TCP;
unsigned int curr_tcpquota =
isc_quota_getused(&client->sctx->tcpquota);
ns_stats_update_if_greater(client->sctx->nsstats,
ns_statscounter_tcphighwater,
curr_tcpquota);
}
INSIST(client->recursionquota == NULL);
@@ -2185,6 +2180,20 @@ ns__client_request(isc_nmhandle_t *handle, isc_region_t *region, void *arg) {
isc_task_unpause(client->task);
}
void
ns__client_tcpconn(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
ns_server_t *sctx = (ns_server_t *) arg;
unsigned int tcpquota;
UNUSED(handle);
UNUSED(result);
tcpquota = isc_quota_getused(&sctx->tcpquota);
ns_stats_update_if_greater(sctx->nsstats,
ns_statscounter_tcphighwater,
tcpquota);
}
static void
get_clientmctx(ns_clientmgr_t *manager, isc_mem_t **mctxp) {
isc_mem_t *clientmctx;