From 00e8bfcdfcb004c7585125b4dddd1de8dcf142ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ondrej@isc.org>
Date: Tue, 1 Feb 2022 18:36:12 +0100
Subject: [PATCH] Add log message when hard quota is reached in TCP accept

When isc_quota_attach_cb() API returns ISC_R_QUOTA (meaning hard quota
was reached) the accept_connection() would return without logging a
message about quota reached.

Change the connection callback to log the quota reached message.

(cherry picked from commit 2ae84702ad0482cbbd5da4113b47d63b23ffe386)
Conflict: NA
Reference: https://gitlab.isc.org/isc-projects/bind9/-/commit/00e8bfcdfcb004c7585125b4dddd1de8dcf142ae
---
 lib/isc/netmgr/tcp.c    | 2 +-
 lib/isc/netmgr/tcpdns.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/isc/netmgr/tcp.c b/lib/isc/netmgr/tcp.c
index 05ef8d8cd5..133d6d9e61 100644
--- a/lib/isc/netmgr/tcp.c
+++ b/lib/isc/netmgr/tcp.c
@@ -627,7 +627,7 @@ tcp_connection_cb(uv_stream_t *server, int status) {
 		if (result == ISC_R_QUOTA) {
 			isc__nm_incstats(ssock->mgr,
 					 ssock->statsindex[STATID_ACCEPTFAIL]);
-			return;
+			goto done;
 		}
 	}
 
diff --git a/lib/isc/netmgr/tcpdns.c b/lib/isc/netmgr/tcpdns.c
index a1f500b352..38c8c692e1 100644
--- a/lib/isc/netmgr/tcpdns.c
+++ b/lib/isc/netmgr/tcpdns.c
@@ -596,7 +596,7 @@ tcpdns_connection_cb(uv_stream_t *server, int status) {
 		if (result == ISC_R_QUOTA) {
 			isc__nm_incstats(ssock->mgr,
 					 ssock->statsindex[STATID_ACCEPTFAIL]);
-			return;
+			goto done;
 		}
 	}
 
-- 
2.23.0

