]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec docs: describe followCNAMERecords better 17033/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 25 Mar 2026 08:52:12 +0000 (09:52 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 25 Mar 2026 08:52:12 +0000 (09:52 +0100)
While working on this, I noted it is underspecified *which* CNAME
record is followed, but that is for some other time.

Fixes #17030

Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
pdns/recursordist/docs/lua-scripting/hooks.rst
pdns/recursordist/pdns_recursor.cc

index 953e609c6e9017eb06f0dfb5f75887ad3c72d09a..0b078afa7203485384766206d102e1791e31dfbd 100644 (file)
@@ -302,16 +302,16 @@ dq.followupPrefix to the same prefix as used with
 
 Follow up actions
 -----------------
-When modifying queries, it might be needed that the Recursor does some extra work after the function returns.
+When modifying queries, it might be needed that the :program:`Recursor` does some extra work after the function returns.
 The :attr:`dq.followupFunction <DNSQuestion.followupFunction>` can be set in this case.
 
 .. _cnamechainresolution:
 
 CNAME chain resolution
 ^^^^^^^^^^^^^^^^^^^^^^
-It may be useful to return a CNAME record for Lua, and then have the PowerDNS Recursor continue resolving that CNAME.
-This can be achieved by setting dq.followupFunction to ``followCNAMERecords`` and dq.followupDomain to "www.powerdns.com".
-PowerDNS will do the rest.
+It may be useful to return a ``CNAME`` record for Lua, and then have :program:`Recursor` continue resolving that ``CNAME``.
+This can be achieved by adding or setting a ``CNAME`` record and setting :attr:`dq.followupFunction <DNSQuestion.followupFunction>` to ``"followCNAMERecords"``.
+:program:`Recursor` will inspect the current records and resolve the ``CNAME`` found.
 
 .. _udpqueryresponse:
 
index e9618b99f6fdc41514b9fadc88677b960a5c4116..b1c2b39217354e620e717aa7e8a2f72a5587d3d8 100644 (file)
@@ -702,6 +702,9 @@ int followCNAMERecords(vector<DNSRecord>& ret, const QType qtype, int rcode)
 {
   vector<DNSRecord> resolved;
   DNSName target;
+  // Docs do not specify *which* CNAME is picked. We take the first
+  // and do not mind the section. Maybe the last in the answer section
+  // would be what users expect?
   for (const DNSRecord& record : ret) {
     if (record.d_type == QType::CNAME) {
       auto rec = getRR<CNAMERecordContent>(record);