]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Check setting only once per loop, avoid DB lookups 11916/head
authorChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Sun, 14 Aug 2022 13:42:38 +0000 (15:42 +0200)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Thu, 8 Sep 2022 10:33:29 +0000 (12:33 +0200)
(cherry picked from commit f16a341fcee15e0fe66ac5ff227a70c8158eeaa8)

docs/settings.rst
pdns/slavecommunicator.cc

index 6f94bbccffe9188a68d76b1f1a9f0ae281832adc..b02952d83f532cdc47c138368a5b21e676024b5e 100644 (file)
@@ -289,7 +289,7 @@ signatures in the SOA response.
 
 In some problematic scenarios, primary servers send truncated SOA responses. As a workaround, this setting
 can be turned off, and the DO flag as well as the signature checking will be disabled. To avoid additional
-drift, primary servers then must always increase the zone serial on signature changes.
+drift, primary servers must then always increase the zone serial when it updates signatures.
 
 It is strongly recommended to keep this setting enabled (`yes`).
 
index d71f3c0aba17203c76cc73a738a2a0fef4e4a40d..fe5c40a5aaa151522090d7cf893f051707121fb5 100644 (file)
@@ -1154,6 +1154,7 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P)
   }
   sdomains.reserve(rdomains.size());
   DNSSECKeeper dk(B); // NOW HEAR THIS! This DK uses our B backend, so no interleaved access!
+  bool checkSignatures = ::arg().mustDo("secondary-check-signature-freshness") && dk.doesDNSSEC();
   {
     auto data = d_data.lock();
     domains_by_name_t& nameindex=boost::multi_index::get<IDTag>(data->d_suckdomains);
@@ -1181,12 +1182,8 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P)
       }
 
       DomainNotificationInfo dni;
-      dni.di=di;
-      if (::arg().mustDo("secondary-check-signature-freshness")) {
-        dni.dnssecOk = dk.doesDNSSEC();
-      } else {
-        dni.dnssecOk = false;
-      }
+      dni.di = di;
+      dni.dnssecOk = checkSignatures;
 
       if(dk.getTSIGForAccess(di.zone, sr.master, &dni.tsigkeyname)) {
         string secret64;
@@ -1331,7 +1328,7 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P)
     }
     else if(hasSOA && theirserial == ourserial) {
       uint32_t maxExpire=0, maxInception=0;
-      if(dk.isPresigned(di.zone) && ::arg().mustDo("secondary-check-signature-freshness")) {
+      if(checkSignatures && dk.isPresigned(di.zone)) {
         B->lookup(QType(QType::RRSIG), di.zone, di.id); // can't use DK before we are done with this lookup!
         DNSZoneRecord zr;
         while(B->get(zr)) {