2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Don't enable timeouts in dns_dispatch for incoming transfers

The dns_dispatch_add() call in the dns_xfrin unit had hardcoded 30
second limit.  This meant that any incoming transfer would be stopped in
it didn't finish within 30 seconds limit.  Additionally, dns_xfrin
callback was ignoring the return value from dns_dispatch_getnext() when
restarting the reading from the TCP stream; this could cause transfers
to get stuck waiting for a callback that would never come due to the
dns_dispatch having already been shut down.

Call the dns_dispatch_add() without a timeout and properly handle the
result code from the dns_dispatch_getnext().
This commit is contained in:
Ondřej Surý
2024-09-20 15:13:09 +02:00
parent 0f810b3144
commit 96ef98558c

View File

@@ -1268,15 +1268,10 @@ xfrin_start(dns_xfrin_t *xfr) {
dns_xfrin_gettransporttype(xfr));
}
/*
* XXX: timeouts are hard-coded to 30 seconds; this needs to be
* configurable.
*/
CHECK(dns_dispatch_add(xfr->disp, xfr->loop, 0, 30000,
&xfr->primaryaddr, xfr->transport,
xfr->tlsctx_cache, xfrin_connect_done,
xfrin_send_done, xfrin_recv_done, xfr, &xfr->id,
&xfr->dispentry));
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));
/* Set the maximum timer */
if (xfr->max_time_timer == NULL) {
@@ -1994,7 +1989,10 @@ xfrin_recv_done(isc_result_t result, isc_region_t *region, void *arg) {
* Read the next message.
*/
dns_message_detach(&msg);
dns_dispatch_getnext(xfr->dispentry);
result = dns_dispatch_getnext(xfr->dispentry);
if (result != ISC_R_SUCCESS) {
goto failure;
}
isc_interval_t interval;
isc_interval_set(&interval, dns_zone_getidlein(xfr->zone), 0);