]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
zonedb-reload: when recreating zone, replan also refresh...
authorLibor Peltan <libor.peltan@nic.cz>
Wed, 27 Apr 2022 07:50:48 +0000 (09:50 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Thu, 28 Apr 2022 08:02:17 +0000 (10:02 +0200)
...as it might be planned by incomming NOTIFY during zonedb-reload
and in this case its not in timers

src/knot/events/replan.c
tests-extra/tests/zone/reload_notify/test.py [new file with mode: 0644]

index 007ddfa79ef1752dfc9682cadb4792851369992c..da91518cde5a00c058e5bc1d7d12e1c3d2d137f1 100644 (file)
@@ -56,6 +56,7 @@ static void replan_from_zone(zone_t *zone, zone_t *old_zone)
        replan_ddns(zone, old_zone);
 
        const zone_event_type_t types[] = {
+               ZONE_EVENT_REFRESH,
                ZONE_EVENT_FLUSH,
                ZONE_EVENT_BACKUP,
                ZONE_EVENT_NOTIFY,
diff --git a/tests-extra/tests/zone/reload_notify/test.py b/tests-extra/tests/zone/reload_notify/test.py
new file mode 100644 (file)
index 0000000..9709ff5
--- /dev/null
@@ -0,0 +1,40 @@
+#!/usr/bin/env python3
+
+'''Test race conditions about incomming NOTIFY during zonedb-reload'''
+
+from dnstest.test import Test
+from dnstest.utils import *
+
+import random
+import threading
+
+t = Test()
+
+master = t.server("knot")
+slave = t.server("knot")
+zones = t.zone_rnd(60, dnssec=False, records=10)
+t.link(zones, master, slave, ixfr=True)
+
+t.start()
+
+serials = slave.zones_wait(zones)
+
+def send_reload(server):
+    server.ctl("reload")
+
+def send_update(up):
+    up.send()
+
+for z in zones:
+    up = master.update(z)
+    up.add("dojdojwodijowjeojdwe", 3600, "A", "1.2.3.4")
+
+    threading.Thread(target=send_update, args=[up]).start()
+
+t.sleep(random.choice([0.1, 0.2, 0.5, 1, 2, 4]))
+
+slave.reload()
+
+slave.zones_wait(zones, serials)
+
+t.end()