]> git.ipfire.org Git - thirdparty/bind9.git/commit
xfrin: refactor and fix the ISC_R_CANCELED case handling
authorAram Sargsyan <aram@isc.org>
Tue, 26 Nov 2024 12:06:03 +0000 (12:06 +0000)
committerAram Sargsyan <aram@isc.org>
Wed, 27 Nov 2024 10:37:13 +0000 (10:37 +0000)
commit3262ebd0f3fb53a471c7d736ea32710f26dcd509
tree93eb95b19c7de287d512a1d670d63aa27b3f2f98
parent1c4a34a3ab9b0b5175d51a7030f7d1aefafc49b1
xfrin: refactor and fix the ISC_R_CANCELED case handling

Previously a ISC_R_CANCELED result code switch-case has been added to
the zone.c:zone_xfrdone() function, which did two things:

1. Schedule a new zone transfer if there's a scheduled force reload of
   the zone.

2. Reset the primaries list.

This proved to be not a well-thought change and causes problems,
because the ISC_R_CANCELED code is used not only when the whole transfer
is canceled, but also when, for example, a particular primary server is
unreachable, and named still needs to continue the transfer process by
trying the next server, which it now no longer does in some cases. To
solve this issue, three changes are made:

1. Make sure dns_zone_refresh() runs on the zone's loop, so that the
   sequential calls of dns_zone_stopxfr() and dns_zone_forcexfr()
   functions (like done in 'rndc retransfer -force') run in intended
   order and don't race with each other.

2. Since starting the new transfer is now guaranteed to run after the
   previous transfer is shut down (see the previous change), remove the
   special handling of the ISC_R_CANCELED case, and let the default
   handler to handle it like before. This will bring back the ability to
   try the next primary if the current one was interrupted with a
   ISC_R_CANCELED result code.

3. Change the xfrin.c:xfrin_shutdown() function to pass the
   ISC_R_SHUTTINGDOWN result code instead of ISC_R_CANCELED, as it makes
   more sense.
bin/tests/system/xfer/tests.sh
lib/dns/xfrin.c
lib/dns/zone.c