From: Miod Vallat Date: Fri, 12 Dec 2025 09:46:16 +0000 (+0100) Subject: When creating a domain as part of autosecondary, schedule a fetch immediately. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf5bef5aa28addeb9897aa2483fccf5b64a775ff;p=thirdparty%2Fpdns.git When creating a domain as part of autosecondary, schedule a fetch immediately. Fixes #16418 Signed-off-by: Miod Vallat --- diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index 983a32096a..76694830de 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -1047,19 +1047,17 @@ How SQL backends implement this: */ -int PacketHandler::tryAutoPrimary(const DNSPacket& p, const DNSName& tsigkeyname) +int PacketHandler::tryAutoPrimary(const DNSPacket& p) { - if(p.d_tcp) - { - // do it right now if the client is TCP - // rarely happens - return tryAutoPrimarySynchronous(p, tsigkeyname); + if(p.d_tcp) { + // Do it right now if the client is TCP (rarely happens) + return tryAutoPrimarySynchronous(p, p.getTSIGKeyname()); } - else - { - // queue it if the client is on UDP + else { + // Queue it if the client is on UDP; the communicator will invoke + // tryAutoPrimarySynchronous later. Communicator.addTryAutoPrimaryRequest(p); - return 0; + return RCode::NoError; } } @@ -1128,6 +1126,9 @@ int PacketHandler::tryAutoPrimarySynchronous(const DNSPacket& p, const DNSName& meta.push_back(tsigkeyname.toStringNoDot()); db->setDomainMetadata(zonename, "AXFR-MASTER-TSIG", meta); } + // Now that we have created the secondary, fetch its contents. + di.receivedNotify = true; + Communicator.addSecondaryCheckRequest(di, p.getInnerRemote()); } catch(PDNSException& ae) { g_log << Logger::Error << "Database error trying to create " << zonename << " for potential autoprimary " << remote << ": " << ae.reason << endl; @@ -1187,7 +1188,7 @@ int PacketHandler::processNotify(const DNSPacket& p) if(!B.getDomainInfo(zonename, di, false) || di.backend == nullptr) { if(::arg().mustDo("autosecondary")) { g_log << Logger::Warning << "Received NOTIFY for " << zonename << " from " << p.getRemoteString() << " for which we are not authoritative, trying autoprimary" << endl; - return tryAutoPrimary(p, p.getTSIGKeyname()); + return tryAutoPrimary(p); } g_log< s_deleteCDSContent; private: - int tryAutoPrimary(const DNSPacket& p, const DNSName& tsigkeyname); + int tryAutoPrimary(const DNSPacket& p); int processNotify(const DNSPacket& ); void addRootReferral(DNSPacket& r); int doChaosRequest(const DNSPacket& p, std::unique_ptr& r, DNSName &target) const;