Commit 35500368 authored by Libor Peltan's avatar Libor Peltan Committed by Daniel Salzman

knot: master with older serial triggers error

parent c756e492
Pipeline #2074 passed with stages
in 11 minutes and 51 seconds
......@@ -759,13 +759,15 @@ static int soa_query_consume(knot_layer_t *layer, knot_pkt_t *pkt)
uint32_t local_serial = knot_soa_serial(&data->soa->rrs);
uint32_t remote_serial = knot_soa_serial(&rr->rrs);
bool current = serial_is_current(local_serial, remote_serial);
bool master_uptodate = serial_is_current(remote_serial, local_serial);
REFRESH_LOG(LOG_INFO, data->zone->name, data->remote,
"remote serial %u, %s", remote_serial,
current ? "zone is up-to-date" : "zone is outdated");
current ? (master_uptodate ? "zone is up-to-date" :
"master is outdated") : "zone is outdated");
if (current) {
return KNOT_STATE_DONE;
return master_uptodate ? KNOT_STATE_DONE : KNOT_STATE_FAIL;
} else {
data->state = STATE_TRANSFER;
return KNOT_STATE_RESET;
......
$ORIGIN example.
$TTL 1200
@ SOA ns admin 20110102 5 5 13 600
ns AAAA ::0
added A 1.2.3.4
$ORIGIN example.
$TTL 1200
@ SOA ns admin 20110101 25 25 80 600
ns AAAA ::0
#!/usr/bin/env python3
'''Test of Knot behavior when master has older SOA'''
from dnstest.test import Test
EXPIRE_SLEEP = 13
RESYNC_SLEEP = 5
TEST_START_EXPECTED = 3
t = Test()
master = t.server("knot")
slave = t.server("knot")
# this zone has refresh = 5s, retry = 5s and expire = 13s
zone = t.zone("example.", storage=".")
t.link(zone, master, slave)
master.disable_notify = True
slave.disable_notify = True
t.start()
# initial convenience check
master.zone_wait(zone)
slave.zone_wait(zone)
resp = slave.dig("added.example.", "A")
resp.check(rcode="NOERROR", rdata="1.2.3.4")
# check that slave ignored outdated master
master.update_zonefile(zone, version=1)
master.stop()
master.start()
t.sleep(RESYNC_SLEEP - TEST_START_EXPECTED)
resp = master.dig("added.example.", "A")
resp.check(rcode="NXDOMAIN")
resp = slave.dig("added.example.", "A")
resp.check(rcode="NOERROR", rdata="1.2.3.4")
# check that slave bootstrapped older zone
t.sleep(EXPIRE_SLEEP - RESYNC_SLEEP)
resp = slave.dig("added.example.", "A")
resp.check(rcode="NXDOMAIN")
t.stop()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment