From daede6876b278643be3a9f6af1f5959cf39cf99c Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Tue, 18 Feb 2025 17:07:15 +0000 Subject: [PATCH] Use the configured TCP connect timeout in notify_send_toaddr() The notify_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 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 769b00420a..dffafb30e2 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -12619,7 +12619,7 @@ notify_send_toaddr(void *arg) { dns_tsigkey_t *key = NULL; char addrbuf[ISC_SOCKADDR_FORMATSIZE]; isc_sockaddr_t src; - unsigned int options, connect_timeout, timeout, udptimeout; + unsigned int options; bool have_notifysource = false; isc_tlsctx_cache_t *zmgr_tlsctx_cache = NULL; @@ -12729,14 +12729,14 @@ notify_send_toaddr(void *arg) { goto cleanup_key; } - udptimeout = 5; - connect_timeout = timeout = 3 * udptimeout + 1; + uint32_t initial_timeout; + isc_nm_gettimeouts(notify->zone->zmgr->netmgr, &initial_timeout, NULL, + NULL, NULL, NULL); + const unsigned int connect_timeout = initial_timeout / MS_PER_SEC; again: if ((notify->flags & DNS_NOTIFY_TCP) != 0) { options |= DNS_REQUESTOPT_TCP; - udptimeout = 0; - timeout = 15; } zmgr_tlsctx_attach(notify->zone->zmgr, &zmgr_tlsctx_cache); @@ -12744,8 +12744,9 @@ again: result = dns_request_create( notify->zone->view->requestmgr, message, &src, ¬ify->dst, notify->transport, zmgr_tlsctx_cache, options, key, - connect_timeout, timeout, udptimeout, 2, notify->zone->loop, - notify_done, notify, ¬ify->request); + connect_timeout, TCP_REQUEST_TIMEOUT, UDP_REQUEST_TIMEOUT, + UDP_REQUEST_RETRIES, notify->zone->loop, notify_done, notify, + ¬ify->request); isc_tlsctx_cache_detach(&zmgr_tlsctx_cache);