]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
fix dnsdist compilation
authorCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Thu, 10 Jun 2021 16:22:20 +0000 (18:22 +0200)
committerCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Wed, 30 Jun 2021 15:47:58 +0000 (17:47 +0200)
pdns/pdns_recursor.cc
pdns/protozero.hh

index f5db6328b226989aaedc77ae3c8d3a90061b645c..4c499f13737175450da5481da7b24af37f2143c4 100644 (file)
@@ -1040,7 +1040,9 @@ static void protobufLogQuery(LocalStateHolder<LuaConfigItems>& luaconfsLocal, co
     m.addPolicyTags(policyTags);
   }
   if (!meta.empty()) {
-    m.setMeta(meta);
+    for (const auto& mit : meta) {
+      m.setMeta(mit.first, mit.second.stringVal, mit.second.intVal);
+    }
   }
 
   std::string msg(m.finishAndMoveBuf());
@@ -1100,7 +1102,9 @@ static void protobufLogResponse(const struct dnsheader* dh, LocalStateHolder<Lua
   pbMessage.setDeviceName(deviceName);
   pbMessage.setFromPort(source.getPort());
   pbMessage.setToPort(destination.getPort());
-  pbMessage.setMeta(meta);
+  for (const auto& m : meta) {
+    pbMessage.setMeta(m.first, m.second.stringVal, m.second.intVal);
+  }
 #ifdef NOD_ENABLED
   if (g_nodEnabled) {
     pbMessage.setNewlyObservedDomain(false);
index 851cb8192cbe39a7c6a847a8d523b69e3d8c6a2a..a7a65e238835449ee088772fe0a9dbb2d4a60db5 100644 (file)
@@ -27,7 +27,6 @@
 #include "iputils.hh"
 #include "gettime.hh"
 #include "uuid-utils.hh"
-#include "lua-recursor4.hh"
 
 namespace pdns {
   namespace ProtoZero {
@@ -37,8 +36,8 @@ namespace pdns {
       enum class MetaValueField : protozero::pbf_tag_type { stringVal = 1, intVal = 2 };
       enum class MetaField : protozero::pbf_tag_type { key = 1, value = 2 };
       enum class MessageType : int32_t { DNSQueryType = 1, DNSResponseType = 2, DNSOutgoingQueryType = 3, DNSIncomingResponseType = 4 };
-      enum class Field : protozero::pbf_tag_type { type = 1, messageId = 2, serverIdentity = 3, socketFamily = 4, socketProtocol = 5, from = 6, to = 7, inBytes = 8, timeSec = 9, timeUsec = 10, id = 11, question = 12, response = 13, originalRequestorSubnet = 14, requestorId = 15, initialRequestId = 16, deviceId = 17, newlyObservedDomain = 18, deviceName = 19, fromPort = 20, toPort = 21, meta = 22};
-      enum class QuestionField : protozero::pbf_tag_type { qName = 1, qType = 2, qClass = 3};
+      enum class Field : protozero::pbf_tag_type { type = 1, messageId = 2, serverIdentity = 3, socketFamily = 4, socketProtocol = 5, from = 6, to = 7, inBytes = 8, timeSec = 9, timeUsec = 10, id = 11, question = 12, response = 13, originalRequestorSubnet = 14, requestorId = 15, initialRequestId = 16, deviceId = 17, newlyObservedDomain = 18, deviceName = 19, fromPort = 20, toPort = 21, meta = 22 };
+      enum class QuestionField : protozero::pbf_tag_type { qName = 1, qType = 2, qClass = 3 };
       enum class ResponseField : protozero::pbf_tag_type { rcode = 1, rrs = 2, appliedPolicy = 3, tags = 4, queryTimeSec = 5, queryTimeUsec = 6, appliedPolicyType = 7, appliedPolicyTrigger = 8, appliedPolicyHit = 9, appliedPolicyKind = 10, validationState = 11 };
       enum class RRField : protozero::pbf_tag_type { name = 1, type = 2, class_ = 3, ttl = 4, rdata = 5, udr = 6 };
 
@@ -121,18 +120,16 @@ namespace pdns {
         pbf_question.add_uint32(static_cast<protozero::pbf_tag_type>(QuestionField::qClass), qclass);
       }
 
-      void setMeta(const std::map<std::string, RecursorLua4::MetaValue>& meta)
+      void setMeta(const std::string& key, const std::unordered_set<std::string>& stringVal, const std::unordered_set<int64_t>& intVal)
       {
-        for (const auto& m : meta) {
-          protozero::pbf_writer pbf_meta{d_message, static_cast<protozero::pbf_tag_type>(Field::meta)};
-          pbf_meta.add_string(static_cast<protozero::pbf_tag_type>(MetaField::key), m.first);
-          protozero::pbf_writer pbf_meta_value{pbf_meta, static_cast<protozero::pbf_tag_type>(MetaField::value)};
-          for (const auto& s: m.second.stringVal) {
-            pbf_meta_value.add_string(static_cast<protozero::pbf_tag_type>(MetaValueField::stringVal), s);
-          }
-          for (const auto& i: m.second.intVal) {
-            pbf_meta_value.add_uint64(static_cast<protozero::pbf_tag_type>(MetaValueField::intVal), i);
-          }
+        protozero::pbf_writer pbf_meta{d_message, static_cast<protozero::pbf_tag_type>(Field::meta)};
+        pbf_meta.add_string(static_cast<protozero::pbf_tag_type>(MetaField::key), key);
+        protozero::pbf_writer pbf_meta_value{pbf_meta, static_cast<protozero::pbf_tag_type>(MetaField::value)};
+        for (const auto& s: stringVal) {
+          pbf_meta_value.add_string(static_cast<protozero::pbf_tag_type>(MetaValueField::stringVal), s);
+        }
+        for (const auto& i: intVal) {
+          pbf_meta_value.add_uint64(static_cast<protozero::pbf_tag_type>(MetaValueField::intVal), i);
         }
       }