From: Charles-Henri Bruyand Date: Fri, 22 Sep 2023 15:01:41 +0000 (+0200) Subject: doq: add congestion control algorithm configuration option X-Git-Tag: rec-5.0.0-alpha2~6^2~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7b7f5513b36c33e60b78265d403397651b282c11;p=thirdparty%2Fpdns.git doq: add congestion control algorithm configuration option --- diff --git a/.github/actions/spell-check/allow.txt b/.github/actions/spell-check/allow.txt index a902870fb4..6575c877b8 100644 --- a/.github/actions/spell-check/allow.txt +++ b/.github/actions/spell-check/allow.txt @@ -240,6 +240,7 @@ batchmode baz bbnew bbold +bbr bbsv bccaf bdr diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index c3aa3c52f9..2c794ec9b5 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -2515,7 +2515,17 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) } getOptionalValue(vars, "internalPipeBufferSize", frontend->d_internalPipeBufferSize); getOptionalValue(vars, "idleTimeout", frontend->d_idleTimeout); - + { + std::string valueStr; + if (getOptionalValue(vars, "congestionControlAlgo", valueStr) > 0) { + if (DOQFrontend::s_available_cc_algorithms.count(valueStr)) { + frontend->d_ccAlgo = valueStr; + } + else { + warnlog("Ignoring unknown value '%s' for 'congestionControlAlgo' on 'addDOQLocal'", valueStr); + } + } + } parseTLSConfig(frontend->d_tlsConfig, "addDOQLocal", vars); bool ignoreTLSConfigurationErrors = false; diff --git a/pdns/dnsdistdist/docs/reference/config.rst b/pdns/dnsdistdist/docs/reference/config.rst index f6ad305783..354f477f00 100644 --- a/pdns/dnsdistdist/docs/reference/config.rst +++ b/pdns/dnsdistdist/docs/reference/config.rst @@ -191,6 +191,7 @@ Listen Sockets * ``idleTimeout=5``: int - Set the idle timeout, in seconds. * ``internalPipeBufferSize=0``: int - Set the size in bytes of the internal buffer of the pipes used internally to pass queries and responses between threads. Requires support for ``F_SETPIPE_SZ`` which is present in Linux since 2.6.35. The actual size might be rounded up to a multiple of a page size. 0 means that the OS default size is used. The default value is 0, except on Linux where it is 1048576 since 1.6.0. * ``maxInFlight=0``: int - Maximum number of in-flight queries. The default is 0, which disables out-of-order processing. + * ``congestionControlAlgo="reno"``: str - The congestion control algorithm to be chosen between ``reno``, ``cubic`` and ``bbr`` .. function:: addTLSLocal(address, certFile(s), keyFile(s) [, options]) diff --git a/pdns/dnsdistdist/doq.cc b/pdns/dnsdistdist/doq.cc index 784c7c03ea..ed1548ce7a 100644 --- a/pdns/dnsdistdist/doq.cc +++ b/pdns/dnsdistdist/doq.cc @@ -40,6 +40,12 @@ static std::string s_quicRetryTokenKey = newKey(false); +std::map DOQFrontend::s_available_cc_algorithms = { + {"reno", QUICHE_CC_RENO}, + {"cubic", QUICHE_CC_CUBIC}, + {"bbr", QUICHE_CC_BBR}, +}; + using QuicheConnection = std::unique_ptr; using QuicheConfig = std::unique_ptr; @@ -322,7 +328,10 @@ void DOQFrontend::setup() // https://docs.rs/quiche/latest/quiche/struct.Config.html#method.set_initial_max_data quiche_config_set_initial_max_data(config.get(), 8192 * d_maxInFlight); - quiche_config_set_cc_algorithm(config.get(), QUICHE_CC_RENO); + auto algo = DOQFrontend::s_available_cc_algorithms.find(d_ccAlgo); + if (algo != DOQFrontend::s_available_cc_algorithms.end()) { + quiche_config_set_cc_algorithm(config.get(), static_cast(algo->second)); + } { PacketBuffer resetToken; diff --git a/pdns/dnsdistdist/doq.hh b/pdns/dnsdistdist/doq.hh index 72d276892b..9d318c9aac 100644 --- a/pdns/dnsdistdist/doq.hh +++ b/pdns/dnsdistdist/doq.hh @@ -59,6 +59,8 @@ struct DOQFrontend #endif uint64_t d_idleTimeout{5}; uint64_t d_maxInFlight{65535}; + std::string d_ccAlgo{"reno"}; + static std::map s_available_cc_algorithms; }; struct DOQUnit