&requestmgr));
dns_view_attach(view, &(dns_view_t *){ NULL });
+
+ uint32_t initial;
+ isc_nm_gettimeouts(netmgr, &initial, NULL, NULL, NULL);
+ const unsigned int connect_timeout = initial, timeout = initial;
+
CHECK(dns_request_create(requestmgr, message, NULL, &peer, NULL, NULL,
- DNS_REQUESTOPT_TCP, NULL, 1, 0, 0, isc_loop(),
- recvresponse, message, &request));
+ DNS_REQUESTOPT_TCP, NULL, connect_timeout,
+ timeout, 0, 0, isc_loop(), recvresponse,
+ message, &request));
return;
cleanup:
result = dns_request_create(requestmgr, updatemsg, srcaddr, primary,
req_transport, req_tls_ctx_cache, options,
- tsigkey, timeout, udp_timeout, udp_retries,
- isc_loop_main(loopmgr), update_completed,
- NULL, &request);
+ tsigkey, timeout, timeout, udp_timeout,
+ udp_retries, isc_loop_main(loopmgr),
+ update_completed, NULL, &request);
check_result(result, "dns_request_create");
if (debugging) {
srcaddr = localaddr4;
}
- result = dns_request_create(requestmgr, soaquery, srcaddr, addr,
- req_transport, req_tls_ctx_cache,
- options, NULL, timeout, udp_timeout,
- udp_retries, isc_loop_main(loopmgr),
- recvsoa, reqinfo, &request);
+ result = dns_request_create(
+ requestmgr, soaquery, srcaddr, addr, req_transport,
+ req_tls_ctx_cache, options, NULL, timeout, timeout,
+ udp_timeout, udp_retries, isc_loop_main(loopmgr),
+ recvsoa, reqinfo, &request);
check_result(result, "dns_request_create");
requests++;
return;
result = dns_request_create(
requestmgr, msg, srcaddr, destaddr, req_transport,
req_tls_ctx_cache, options, default_servers ? NULL : tsigkey,
- timeout, udp_timeout, udp_retries, isc_loop_main(loopmgr),
- recvsoa, reqinfo, request);
+ timeout, timeout, udp_timeout, udp_retries,
+ isc_loop_main(loopmgr), recvsoa, reqinfo, request);
check_result(result, "dns_request_create");
requests++;
}
srcaddr = localaddr4;
}
- result = dns_request_create(
- requestmgr, msg, srcaddr, destaddr, req_transport,
- req_tls_ctx_cache, options, tsigkey, timeout, udp_timeout,
- udp_retries, isc_loop_main(loopmgr), recvgss, reqinfo, request);
+ result = dns_request_create(requestmgr, msg, srcaddr, destaddr,
+ req_transport, req_tls_ctx_cache, options,
+ tsigkey, timeout, timeout, udp_timeout,
+ udp_retries, isc_loop_main(loopmgr),
+ recvgss, reqinfo, request);
check_result(result, "dns_request_create");
if (debugging) {
show_message(stdout, msg, "Outgoing update query:");
result = dns_request_create(
requestmgr, message, have_src ? &srcaddr : NULL, &dstaddr, NULL,
- NULL, DNS_REQUESTOPT_TCP, NULL, TIMEOUT, 0, 0,
+ NULL, DNS_REQUESTOPT_TCP, NULL, TIMEOUT, TIMEOUT, 0, 0,
isc_loop_main(loopmgr), recvresponse, message, &request);
CHECK("dns_request_create", result);
result = dns_request_create(
requestmgr, message, have_src ? &srcaddr : NULL, &dstaddr, NULL,
- NULL, options, NULL, query->timeout, query->udptimeout,
- query->udpretries, isc_loop_main(loopmgr), recvresponse,
- message, &request);
+ NULL, options, NULL, query->timeout, query->timeout,
+ query->udptimeout, query->udpretries, isc_loop_main(loopmgr),
+ recvresponse, message, &request);
CHECK("dns_request_create", result);
return ISC_R_SUCCESS;
dns_transport_t *transport;
isc_tlsctx_cache_t *tlsctx_cache;
unsigned int retries;
+ unsigned int connect_timeout;
unsigned int timeout;
isc_time_t start;
isc_sockaddr_t local;
isc_stats_attach(stats, &mgr->stats);
}
+isc_nm_t *
+dns_dispatchmgr_getnetmgr(dns_dispatchmgr_t *mgr) {
+ REQUIRE(VALID_DISPATCHMGR(mgr));
+
+ return mgr->nm;
+}
+
/*
* Allocate and set important limits.
*/
isc_result_t
dns_dispatch_add(dns_dispatch_t *disp, isc_loop_t *loop,
- dns_dispatchopt_t options, unsigned int timeout,
- const isc_sockaddr_t *dest, dns_transport_t *transport,
- isc_tlsctx_cache_t *tlsctx_cache, dispatch_cb_t connected,
- dispatch_cb_t sent, dispatch_cb_t response, void *arg,
- dns_messageid_t *idp, dns_dispentry_t **respp) {
+ dns_dispatchopt_t options, unsigned int connect_timeout,
+ unsigned int timeout, const isc_sockaddr_t *dest,
+ dns_transport_t *transport, isc_tlsctx_cache_t *tlsctx_cache,
+ dispatch_cb_t connected, dispatch_cb_t sent,
+ dispatch_cb_t response, void *arg, dns_messageid_t *idp,
+ dns_dispentry_t **respp) {
REQUIRE(VALID_DISPATCH(disp));
REQUIRE(dest != NULL);
REQUIRE(respp != NULL && *respp == NULL);
in_port_t localport = isc_sockaddr_getport(&disp->local);
dns_dispentry_t *resp = isc_mem_get(disp->mctx, sizeof(*resp));
*resp = (dns_dispentry_t){
+ .connect_timeout = connect_timeout,
.timeout = timeout,
.port = localport,
.peer = *dest,
} else if (eresult == ISC_R_SUCCESS) {
disp->state = DNS_DISPATCHSTATE_CONNECTED;
isc_nmhandle_attach(handle, &disp->handle);
+ if (resp != NULL) {
+ isc_nmhandle_cleartimeout(disp->handle);
+ if (resp->timeout != 0) {
+ isc_nmhandle_settimeout(disp->handle,
+ resp->timeout);
+ }
+ }
tcp_startrecv(disp, resp);
} else {
disp->state = DNS_DISPATCHSTATE_NONE;
dns_dispatch_ref(disp); /* DISPATCH003 */
dispentry_log(resp, ISC_LOG_DEBUG(90),
"connecting from %s to %s, timeout %u", localbuf,
- peerbuf, resp->timeout);
+ peerbuf, resp->connect_timeout);
char *hostname = NULL;
if (resp->transport != NULL) {
isc_nm_streamdnsconnect(disp->mgr->nm, &disp->local,
&disp->peer, tcp_connected, disp,
- resp->timeout, tlsctx, hostname,
+ resp->connect_timeout, tlsctx, hostname,
sess_cache, ISC_NM_PROXY_NONE, NULL);
break;
if (!disp->reading) {
/* Restart the reading */
+ isc_nmhandle_cleartimeout(disp->handle);
+ if (resp->timeout != 0) {
+ isc_nmhandle_settimeout(disp->handle,
+ resp->timeout);
+ }
tcp_startrecv(disp, resp);
}
* (see dns/stats.h).
*/
+isc_nm_t *
+dns_dispatchmgr_getnetmgr(dns_dispatchmgr_t *mgr);
+/*%<
+ * Get the network manager object associated with the dispatch manager.
+ *
+ * Requires:
+ *\li disp is valid
+ */
+
isc_result_t
dns_dispatch_createudp(dns_dispatchmgr_t *mgr, const isc_sockaddr_t *localaddr,
dns_dispatch_t **dispp);
isc_result_t
dns_dispatch_add(dns_dispatch_t *disp, isc_loop_t *loop,
- dns_dispatchopt_t options, unsigned int timeout,
- const isc_sockaddr_t *dest, dns_transport_t *transport,
- isc_tlsctx_cache_t *tlsctx_cache, dispatch_cb_t connected,
- dispatch_cb_t sent, dispatch_cb_t response, void *arg,
- dns_messageid_t *idp, dns_dispentry_t **resp);
+ dns_dispatchopt_t options, unsigned int connect_timeout,
+ unsigned int timeout, const isc_sockaddr_t *dest,
+ dns_transport_t *transport, isc_tlsctx_cache_t *tlsctx_cache,
+ dispatch_cb_t connected, dispatch_cb_t sent,
+ dispatch_cb_t response, void *arg, dns_messageid_t *idp,
+ dns_dispentry_t **respp);
/*%<
* Add a response entry for this dispatch.
*
+ * The 'connect_timeout' and 'timeout' define the number of milliseconds for
+ * the connect and read timeouts respectively. When 0 is provided, the
+ * corresponding timeout timer is disabled. For UDP disptaches 'connect_timeout'
+ * is ignored.
+ *
* "*idp" is filled in with the assigned message ID, and *resp is filled in
* with the dispatch entry object.
*
const isc_sockaddr_t *srcaddr,
const isc_sockaddr_t *destaddr, dns_transport_t *transport,
isc_tlsctx_cache_t *tlsctx_cache, unsigned int options,
- dns_tsigkey_t *key, unsigned int timeout,
- unsigned int udptimeout, unsigned int udpretries,
- isc_loop_t *loop, isc_job_cb cb, void *arg,
- dns_request_t **requestp);
+ dns_tsigkey_t *key, unsigned int connect_timeout,
+ unsigned int timeout, unsigned int udptimeout,
+ unsigned int udpretries, isc_loop_t *loop, isc_job_cb cb,
+ void *arg, dns_request_t **requestp);
/*%<
* Create and send a request.
*
* Notes:
*
*\li 'message' will be rendered and sent to 'address'. If the
- * #DNS_REQUESTOPT_TCP option is set, TCP will be used,
- * #DNS_REQUESTOPT_SHARE option is set too, connecting TCP
- * (vs. connected) will be shared too. The request
- * will timeout after 'timeout' seconds. UDP requests will be resent
- * at 'udptimeout' intervals if non-zero or 'udpretries' is non-zero.
+ * #DNS_REQUESTOPT_TCP option is set or the request message's size is
+ * larger than 512 bytes then TCP will be used, and #DNS_REQUESTOPT_SHARE
+ * option is set too, connecting TCP (vs. connected) will be shared too.
+ * With TCP a connection attempt will timeout after 'connect_timeout'
+ * seconds. The request will timeout after 'timeout' seconds for both TCP
+ * and UDP. UDP requests will be resent at 'udptimeout' intervals if
+ * non-zero or 'udpretries' is non-zero.
*
*\li If the #DNS_REQUESTOPT_CASE option is set, use case sensitive
* compression.
*
*\li 'srcaddr' and 'dstaddr' are the same protocol family.
*
- *\li 'timeout' > 0
+ *\li 'connect_timeout' > 0 and 'timeout' > 0.
*
*\li 'loop' is a valid loop.
*
const isc_sockaddr_t *destaddr,
dns_transport_t *transport,
isc_tlsctx_cache_t *tlsctx_cache, unsigned int options,
- unsigned int timeout, unsigned int udptimeout,
- unsigned int udpretries, isc_loop_t *loop, isc_job_cb cb,
- void *arg, dns_request_t **requestp);
+ unsigned int connect_timeout, unsigned int timeout,
+ unsigned int udptimeout, unsigned int udpretries,
+ isc_loop_t *loop, isc_job_cb cb, void *arg,
+ dns_request_t **requestp);
/*!<
* \brief Create and send a request.
*
* Notes:
*
*\li 'msgbuf' will be sent to 'destaddr' after setting the id. If the
- * #DNS_REQUESTOPT_TCP option is set, TCP will be used,
- * #DNS_REQUESTOPT_SHARE option is set too, connecting TCP
- * (vs. connected) will be shared too. The request
- * will timeout after 'timeout' seconds. UDP requests will be resent
- * at 'udptimeout' intervals if non-zero or if 'udpretries' is not zero.
+ * #DNS_REQUESTOPT_TCP option is set or the request message's size is
+ * larger than 512 bytes then TCP will be used, and #DNS_REQUESTOPT_SHARE
+ * option is set too, connecting TCP (vs. connected) will be shared too.
+ * With TCP a connection attempt will timeout after 'connect_timeout'
+ * seconds. The request wll timeout after timeout' seconds for both TCP
+ * and UDP. UDP requests will be resent at 'udptimeout' intervals if
+ * non-zero or if 'udpretries' is not zero.
*
*\li When the request completes, successfully, due to a timeout, or
* because it was canceled, a completion callback will run in 'loop'.
*
*\li 'srcaddr' and 'dstaddr' are the same protocol family.
*
- *\li 'timeout' > 0
+ *\li 'connect_timeout' > 0 and 'timeout' > 0.
*
*\li 'loop' is a valid loop.
*
isc_buffer_t *tsig;
dns_tsigkey_t *tsigkey;
isc_sockaddr_t destaddr;
+ unsigned int connect_timeout;
unsigned int timeout;
unsigned int udpcount;
};
static dns_request_t *
new_request(isc_mem_t *mctx, isc_loop_t *loop, isc_job_cb cb, void *arg,
- bool tcp, unsigned int timeout, unsigned int udptimeout,
- unsigned int udpretries) {
+ bool tcp, unsigned int connect_timeout, unsigned int timeout,
+ unsigned int udptimeout, unsigned int udpretries) {
dns_request_t *request = isc_mem_get(mctx, sizeof(*request));
*request = (dns_request_t){
.magic = REQUEST_MAGIC,
isc_mem_attach(mctx, &request->mctx);
if (tcp) {
+ request->connect_timeout = connect_timeout * 1000;
request->timeout = timeout * 1000;
} else {
if (udptimeout == 0) {
const isc_sockaddr_t *destaddr,
dns_transport_t *transport,
isc_tlsctx_cache_t *tlsctx_cache, unsigned int options,
- unsigned int timeout, unsigned int udptimeout,
- unsigned int udpretries, isc_loop_t *loop, isc_job_cb cb,
- void *arg, dns_request_t **requestp) {
+ unsigned int connect_timeout, unsigned int timeout,
+ unsigned int udptimeout, unsigned int udpretries,
+ isc_loop_t *loop, isc_job_cb cb, void *arg,
+ dns_request_t **requestp) {
dns_request_t *request = NULL;
isc_result_t result;
isc_mem_t *mctx = NULL;
REQUIRE(loop != NULL);
REQUIRE(cb != NULL);
REQUIRE(requestp != NULL && *requestp == NULL);
- REQUIRE(timeout > 0);
+ REQUIRE(connect_timeout > 0 && timeout > 0);
REQUIRE(udpretries != UINT_MAX);
if (srcaddr != NULL) {
tcp = true;
}
- request = new_request(mctx, loop, cb, arg, tcp, timeout, udptimeout,
- udpretries);
+ request = new_request(mctx, loop, cb, arg, tcp, connect_timeout,
+ timeout, udptimeout, udpretries);
isc_buffer_allocate(mctx, &request->query, r.length + (tcp ? 2 : 0));
result = isc_buffer_copyregion(request->query, &r);
dispopt |= DNS_DISPATCHOPT_FIXEDID;
}
- result = dns_dispatch_add(
- request->dispatch, loop, dispopt, request->timeout, destaddr,
- transport, tlsctx_cache, req_connected, req_senddone,
- req_response, request, &id, &request->dispentry);
+ result = dns_dispatch_add(request->dispatch, loop, dispopt,
+ request->connect_timeout, request->timeout,
+ destaddr, transport, tlsctx_cache,
+ req_connected, req_senddone, req_response,
+ request, &id, &request->dispentry);
if (result != ISC_R_SUCCESS) {
if ((options & DNS_REQUESTOPT_FIXEDID) != 0 && !newtcp) {
dns_dispatch_detach(&request->dispatch);
const isc_sockaddr_t *srcaddr,
const isc_sockaddr_t *destaddr, dns_transport_t *transport,
isc_tlsctx_cache_t *tlsctx_cache, unsigned int options,
- dns_tsigkey_t *key, unsigned int timeout,
- unsigned int udptimeout, unsigned int udpretries,
- isc_loop_t *loop, isc_job_cb cb, void *arg,
- dns_request_t **requestp) {
+ dns_tsigkey_t *key, unsigned int connect_timeout,
+ unsigned int timeout, unsigned int udptimeout,
+ unsigned int udpretries, isc_loop_t *loop, isc_job_cb cb,
+ void *arg, dns_request_t **requestp) {
dns_request_t *request = NULL;
isc_result_t result;
isc_mem_t *mctx = NULL;
REQUIRE(loop != NULL);
REQUIRE(cb != NULL);
REQUIRE(requestp != NULL && *requestp == NULL);
- REQUIRE(timeout > 0);
+ REQUIRE(connect_timeout > 0 && timeout > 0);
REQUIRE(udpretries != UINT_MAX);
if (srcaddr != NULL &&
tcp = true;
}
- request = new_request(mctx, loop, cb, arg, tcp, timeout, udptimeout,
- udpretries);
+ request = new_request(mctx, loop, cb, arg, tcp, connect_timeout,
+ timeout, udptimeout, udpretries);
if (key != NULL) {
dns_tsigkey_attach(key, &request->tsigkey);
goto cleanup;
}
- result = dns_dispatch_add(request->dispatch, loop, 0, request->timeout,
+ result = dns_dispatch_add(request->dispatch, loop, 0,
+ request->connect_timeout, request->timeout,
destaddr, transport, tlsctx_cache,
req_connected, req_senddone, req_response,
request, &id, &request->dispentry);
UNLOCK(&fctx->lock);
/* Set up the dispatch and set the query ID */
- result = dns_dispatch_add(query->dispatch, fctx->loop, 0,
- isc_interval_ms(&fctx->interval), &sockaddr,
- addrinfo->transport, tlsctx_cache,
- resquery_connected, resquery_senddone,
- resquery_response, query, &query->id,
- &query->dispentry);
+ const unsigned int timeout_ms = isc_interval_ms(&fctx->interval);
+ result = dns_dispatch_add(query->dispatch, fctx->loop, 0, timeout_ms,
+ timeout_ms, &sockaddr, addrinfo->transport,
+ tlsctx_cache, resquery_connected,
+ resquery_senddone, resquery_response, query,
+ &query->id, &query->dispentry);
if (result != ISC_R_SUCCESS) {
goto cleanup_udpfetch;
}
xfrin_start(dns_xfrin_t *xfr) {
isc_result_t result = ISC_R_FAILURE;
isc_interval_t interval;
+ uint32_t initial;
dns_xfrin_ref(xfr);
if (dispmgr == NULL) {
result = ISC_R_SHUTTINGDOWN;
goto failure;
- } else {
- result = dns_dispatch_createtcp(
- dispmgr, &xfr->sourceaddr, &xfr->primaryaddr,
- xfr->transport, DNS_DISPATCHOPT_UNSHARED, &xfr->disp);
- dns_dispatchmgr_detach(&dispmgr);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ }
+
+ isc_nm_gettimeouts(dns_dispatchmgr_getnetmgr(dispmgr), &initial, NULL,
+ NULL, NULL);
+ result = dns_dispatch_createtcp(dispmgr, &xfr->sourceaddr,
+ &xfr->primaryaddr, xfr->transport,
+ DNS_DISPATCHOPT_UNSHARED, &xfr->disp);
+ dns_dispatchmgr_detach(&dispmgr);
+ if (result != ISC_R_SUCCESS) {
+ goto failure;
}
LIBDNS_XFRIN_START(xfr, xfr->info);
dns_xfrin_gettransporttype(xfr));
}
- CHECK(dns_dispatch_add(
- xfr->disp, xfr->loop, 0, 0, &xfr->primaryaddr, xfr->transport,
- xfr->tlsctx_cache, xfrin_connect_done, xfrin_send_done,
- xfrin_recv_done, xfr, &xfr->id, &xfr->dispentry));
+ /*
+ * Before a configuration option for the primary servers' TCP timeout
+ * is implemented, use initial TCP timeout as the connect timeout.
+ * The receive timeout timer is disabled on the dispatch level because
+ * the xfr module has its own timeouts.
+ */
+ const unsigned int connect_timeout = initial, timeout = 0;
+
+ CHECK(dns_dispatch_add(xfr->disp, xfr->loop, 0, connect_timeout,
+ timeout, &xfr->primaryaddr, xfr->transport,
+ xfr->tlsctx_cache, xfrin_connect_done,
+ xfrin_send_done, xfrin_recv_done, xfr, &xfr->id,
+ &xfr->dispentry));
/* Set the maximum timer */
if (xfr->max_time_timer == NULL) {
dns_tsigkey_t *key = NULL;
char addrbuf[ISC_SOCKADDR_FORMATSIZE];
isc_sockaddr_t src;
- unsigned int options, timeout, udptimeout;
+ unsigned int options, connect_timeout, timeout, udptimeout;
bool have_notifysource = false;
isc_tlsctx_cache_t *zmgr_tlsctx_cache = NULL;
goto cleanup_key;
}
udptimeout = 5;
- timeout = 3 * udptimeout + 1;
+ connect_timeout = timeout = 3 * udptimeout + 1;
again:
if ((notify->flags & DNS_NOTIFY_TCP) != 0) {
options |= DNS_REQUESTOPT_TCP;
zmgr_tlsctx_attach(notify->zone->zmgr, &zmgr_tlsctx_cache);
- result = dns_request_create(notify->zone->view->requestmgr, message,
- &src, ¬ify->dst, notify->transport,
- zmgr_tlsctx_cache, options, key, timeout,
- udptimeout, 2, notify->zone->loop,
- notify_done, notify, ¬ify->request);
+ 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);
isc_tlsctx_cache_detach(&zmgr_tlsctx_cache);
result = dns_request_create(
zone->view->requestmgr, message, &zone->sourceaddr, &curraddr,
NULL, NULL, DNS_REQUESTOPT_TCP, args->tsig_key,
- args->timeout * 3, args->timeout, 2, zone->loop,
- stub_glue_response, sgr, &sgr->request);
+ args->timeout * 3 + 1, args->timeout * 3 + 1, args->timeout, 2,
+ zone->loop, stub_glue_response, sgr, &sgr->request);
if (result != ISC_R_SUCCESS) {
uint_fast32_t pr;
zone_iattach(zone, &(dns_zone_t *){ NULL });
- int timeout = 5;
+ const unsigned int timeout = 5;
result = dns_request_create(
zone->view->requestmgr, message, &zone->sourceaddr, &curraddr,
- NULL, NULL, options, key, timeout * 3 + 1, timeout, 2,
- zone->loop, refresh_callback, zone, &zone->request);
+ NULL, NULL, options, key, timeout * 3 + 1, timeout * 3 + 1,
+ timeout, 2, zone->loop, refresh_callback, zone, &zone->request);
if (result != ISC_R_SUCCESS) {
zone_idetach(&(dns_zone_t *){ zone });
zone_debuglogc(zone, DNS_LOGCATEGORY_XFER_IN, __func__, 1,
cb_args->timeout = 15;
cb_args->reqnsid = reqnsid;
- int timeout = 5;
- result = dns_request_create(
- zone->view->requestmgr, message, &zone->sourceaddr, &curraddr,
- NULL, NULL, DNS_REQUESTOPT_TCP, key, timeout * 3 + 1, timeout,
- 2, zone->loop, stub_callback, cb_args, &zone->request);
+ const unsigned int timeout = 5;
+ result = dns_request_create(zone->view->requestmgr, message,
+ &zone->sourceaddr, &curraddr, NULL, NULL,
+ DNS_REQUESTOPT_TCP, key, timeout * 3 + 1,
+ timeout * 3 + 1, timeout, 2, zone->loop,
+ stub_callback, cb_args, &zone->request);
if (result != ISC_R_SUCCESS) {
zone_debuglog(zone, __func__, 1,
"dns_request_create() failed: %s",
result = dns_request_createraw(
forward->zone->view->requestmgr, forward->msgbuf, &src,
&forward->addr, forward->transport, zmgr_tlsctx_cache,
- forward->options, 15 /* XXX */, 0, 0, forward->zone->loop,
+ forward->options, 15, 15 /* XXX */, 0, 0, forward->zone->loop,
forward_callback, forward, &forward->request);
isc_tlsctx_cache_detach(&zmgr_tlsctx_cache);
dns_tsigkey_t *key = NULL;
char addrbuf[ISC_SOCKADDR_FORMATSIZE];
isc_sockaddr_t src;
- unsigned int options, timeout;
+ unsigned int options;
bool have_checkdssource = false;
bool canceled = checkds->rlevent->canceled;
dns_zone_log(checkds->zone, ISC_LOG_DEBUG(3),
"checkds: create request for DS query to %s", addrbuf);
- timeout = 5;
+ const unsigned int timeout = 5;
options |= DNS_REQUESTOPT_TCP;
- result = dns_request_create(
- checkds->zone->view->requestmgr, message, &src, &checkds->dst,
- NULL, NULL, options, key, 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, timeout * 3 + 1, timeout * 3 + 1,
+ timeout, 2, 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",
#define T_CLIENT_CONNECT (30 * 1000)
/* For checks which are expected to timeout */
-#define T_CLIENT_CONNECT_SHORT (10 * 1000)
+#define T_CLIENT_SHORT (10 * 1000)
/* dns_dispatchset_t *dset = NULL; */
static isc_sockaddr_t udp_server_addr;
assert_ptr_equal(test1->dispatch, test2->dispatch);
- result = dns_dispatch_add(test2->dispatch, isc_loop_main(loopmgr), 0,
- T_CLIENT_CONNECT, &tcp_server_addr, NULL,
- NULL, connected_shutdown, client_senddone,
- response_noop, test2, &test2->id,
- &test2->dispentry);
+ result = dns_dispatch_add(
+ test2->dispatch, isc_loop_main(loopmgr), 0, T_CLIENT_CONNECT,
+ T_CLIENT_INIT, &tcp_server_addr, NULL, NULL, connected_shutdown,
+ client_senddone, response_noop, test2, &test2->id,
+ &test2->dispentry);
assert_int_equal(result, ISC_R_SUCCESS);
dns_dispatch_connect(test2->dispentry);
assert_ptr_not_equal(test3->dispatch, test4->dispatch);
- result = dns_dispatch_add(test4->dispatch, isc_loop_main(loopmgr), 0,
- T_CLIENT_CONNECT, &tcp_server_addr, NULL,
- NULL, connected_shutdown, client_senddone,
- response_noop, test4, &test4->id,
- &test4->dispentry);
+ result = dns_dispatch_add(
+ test4->dispatch, isc_loop_main(loopmgr), 0, T_CLIENT_CONNECT,
+ T_CLIENT_INIT, &tcp_server_addr, NULL, NULL, connected_shutdown,
+ client_senddone, response_noop, test4, &test4->id,
+ &test4->dispentry);
assert_int_equal(result, ISC_R_SUCCESS);
dns_dispatch_connect(test4->dispentry);
&test->dispatch);
assert_int_equal(result, ISC_R_SUCCESS);
- result = dns_dispatch_add(test->dispatch, isc_loop_main(loopmgr), 0,
- T_CLIENT_CONNECT_SHORT, &tcp_server_addr,
- NULL, NULL, timeout_connected,
- client_senddone, response_timeout, test,
- &test->id, &test->dispentry);
+ result = dns_dispatch_add(
+ test->dispatch, isc_loop_main(loopmgr), 0, T_CLIENT_SHORT,
+ T_CLIENT_INIT, &tcp_server_addr, NULL, NULL, timeout_connected,
+ client_senddone, response_timeout, test, &test->id,
+ &test->dispentry);
assert_int_equal(result, ISC_R_SUCCESS);
testdata.message[0] = (test->id >> 8) & 0xff;
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_dispatch_add(test->dispatch, isc_loop_main(loopmgr), 0,
- T_CLIENT_CONNECT_SHORT, &tcp_server_addr,
- NULL, NULL, connected, client_senddone,
- response_timeout, test, &test->id,
- &test->dispentry);
+ T_CLIENT_CONNECT, T_CLIENT_SHORT,
+ &tcp_server_addr, NULL, NULL, connected,
+ client_senddone, response_timeout, test,
+ &test->id, &test->dispentry);
assert_int_equal(result, ISC_R_SUCCESS);
dns_dispatch_connect(test->dispentry);
&test->dispatch);
assert_int_equal(result, ISC_R_SUCCESS);
- result = dns_dispatch_add(
- test->dispatch, isc_loop_main(loopmgr), 0, T_CLIENT_CONNECT,
- &tcp_server_addr, NULL, NULL, connected, client_senddone,
- response_shutdown, test, &test->id, &test->dispentry);
+ result = dns_dispatch_add(test->dispatch, isc_loop_main(loopmgr), 0,
+ T_CLIENT_CONNECT, T_CLIENT_INIT,
+ &tcp_server_addr, NULL, NULL, connected,
+ client_senddone, response_shutdown, test,
+ &test->id, &test->dispentry);
assert_int_equal(result, ISC_R_SUCCESS);
testdata.message[0] = (test->id >> 8) & 0xff;
&test->dispatch);
assert_int_equal(result, ISC_R_SUCCESS);
- result = dns_dispatch_add(test->dispatch, isc_loop_main(loopmgr), 0,
- T_CLIENT_CONNECT, &tls_server_addr,
- tls_transport, tls_tlsctx_client_cache,
- connected, client_senddone, response_shutdown,
- test, &test->id, &test->dispentry);
+ result = dns_dispatch_add(
+ test->dispatch, isc_loop_main(loopmgr), 0, T_CLIENT_CONNECT,
+ T_CLIENT_INIT, &tls_server_addr, tls_transport,
+ tls_tlsctx_client_cache, connected, client_senddone,
+ response_shutdown, test, &test->id, &test->dispentry);
assert_int_equal(result, ISC_R_SUCCESS);
testdata.message[0] = (test->id >> 8) & 0xff;
assert_int_equal(result, ISC_R_SUCCESS);
result = dns_dispatch_add(test->dispatch, isc_loop_main(loopmgr), 0,
- T_CLIENT_CONNECT_SHORT, &udp_server_addr,
- NULL, NULL, connected, client_senddone,
- response_timeout, test, &test->id,
- &test->dispentry);
+ T_CLIENT_CONNECT, T_CLIENT_SHORT,
+ &udp_server_addr, NULL, NULL, connected,
+ client_senddone, response_timeout, test,
+ &test->id, &test->dispentry);
assert_int_equal(result, ISC_R_SUCCESS);
dns_dispatch_connect(test->dispentry);
&test->dispatch);
assert_int_equal(result, ISC_R_SUCCESS);
- result = dns_dispatch_add(
- test->dispatch, isc_loop_main(loopmgr), 0, T_CLIENT_CONNECT,
- &udp_server_addr, NULL, NULL, connected, client_senddone,
- response_getnext, test, &test->id, &test->dispentry);
+ result = dns_dispatch_add(test->dispatch, isc_loop_main(loopmgr), 0,
+ T_CLIENT_CONNECT, T_CLIENT_INIT,
+ &udp_server_addr, NULL, NULL, connected,
+ client_senddone, response_getnext, test,
+ &test->id, &test->dispentry);
assert_int_equal(result, ISC_R_SUCCESS);
testdata.message[0] = (test->id >> 8) & 0xff;
result = dns_dispatch_add(
test->dispatch, isc_loop_main(loopmgr), 0, T_CLIENT_CONNECT,
- &tcp_server_addr, NULL, NULL, connected_gettcp, client_senddone,
- response_noop, test, &test->id, &test->dispentry);
+ T_CLIENT_INIT, &tcp_server_addr, NULL, NULL, connected_gettcp,
+ client_senddone, response_noop, test, &test->id,
+ &test->dispentry);
assert_int_equal(result, ISC_R_SUCCESS);
dns_dispatch_connect(test->dispentry);
result = dns_dispatch_add(
test->dispatch, isc_loop_main(loopmgr), 0, T_CLIENT_CONNECT,
- &tcp_server_addr, NULL, NULL, connected_newtcp, client_senddone,
- response_noop, test, &test->id, &test->dispentry);
+ T_CLIENT_INIT, &tcp_server_addr, NULL, NULL, connected_newtcp,
+ client_senddone, response_noop, test, &test->id,
+ &test->dispentry);
assert_int_equal(result, ISC_R_SUCCESS);
dns_dispatch_connect(test->dispentry);