]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
set loadtime during initial transfer of a secondary zone
authorEvan Hunt <each@isc.org>
Sat, 11 Nov 2023 21:15:27 +0000 (13:15 -0800)
committerEvan Hunt <each@isc.org>
Thu, 16 Nov 2023 02:06:58 +0000 (18:06 -0800)
when transferring in a non-inline-signing secondary for the first time,
we previously never set the value of zone->loadtime, so it remained
zero. this caused a test failure in the statschannel system test,
and that test case was temporarily disabled.  the value is now set
correctly and the test case has been reinstated.

(cherry picked from commit 964328145383d2c95377f48e61ea9f05cfb6d8a7)

bin/tests/system/statschannel/generic.py
lib/dns/zone.c

index bf4b0389927441818a8ec61d4c40f5b504e4f6fa..9e926537cc10ce932f0332cd1faa5a238c2d067f 100644 (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)
 
 
 #
index ad49b3bf9786faeb8cba3c82d9813f454dde362f..3b9513674d4aa00d5f2dee4cfbb37e90bef2c220 100644 (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) {