]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
restore allowance for tcp-clients < interfaces
authorEvan Hunt <each@isc.org>
Fri, 5 Apr 2019 23:26:19 +0000 (16:26 -0700)
committerOndřej Surý <ondrej@sury.org>
Thu, 25 Apr 2019 13:04:26 +0000 (15:04 +0200)
in the "refactor tcpquota and pipeline refs" commit, the counting
of active interfaces was tightened in such a way that named could
fail to listen on an interface if there were more interfaces than
tcp-clients. when checking the quota to start accepting on an
interface, if the number of active clients was above zero, then
it was presumed that some other client was able to handle accepting
new connections. this, however, ignored the fact that the current client
could be included in that count, so if the quota was already exceeded
before all the interfaces were listening, some interfaces would never
listen.

we now check whether the current client has been marked active; if so,
then the number of active clients on the interface must be greater
than 1, not 0.

(cherry picked from commit 0b4e2cd4c3192ba88569dd344f542a8cc43742b5)
(cherry picked from commit d01023aaac35543daffbdf48464e320150235d41)

bin/named/client.c
doc/arm/Bv9ARM-book.xml

index d826ab32bf78148fa19be34e0a83b2251c46e99c..845326abc059e37667a5b1c01a670085ed8d1a9c 100644 (file)
@@ -3464,8 +3464,9 @@ client_accept(ns_client_t *client) {
                 *
                 * So, we check here to see if any other clients are
                 * already servicing TCP queries on this interface (whether
-                * accepting, reading, or processing). If we find at least
-                * one, then it's okay *not* to call accept - we can let this
+                * accepting, reading, or processing). If we find that at
+                * least one client other than this one is active, then
+                * it's okay *not* to call accept - we can let this
                 * client go inactive and another will take over when it's
                 * done.
                 *
@@ -3479,7 +3480,8 @@ client_accept(ns_client_t *client) {
                 * quota is tcp-clients plus the number of listening
                 * interfaces plus 1.)
                 */
-               exit = (isc_atomic_xadd(&client->interface->ntcpactive, 0) > 0);
+               exit = (isc_atomic_xadd(&client->interface->ntcpactive, 0) >
+                       (client->tcpactive ? 1 : 0));
                if (exit) {
                        client->newstate = NS_CLIENTSTATE_INACTIVE;
                        (void)exit_check(client);
index 381768d5404999e9f45570230155e2a58031bc40..9c76d3cd6f4453f767c4f0541a44780da529df7c 100644 (file)
@@ -8493,7 +8493,8 @@ avoid-v6-udp-ports { 40000; range 50000 60000; };
                <para>
                  The number of file descriptors reserved for TCP, stdio,
                  etc.  This needs to be big enough to cover the number of
-                 interfaces <command>named</command> listens on, <command>tcp-clients</command> as well as
+                 interfaces <command>named</command> listens on plus
+                 <command>tcp-clients</command>, as well as
                  to provide room for outgoing TCP queries and incoming zone
                  transfers.  The default is <literal>512</literal>.
                  The minimum value is <literal>128</literal> and the