2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +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

@@ -459,12 +459,12 @@ ns_interface_listenudp(ns_interface_t *ifp) {
static isc_result_t
ns_interface_listentcp(ns_interface_t *ifp) {
unsigned int tcpquota;
isc_result_t result;
result = isc_nm_listentcpdns(ifp->mgr->nm,
(isc_nmiface_t *) &ifp->addr,
ns__client_request, ifp,
ns__client_tcpconn, ifp->mgr->sctx,
sizeof(ns_client_t),
ifp->mgr->backlog,
&ifp->mgr->sctx->tcpquota,
@@ -476,14 +476,11 @@ ns_interface_listentcp(ns_interface_t *ifp) {
}
/*
* We update tcp-highwater stats here, since named itself adds to
* the TCP quota when starting, as it ensures that at least one
* client will be created for every interface it is listening to.
* We call this now to update the tcp-highwater statistic:
* this is necessary because we are adding to the TCP quota just
* by listening.
*/
tcpquota = isc_quota_getused(&ifp->mgr->sctx->tcpquota);
ns_stats_update_if_greater(ifp->mgr->sctx->nsstats,
ns_statscounter_tcphighwater,
tcpquota);
ns__client_tcpconn(NULL, ISC_R_SUCCESS, ifp->mgr->sctx);
#if 0
#ifndef ISC_ALLOW_MAPPED