From: Otto Moerbeek Date: Tue, 5 Nov 2024 12:38:06 +0000 (+0100) Subject: Apply suggestions from code review X-Git-Tag: rec-5.2.0-alpha1~7^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6937b2e819f47d9114480c9579240210286e6236;p=thirdparty%2Fpdns.git Apply suggestions from code review Co-authored-by: Remi Gacogne --- diff --git a/pdns/recursordist/rec-xfr.cc b/pdns/recursordist/rec-xfr.cc index 3fa26e0c89..fc26abf1fb 100644 --- a/pdns/recursordist/rec-xfr.cc +++ b/pdns/recursordist/rec-xfr.cc @@ -75,7 +75,7 @@ void CatalogZone::remove(const DNSRecord& record, Logr::log_t logger) d_records.erase(std::make_pair(key, record.d_type)); } -void CatalogZone::registerForwarders(const FWCatz& params, Logr::log_t logger) +void CatalogZone::registerForwarders(const FWCatz& params, Logr::log_t logger) const { const string zonesFile = ::arg()["api-config-dir"] + "/catzone." + d_name.toString(); ::rust::Vec<::pdns::rust::settings::rec::ForwardZone> forwards; @@ -231,7 +231,7 @@ static shared_ptr loadZoneFromServer(Logr::log_t plogger return soaRecordContent; } -void FWCatZoneXFR::preloadZoneFile(const DNSName& zoneName, std::shared_ptr& oldZone, uint32_t& refresh, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger) +void FWCatZoneXFR::preloadZoneFile(const DNSName& zoneName, const std::shared_ptr& oldZone, uint32_t& refresh, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger) { while (!d_params.soaRecordContent) { /* if we received an empty sr, the zone was not really preloaded */ @@ -283,7 +283,7 @@ void FWCatZoneXFR::preloadZoneFile(const DNSName& zoneName, std::shared_ptr& oldZone, uint32_t& refresh, bool& skipRefreshDelay, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger) +bool FWCatZoneXFR::zoneTrackerIteration(const DNSName& zoneName, std::shared_ptr& oldZone, uint32_t& refresh, bool& skipRefreshDelay, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger) { // Don't hold on to oldZone, it well be re-assigned after sleep in the try block oldZone = nullptr; @@ -466,7 +466,7 @@ void FWCatZoneXFR::zoneXFRTracker(ZoneXFRParams params, uint64_t configGeneratio ZoneWaiter waiter(std::this_thread::get_id()); /* we can _never_ modify this zone directly, we need to do a full copy then replace the existing zone */ - std::shared_ptr oldZone; + std::shared_ptr oldZone; if (params.zoneIdx < g_luaconfs.getLocal()->catalogzones.size()) { oldZone = g_luaconfs.getLocal()->catalogzones.at(params.zoneIdx).d_catz; } diff --git a/pdns/recursordist/rec-xfr.hh b/pdns/recursordist/rec-xfr.hh index cd5f8db67b..b6910610d2 100644 --- a/pdns/recursordist/rec-xfr.hh +++ b/pdns/recursordist/rec-xfr.hh @@ -82,7 +82,7 @@ public: } void add(const DNSRecord& record, Logr::log_t logger); void remove(const DNSRecord& record, Logr::log_t logger); - void registerForwarders(const FWCatz& params, Logr::log_t logger); + void registerForwarders(const FWCatz& params, Logr::log_t logger) const; [[nodiscard]] bool versionCheck() const; [[nodiscard]] bool dupsCheck() const; @@ -140,8 +140,8 @@ public: static void zoneXFRTracker(ZoneXFRParams params, uint64_t configGeneration); private: - void preloadZoneFile(const DNSName& zoneName, std::shared_ptr& oldZone, uint32_t& refresh, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger); - bool zoneTrackerIteration(const DNSName& zoneName, std::shared_ptr& oldZone, uint32_t& refresh, bool& skipRefreshDelay, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger); + void preloadZoneFile(const DNSName& zoneName, const std::shared_ptr& oldZone, uint32_t& refresh, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger); + bool zoneTrackerIteration(const DNSName& zoneName, std::shared_ptr& oldZone, uint32_t& refresh, bool& skipRefreshDelay, uint64_t configGeneration, ZoneWaiter& waiter, Logr::log_t logger); }; std::string reloadZoneConfiguration(bool yaml); diff --git a/pdns/recursordist/settings/docs-new-preamble-in.rst b/pdns/recursordist/settings/docs-new-preamble-in.rst index 91acec8993..1861501863 100644 --- a/pdns/recursordist/settings/docs-new-preamble-in.rst +++ b/pdns/recursordist/settings/docs-new-preamble-in.rst @@ -488,7 +488,7 @@ As of version 5.2.0, a forwarding catalog zone entry is defined as: algo: string secret: base64string refresh: number, default not set - maxReceivedMBytes: number default not set + maxReceivedMBytes: number, default not set localAddress: IP address, default not set axfrTimeout: number, default 20 groups: @@ -497,7 +497,7 @@ As of version 5.2.0, a forwarding catalog zone entry is defined as: recurse: bool, default false notify: bool, default false -An example of an ``forwarding_catalog_zones`` entry, which is a sequence of `ForwardingCatalogZone`_: +An example of a ``forwarding_catalog_zones`` entry, which is a sequence of `ForwardingCatalogZone`_: .. code-block:: yaml @@ -518,8 +518,8 @@ An example of an ``forwarding_catalog_zones`` entry, which is a sequence of `For - forwarders: [192.168.178.3] # only default forwarder for 2nd catalog zone :program:`Recursor` will transfer the catalog zone from the authoritative server using IXFR (falling back to AXFR if needed) and add forwarding clauses for all members of the catalog zone. -The forwarding paremeters will be taken from the default group entry (the one without a name) defined in the YAML settings. -For catalog zone members in a group, the forwarding parameters will be taken from the group entry with the correspoding name. +The forwarding parameters will be taken from the default group entry (the one without a name) defined in the YAML settings. +For catalog zone members in a group, the forwarding parameters will be taken from the group entry with the corresponding name. The forwarding definitions will be written into a file ``$api_dir/catzone.$zonename``. :ref:`setting-yaml-webservice.api_dir` must be defined, the directory must exist and be writable by the :program:`Recursor` process.