]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: add a HTTPS, SVCB and NAPTR record types to be exportable via protobuf 14111/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 25 Apr 2024 13:24:15 +0000 (15:24 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 25 Apr 2024 13:29:34 +0000 (15:29 +0200)
contrib/ProtobufLogger.py
pdns/recursordist/docs/lua-config/protobuf.rst
pdns/recursordist/rec-protozero.cc

index dbba1822c83b0e505537b4687185546f3212757c..b4dc9f3d8d76875933183409b83147c31a494c97 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 
 import binascii
 import datetime
@@ -175,7 +175,7 @@ class PDNSPBConnHandler(object):
                 if (rrclass == 1 or rrclass == 255) and rr.HasField('rdata'):
                     if rrtype == 1:
                         rdatastr = socket.inet_ntop(socket.AF_INET, rr.rdata)
-                    elif rrtype == 5:
+                    elif rrtype in (5, 35, 64, 65):
                         rdatastr = rr.rdata
                     elif rrtype == 28:
                         rdatastr = socket.inet_ntop(socket.AF_INET6, rr.rdata)
index 82804f0ae235425ac8dd4c941e6727c02e9c82e1..752e4ab7a74751e28233b5ac0d23d144c65fc07d 100644 (file)
@@ -31,7 +31,7 @@ Protobuf export to a server is enabled using the ``protobufServer()`` directive:
   * ``asyncConnect``: bool - When set to false (default) the first connection to the server during startup will block up to ``timeout`` seconds, otherwise the connection is done in a separate thread, after the first message has been queued
   * ``logQueries=true``: bool - Whether to export queries
   * ``logResponses=true``: bool - Whether to export responses
-  * ``exportTypes={'A', 'AAAA', 'CNAME'}``: list of strings - The list of record types found in the answer section to export. Only A, AAAA, CNAME, MX, NS, PTR, SPF, SRV and TXT are currently supported
+  * ``exportTypes={'A', 'AAAA', 'CNAME'}``: list of strings - The list of record types found in the answer section to export. Record types A, AAAA, CNAME, MX, NS, PTR, SPF, SRV and TXT are supported.
 
   .. versionchanged:: 4.7.0
 
@@ -41,6 +41,10 @@ Protobuf export to a server is enabled using the ``protobufServer()`` directive:
 
   * ``logMappedFrom=false``: bool - whether to log the remote address before substitution by :ref:`proxymapping` (the default) or after
 
+  .. versionchanged:: 5.1.0
+
+     Added support for the HTTPS, SVCB and APTR record types.
+
 .. function:: protobufServer(server [[[[[[[, timeout=2], maxQueuedEntries=100], reconnectWaitTime=1], maskV4=32], maskV6=128], asyncConnect=false], taggedOnly=false])
 
   .. deprecated:: 4.2.0
@@ -85,12 +89,16 @@ While :func:`protobufServer` only exports the queries sent to the recursor from
   * ``asyncConnect``: bool - When set to false (default) the first connection to the server during startup will block up to ``timeout`` seconds, otherwise the connection is done in a separate thread, after the first message has been queued
   * ``logQueries=true``: bool - Whether to export queries
   * ``logResponses=true``: bool - Whether to export responses
-  * ``exportTypes={'A', 'AAAA', 'CNAME'}``: list of strings or qtypes - The list of record types found in the answer section to export. Only A, AAAA, CNAME, MX, NS, PTR, SPF, SRV and TXT are currently supported
+  * ``exportTypes={'A', 'AAAA', 'CNAME'}``: list of strings or qtypes - The list of record types found in the answer section to export. Record types A, AAAA, CNAME, MX, NS, PTR, SPF, SRV and TXT are supported
 
   .. versionchanged:: 4.7.0
 
   The values in ``exportTypes`` can be numeric as well as strings. Symbolic names from ``pdns`` can be used, e.g.  ``exportTypes = { pdns.A, pdns.AAAA, pdns.CNAME }``
 
+  .. versionchanged:: 5.1.0
+
+     Added support for the HTTPS, SVCB and APTR records types.
+
 .. function:: outgoingProtobufServer(server [[[[, timeout=2], maxQueuedEntries=100], reconnectWaitTime=1], asyncConnect=false])
 
   .. deprecated:: 4.2.0
index 957b1457795dc7047b6ca5b5fcc8e4c398c3b56a..bcabe269942b66ae4f0e8d09cb1931d3f53ae85a 100644 (file)
@@ -122,6 +122,30 @@ void pdns::ProtoZero::RecMessage::addRR(const DNSRecord& record, const std::set<
     add(content->d_target.toString());
     break;
   }
+  case QType::SVCB: {
+    const auto& content = getRR<SVCBRecordContent>(record);
+    if (!content) {
+      return;
+    }
+    add(content->getZoneRepresentation());
+    break;
+  }
+  case QType::HTTPS: {
+    const auto& content = getRR<HTTPSRecordContent>(record);
+    if (!content) {
+      return;
+    }
+    add(content->getZoneRepresentation());
+    break;
+  }
+  case QType::NAPTR: {
+    const auto& content = getRR<NAPTRRecordContent>(record);
+    if (!content) {
+      return;
+    }
+    add(content->getZoneRepresentation());
+    break;
+  }
   default:
     break;
   }