]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Don't enable timeouts in dns_dispatch for incoming transfers
authorOndřej Surý <ondrej@isc.org>
Fri, 20 Sep 2024 13:13:09 +0000 (15:13 +0200)
committerOndřej Surý <ondrej@isc.org>
Sat, 21 Sep 2024 08:15:47 +0000 (10:15 +0200)
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().

lib/dns/xfrin.c

index 3d5a175202717232d17aec7f777941fdbbc863d0..99599b8772ba05bb9e06f867b0aad1faccd26e9d 100644 (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);