Merge branch '3983-secondary-loadtime-bind-9.18' into 'bind-9.18'

[9.18] set loadtime during initial transfer of a secondary zone

See merge request isc-projects/bind9!8498
This commit is contained in:
Evan Hunt 2023-11-16 05:53:00 +00:00
commit 4e31215c20
2 changed files with 11 additions and 7 deletions

View file

@ -19,7 +19,6 @@ fmt = "%Y-%m-%dT%H:%M:%SZ"
# The constants were taken from BIND 9 source code (lib/dns/zone.c)
max_refresh = timedelta(seconds=2419200) # 4 weeks
max_expires = timedelta(seconds=14515200) # 24 weeks
now = datetime.utcnow().replace(microsecond=0)
dayzero = datetime.utcfromtimestamp(0).replace(microsecond=0)
@ -34,21 +33,20 @@ def check_refresh(refresh, min_time, max_time):
assert refresh <= max_time
def check_loaded(loaded, expected): # pylint: disable=unused-argument
def check_loaded(loaded, expected, now):
# Sanity check the zone timers values
# NOTE This check has been disabled due to GL #3983
# assert loaded == expected
# assert loaded < now
pass
assert loaded == expected
assert loaded <= now
def check_zone_timers(loaded, expires, refresh, loaded_exp):
now = datetime.utcnow().replace(microsecond=0)
# Sanity checks the zone timers values
if expires is not None:
check_expires(expires, now, now + max_expires)
if refresh is not None:
check_refresh(refresh, now, now + max_refresh)
check_loaded(loaded, loaded_exp)
check_loaded(loaded, loaded_exp, now)
#

View file

@ -17662,6 +17662,12 @@ again:
DNS_ZONE_TIME_ADD(&now, zone->expire,
&zone->expiretime);
}
/*
* Set loadtime.
*/
zone->loadtime = now;
if (result == ISC_R_SUCCESS && xfrresult == ISC_R_SUCCESS) {
char buf[DNS_NAME_FORMATSIZE + sizeof(": TSIG ''")];
if (zone->tsigkey != NULL) {