]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Export DNS flags via ProtoBuf
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 5 Feb 2026 15:54:38 +0000 (16:54 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 5 Feb 2026 15:59:37 +0000 (16:59 +0100)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/dnsdistdist/dnsdist-protobuf.cc

index 6559cfa45487219d0cc3aa58ab5090889e20bd6f..71d1f9d578b40643f91c0c60f5f297515f428c06 100644 (file)
@@ -172,6 +172,14 @@ void DNSDistProtoBufMessage::serialize(std::string& data, bool withOpenTelemetry
 
   msg.setRequest(d_dq.ids.d_protoBufData && d_dq.ids.d_protoBufData->uniqueId ? *d_dq.ids.d_protoBufData->uniqueId : getUniqueID(), d_requestor ? *d_requestor : d_dq.ids.origRemote, d_responder ? *d_responder : d_dq.ids.origDest, d_question ? d_question->d_name : d_dq.ids.qname, d_question ? d_question->d_type : d_dq.ids.qtype, d_question ? d_question->d_class : d_dq.ids.qclass, d_dq.getHeader()->id, protocol, d_bytes ? *d_bytes : d_dq.getData().size());
 
+  try {
+    msg.setHeaderFlags(*getFlagsFromDNSHeader(d_dq.getHeader().get()));
+  }
+  catch (const std::exception& exp) {
+      VERBOSESLOG(infolog("Error while getting the flags from the DNS header of a packet to add them to the protobuf message: %s", exp.what()),
+                  dnsdist::logging::getTopLogger("protobuf")->error(Logr::Info, exp.what(), "Error while getting the flags from the DNS header of a packet to add them to the protobuf message"));
+  }
+
   if (d_serverIdentity) {
     msg.setServerIdentity(*d_serverIdentity);
   }