]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use the configured TCP connect timeout in checkds_send_toaddr()
authorAram Sargsyan <aram@isc.org>
Tue, 18 Feb 2025 17:13:39 +0000 (17:13 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Wed, 23 Apr 2025 17:03:05 +0000 (17:03 +0000)
The checkds_send_toaddr() function uses hardcoded timeout values
for both UDP and TCP, however, with TCP named has configurable
timeout values. Slightly refactor the timeouts calculation part
and use the configured 'tcp-initial-timeout' value as the connect
timeout.

lib/dns/zone.c

index dffafb30e2ad79480d298cd7cacd4f7f55f54c6b..593f34c22fc4134c674c96aa51b4388d549037ba 100644 (file)
@@ -21442,13 +21442,17 @@ checkds_send_toaddr(void *arg) {
        dns_zone_log(checkds->zone, ISC_LOG_DEBUG(3),
                     "checkds: create request for DS query to %s", addrbuf);
 
-       const unsigned int timeout = 5;
+       uint32_t initial_timeout;
+       isc_nm_gettimeouts(checkds->zone->zmgr->netmgr, &initial_timeout, NULL,
+                          NULL, NULL, NULL);
+       const unsigned int connect_timeout = initial_timeout / MS_PER_SEC;
+
        options |= DNS_REQUESTOPT_TCP;
-       result = dns_request_create(checkds->zone->view->requestmgr, message,
-                                   &src, &checkds->dst, NULL, NULL, options,
-                                   key, timeout * 3 + 1, timeout * 3 + 1,
-                                   timeout, 2, checkds->zone->loop,
-                                   checkds_done, checkds, &checkds->request);
+       result = dns_request_create(
+               checkds->zone->view->requestmgr, message, &src, &checkds->dst,
+               NULL, NULL, options, key, connect_timeout, TCP_REQUEST_TIMEOUT,
+               UDP_REQUEST_TIMEOUT, UDP_REQUEST_RETRIES, checkds->zone->loop,
+               checkds_done, checkds, &checkds->request);
        if (result != ISC_R_SUCCESS) {
                dns_zone_log(checkds->zone, ISC_LOG_DEBUG(3),
                             "checkds: dns_request_create() to %s failed: %s",