]> git.ipfire.org Git - thirdparty/bind9.git/commit
better tcpquota accounting and client mortality checks
authorEvan Hunt <each@isc.org>
Fri, 5 Apr 2019 23:12:18 +0000 (16:12 -0700)
committerOndřej Surý <ondrej@sury.org>
Thu, 25 Apr 2019 13:04:26 +0000 (15:04 +0200)
commit2ab8a085b3c666f28f1f9229bd6ecb59915b26c3
tree128e75fe8790ff54f29722fdd3a86c813ecb13ed
parent366b4e1ede8aed690e981e07137cb1cb77879c36
better tcpquota accounting and client mortality checks

- ensure that tcpactive is cleaned up correctly when accept() fails.
- set 'client->tcpattached' when the client is attached to the tcpquota.
  carry this value on to new clients sharing the same pipeline group.
  don't call isc_quota_detach() on the tcpquota unless tcpattached is
  set.  this way clients that were allowed to accept TCP connections
  despite being over quota (and therefore, were never attached to the
  quota) will not inadvertently detach from it and mess up the
  accounting.
- simplify the code for tcpquota disconnection by using a new function
  tcpquota_disconnect().
- before deciding whether to reject a new connection due to quota
  exhaustion, check to see whether there are at least two active
  clients. previously, this was "at least one", but that could be
  insufficient if there was one other client in READING state (waiting
  for messages on an open connection) but none in READY (listening
  for new connections).
- before deciding whether a TCP client object can to go inactive, we
  must ensure there are enough other clients to maintain service
  afterward -- both accepting new connections and reading/processing new
  queries.  A TCP client can't shut down unless at least one
  client is accepting new connections and (in the case of pipelined
  clients) at least one additional client is waiting to read.

(cherry picked from commit c7394738b2445c16f728a88394864dd61baad900)
(cherry picked from commit e965d5f11d3d0f6d59704e614fceca2093cb1856)
(cherry picked from commit 87d431161450777ea093821212abfb52d51b36e3)
bin/named/client.c
bin/named/include/named/client.h