]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
print scope if available
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Thu, 18 Jul 2024 17:48:26 +0000 (19:48 +0200)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Thu, 18 Jul 2024 17:48:26 +0000 (19:48 +0200)
pdns/pdnsutil.cc

index f84a31b24fcc712f95f0a4efdf315cf22f2bdc96..346a47362be221215205d9cbff7cc9dba956c1f7 100644 (file)
@@ -4257,8 +4257,9 @@ try
     DNSName name{cmds.at(2)};
 
     DNSPacket queryPacket(true);
+    Netmask clientNetmask;
     if (cmds.size() > 4) {
-      Netmask clientNetmask(cmds.at(4));
+      clientNetmask = cmds.at(4);
       queryPacket.setRealRemote(clientNetmask);
     }
 
@@ -4267,7 +4268,12 @@ try
     bool found = false;
     DNSZoneRecord resultZoneRecord;
     while (matchingBackend->get(resultZoneRecord)) {
-      cout << resultZoneRecord.dr.d_name.toString() << "\t" << std::to_string(resultZoneRecord.dr.d_ttl) << "\t" << QClass(resultZoneRecord.dr.d_class).toString() << "\t" << DNSRecordContent::NumberToType(resultZoneRecord.dr.d_type, resultZoneRecord.dr.d_class) << "\t" << resultZoneRecord.dr.getContent()->getZoneRepresentation() << endl;
+      cout << resultZoneRecord.dr.d_name.toString() << "\t" << std::to_string(resultZoneRecord.dr.d_ttl) << "\t" << QClass(resultZoneRecord.dr.d_class).toString() << "\t" << DNSRecordContent::NumberToType(resultZoneRecord.dr.d_type, resultZoneRecord.dr.d_class) << "\t" << resultZoneRecord.dr.getContent()->getZoneRepresentation();
+      if (resultZoneRecord.scopeMask > 0) {
+        clientNetmask.setBits(resultZoneRecord.scopeMask);
+        cout << "\t" << "; " << clientNetmask.toString();
+      }
+      cout << endl;
       found = true;
     }
     if (!found) {