From 288ccae9f1e2dfd20373abfe6887ff676f6560f4 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Mon, 22 Dec 2025 14:14:46 +0100 Subject: [PATCH] Let pdnsutil advise refreshing the zone cache upon zone creation. Signed-off-by: Miod Vallat --- pdns/pdnsutil.cc | 5 +++++ .../gsqlite3-corrupted-record/expected_result | 2 ++ .../lmdb-id-generation/expected_result | 4 ++++ .../lmdb-metadata-leak/expected_result | 4 ++++ regression-tests/tests/zone-variants/expected_result.lmdb | 6 ++++++ 5 files changed, 21 insertions(+) diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index e654857ce0..a606521136 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -686,6 +686,7 @@ static void loadMainConfig(const std::string& configdir) ::arg().set("cache-ttl","Seconds to store packets in the PacketCache")="20"; ::arg().set("negquery-cache-ttl","Seconds to store negative query results in the QueryCache")="60"; ::arg().set("query-cache-ttl","Seconds to store query results in the QueryCache")="20"; + ::arg().set("zone-cache-refresh-interval", "Seconds to cache list of known zones") = "300"; ::arg().set("default-soa-content","Default SOA content")="a.misconfigured.dns.server.invalid hostmaster.@ 0 10800 3600 604800 3600"; ::arg().set("chroot","Switch to this chroot jail")=""; ::arg().set("dnssec-key-cache-ttl","Seconds to cache DNSSEC keys from the database")="30"; @@ -2653,6 +2654,10 @@ static int createZone(const ZoneName &zone, const DNSName& nsname) { } } + if (::arg().asNum("zone-cache-refresh-interval") != 0) { + cout << "If the authoritative server is running, be sure to refresh its zone cache" << endl << "with 'pdns_control rediscover'" << endl; + } + return EXIT_SUCCESS; } diff --git a/regression-tests.nobackend/gsqlite3-corrupted-record/expected_result b/regression-tests.nobackend/gsqlite3-corrupted-record/expected_result index 343b6d22db..23ad966072 100644 --- a/regression-tests.nobackend/gsqlite3-corrupted-record/expected_result +++ b/regression-tests.nobackend/gsqlite3-corrupted-record/expected_result @@ -1,3 +1,5 @@ +If the authoritative server is running, be sure to refresh its zone cache +with 'pdns_control rediscover' New rrset: bug.less. 3600 IN NS no.bug.less. New rrset: diff --git a/regression-tests.nobackend/lmdb-id-generation/expected_result b/regression-tests.nobackend/lmdb-id-generation/expected_result index 127b73f596..d5848e1ab1 100644 --- a/regression-tests.nobackend/lmdb-id-generation/expected_result +++ b/regression-tests.nobackend/lmdb-id-generation/expected_result @@ -1,2 +1,6 @@ +If the authoritative server is running, be sure to refresh its zone cache +with 'pdns_control rediscover' sequential generator generated 1 2 3 correctly +If the authoritative server is running, be sure to refresh its zone cache +with 'pdns_control rediscover' random generator generated something other than 1 2 3, good diff --git a/regression-tests.nobackend/lmdb-metadata-leak/expected_result b/regression-tests.nobackend/lmdb-metadata-leak/expected_result index 8e5e29d5c6..b9a8736e07 100644 --- a/regression-tests.nobackend/lmdb-metadata-leak/expected_result +++ b/regression-tests.nobackend/lmdb-metadata-leak/expected_result @@ -1,5 +1,7 @@ === random=no == creating zone +If the authoritative server is running, be sure to refresh its zone cache +with 'pdns_control rediscover' WARNING: local files have been created as a result of this operation. Be sure to check the files owner, group and permission to make sure that the authoritative server can correctly use them. @@ -19,6 +21,8 @@ FOO2 == deleting zone === random=yes == creating zone +If the authoritative server is running, be sure to refresh its zone cache +with 'pdns_control rediscover' WARNING: local files have been created as a result of this operation. Be sure to check the files owner, group and permission to make sure that the authoritative server can correctly use them. diff --git a/regression-tests/tests/zone-variants/expected_result.lmdb b/regression-tests/tests/zone-variants/expected_result.lmdb index 9fbb87d32c..a4fd54aade 100644 --- a/regression-tests/tests/zone-variants/expected_result.lmdb +++ b/regression-tests/tests/zone-variants/expected_result.lmdb @@ -1,4 +1,6 @@ Creating empty zone 'example.com..variant1' +If the authoritative server is running, be sure to refresh its zone cache +with 'pdns_control rediscover' This is a Native zone Variant: variant1 Zone is not actively secured @@ -6,6 +8,8 @@ Metadata items: SOA-EDIT-API DEFAULT No keys for zone 'example.com..variant1'. Creating empty zone '..myroot' +If the authoritative server is running, be sure to refresh its zone cache +with 'pdns_control rediscover' This is a Native zone Variant: myroot Zone is not actively secured @@ -13,6 +17,8 @@ Metadata items: SOA-EDIT-API DEFAULT No keys for zone '..myroot'. Creating empty zone '.' +If the authoritative server is running, be sure to refresh its zone cache +with 'pdns_control rediscover' This is a Native zone Zone is not actively secured Metadata items: -- 2.47.3