From: Remi Gacogne Date: Thu, 18 Jun 2026 13:43:13 +0000 (+0200) Subject: dnsdist: Add configuration items for remote logger's "stalled write timeout" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=841b277c0fb9dd85f94dcddc58871eef078aa7d1;p=thirdparty%2Fpdns.git dnsdist: Add configuration items for remote logger's "stalled write timeout" Signed-off-by: Remi Gacogne --- diff --git a/pdns/dnsdistdist/dnsdist-configuration-yaml.cc b/pdns/dnsdistdist/dnsdist-configuration-yaml.cc index d0722dad0b..94379737e0 100644 --- a/pdns/dnsdistdist/dnsdist-configuration-yaml.cc +++ b/pdns/dnsdistdist/dnsdist-configuration-yaml.cc @@ -1943,12 +1943,12 @@ void registerProtobufLogger(const ProtobufLoggerConfiguration& config) std::vector> loggers; loggers.reserve(config.connection_count); for (uint64_t i = 0; i < config.connection_count; i++) { - loggers.push_back(std::make_shared(ComboAddress(std::string(config.address)), config.timeout, config.max_queued_entries * 100, config.reconnect_wait_time, dnsdist::configuration::yaml::s_inClientMode, RemoteLogger::FrameSize::Two)); + loggers.push_back(std::make_shared(ComboAddress(std::string(config.address)), config.timeout, config.max_queued_entries * 100, config.reconnect_wait_time, dnsdist::configuration::yaml::s_inClientMode, RemoteLogger::FrameSize::Two, config.stalled_write_timeout)); } object = std::shared_ptr(std::make_shared(std::move(loggers))); } else { - object = std::shared_ptr(std::make_shared(ComboAddress(std::string(config.address)), config.timeout, config.max_queued_entries * 100, config.reconnect_wait_time, dnsdist::configuration::yaml::s_inClientMode, RemoteLogger::FrameSize::Two)); + object = std::shared_ptr(std::make_shared(ComboAddress(std::string(config.address)), config.timeout, config.max_queued_entries * 100, config.reconnect_wait_time, dnsdist::configuration::yaml::s_inClientMode, RemoteLogger::FrameSize::Two, config.stalled_write_timeout)); } dnsdist::configuration::yaml::registerType(object, config.name); #endif diff --git a/pdns/dnsdistdist/dnsdist-lua-bindings-protobuf.cc b/pdns/dnsdistdist/dnsdist-lua-bindings-protobuf.cc index 7ce6e6dcb9..9cfbead089 100644 --- a/pdns/dnsdistdist/dnsdist-lua-bindings-protobuf.cc +++ b/pdns/dnsdistdist/dnsdist-lua-bindings-protobuf.cc @@ -121,7 +121,7 @@ void setupLuaBindingsProtoBuf(LuaContext& luaCtx, bool client, bool configCheck) }); /* RemoteLogger */ - luaCtx.writeFunction("newRemoteLogger", [client, configCheck](const std::string& remote, std::optional timeout, std::optional maxQueuedEntries, std::optional reconnectWaitTime, std::optional connectionCount) { + luaCtx.writeFunction("newRemoteLogger", [client, configCheck](const std::string& remote, std::optional timeout, std::optional maxQueuedEntries, std::optional reconnectWaitTime, std::optional connectionCount, std::optional stalledWriteTimeout) { if (client || configCheck) { return std::shared_ptr(nullptr); } @@ -130,7 +130,7 @@ void setupLuaBindingsProtoBuf(LuaContext& luaCtx, bool client, bool configCheck) std::vector> loggers; loggers.reserve(count); for (uint64_t i = 0; i < count; i++) { - loggers.push_back(std::make_shared(ComboAddress(remote), timeout ? *timeout : 2, maxQueuedEntries ? (*maxQueuedEntries * 100) : 10000, reconnectWaitTime ? *reconnectWaitTime : 1, client, RemoteLogger::FrameSize::Two)); + loggers.push_back(std::make_shared(ComboAddress(remote), timeout ? *timeout : 2, maxQueuedEntries ? (*maxQueuedEntries * 100) : 10000, reconnectWaitTime ? *reconnectWaitTime : 1, client, RemoteLogger::FrameSize::Two, stalledWriteTimeout ? *stalledWriteTimeout : 5)); } return std::shared_ptr(new RemoteLoggerPool(std::move(loggers))); } diff --git a/pdns/dnsdistdist/dnsdist-settings-definitions.yml b/pdns/dnsdistdist/dnsdist-settings-definitions.yml index 6c42bba0eb..800979044d 100644 --- a/pdns/dnsdistdist/dnsdist-settings-definitions.yml +++ b/pdns/dnsdistdist/dnsdist-settings-definitions.yml @@ -225,6 +225,11 @@ protobuf_logger: type: "u64" default: 1 description: "Number of connections to open to the endpoint" + - name: "stalled_write_timeout" + type: "u32" + default: 5 + description: "If we have been unable to write or buffer data on our side of the TCP socket for that long, in seconds, consider that the remote endpoint has died and reconnect" + version_added: "2.2.0" dnstap_logger: description: "Endpoint to send queries and/or responses data to, using the dnstap format" diff --git a/pdns/dnsdistdist/docs/reference/protobuf.rst b/pdns/dnsdistdist/docs/reference/protobuf.rst index 00addb682d..c2b0ab9b88 100644 --- a/pdns/dnsdistdist/docs/reference/protobuf.rst +++ b/pdns/dnsdistdist/docs/reference/protobuf.rst @@ -1,11 +1,14 @@ Protobuf Logging Reference ========================== -.. function:: newRemoteLogger(address [, timeout=2[, maxQueuedEntries=100[, reconnectWaitTime=1[, connectionCount=1]]]]) +.. function:: newRemoteLogger(address [, timeout=2[, maxQueuedEntries=100[, reconnectWaitTime=1[, connectionCount=1, stalledWriteTimeout=5]]]]) .. versionchanged:: 2.0.0 Added the optional ``connectionCount`` parameter. + .. versionchanged:: 2.2.0 + Added the optional ``stalledWriteTimeout`` parameter. + Create a Remote Logger object, to use with :func:`RemoteLogAction` and :func:`RemoteLogResponseAction`. :param string address: An IP:PORT combination where the logger is listening @@ -13,6 +16,7 @@ Protobuf Logging Reference :param int maxQueuedEntries: Queue this many messages before dropping new ones (e.g. when the remote listener closes the connection) :param int reconnectWaitTime: Time in seconds between reconnection attempts :param int connectionCount: Number of connections to open to the socket + :param int stalledWriteTimeout: If we have been unable to write or buffer data on our side of the TCP socket for that long, in seconds, consider that the remote endpoint has died and reconnect .. class:: DNSDistProtoBufMessage