]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
increase TCP4Clients/TCP6Clients after point of no failure
authorAydın Mercan <aydin@isc.org>
Fri, 24 May 2024 11:56:03 +0000 (14:56 +0300)
committerAydın Mercan <aydin@isc.org>
Thu, 30 May 2024 10:39:23 +0000 (13:39 +0300)
Failing to accept TCP/TLS connections in 9.18 detaches the quota in
isc__nm_failed_accept_cb, causing TCP4Clients and TCP6Clients statistics
to not decrease inside cleanup.

Fix by increasing the counter after the point of no failure but before
handling statistics through the client's socket is no longer valid.

lib/isc/netmgr/tcpdns.c
lib/isc/netmgr/tlsdns.c

index 1864a45abac616feb75b4bace39bf462e0dc4eaa..dd3e9ec3fed64321cf27c89cb8d2abac6ac57079 100644 (file)
@@ -1005,8 +1005,6 @@ accept_connection(isc_nmsocket_t *ssock, isc_quota_t *quota) {
        UV_RUNTIME_CHECK(uv_timer_init, r);
        uv_handle_set_data((uv_handle_t *)&csock->read_timer, csock);
 
-       isc__nm_incstats(csock, STATID_CLIENTS);
-
        r = uv_accept(&ssock->uv_handle.stream, &csock->uv_handle.stream);
        if (r != 0) {
                result = isc__nm_uverr2result(r);
@@ -1084,6 +1082,8 @@ accept_connection(isc_nmsocket_t *ssock, isc_quota_t *quota) {
 
        isc_nmhandle_detach(&handle);
 
+       isc__nm_incstats(csock, STATID_CLIENTS);
+
        /*
         * sock is now attached to the handle.
         */
index 7a005db9b90ac992a7db25d322b3d0cf4af97de7..fa416e2fef335beb0ad31247f77f794a0bde84ac 100644 (file)
@@ -1629,8 +1629,6 @@ accept_connection(isc_nmsocket_t *ssock, isc_quota_t *quota) {
        UV_RUNTIME_CHECK(uv_timer_init, r);
        uv_handle_set_data((uv_handle_t *)&csock->read_timer, csock);
 
-       isc__nm_incstats(csock, STATID_CLIENTS);
-
        r = uv_accept(&ssock->uv_handle.stream, &csock->uv_handle.stream);
        if (r != 0) {
                result = isc__nm_uverr2result(r);
@@ -1727,6 +1725,8 @@ accept_connection(isc_nmsocket_t *ssock, isc_quota_t *quota) {
                goto failure;
        }
 
+       isc__nm_incstats(csock, STATID_CLIENTS);
+
        /*
         * sock is now attached to the handle.
         */