#ifdef HAVE_PROTOBUF
#include "dnsmessage.pb.h"
-DNSDistProtoBufMessage::DNSDistProtoBufMessage(const DNSQuestion& dq): DNSProtoBufMessage(Query, dq.uniqueId, dq.remote, dq.local, *dq.qname, dq.qtype, dq.qclass, dq.dh->id, dq.tcp, dq.len)
+DNSDistProtoBufMessage::DNSDistProtoBufMessage(const DNSQuestion& dq): DNSProtoBufMessage(Query, dq.uniqueId ? *dq.uniqueId : t_uuidGenerator(), dq.remote, dq.local, *dq.qname, dq.qtype, dq.qclass, dq.dh->id, dq.tcp, dq.len)
{
};
-DNSDistProtoBufMessage::DNSDistProtoBufMessage(const DNSResponse& dr, bool includeCNAME): DNSProtoBufMessage(Response, dr.uniqueId, dr.remote, dr.local, *dr.qname, dr.qtype, dr.qclass, dr.dh->id, dr.tcp, dr.len)
+DNSDistProtoBufMessage::DNSDistProtoBufMessage(const DNSResponse& dr, bool includeCNAME): DNSProtoBufMessage(Response, dr.uniqueId ? *dr.uniqueId : t_uuidGenerator(), dr.remote, dr.local, *dr.qname, dr.qtype, dr.qclass, dr.dh->id, dr.tcp, dr.len)
{
setQueryTime(dr.queryTime->tv_sec, dr.queryTime->tv_nsec / 1000);
setResponseCode(dr.dh->rcode);
unsigned int consumed = 0;
DNSName qname(query, qlen, sizeof(dnsheader), false, &qtype, &qclass, &consumed);
DNSQuestion dq(&qname, qtype, qclass, &dest, &ci.remote, dh, queryBuffer.capacity(), qlen, true);
-#ifdef HAVE_PROTOBUF
- dq.uniqueId = t_uuidGenerator();
-#endif
string poolname;
int delayMsec=0;
DNSName qname(query, len, sizeof(dnsheader), false, &qtype, &qclass, &consumed);
DNSQuestion dq(&qname, qtype, qclass, dest.sin4.sin_family != 0 ? &dest : &cs.local, &remote, dh, queryBufferSize, len, false);
-#ifdef HAVE_PROTOBUF
- dq.uniqueId = t_uuidGenerator();
-#endif
-
string poolname;
int delayMsec = 0;
/* we need an accurate ("real") value for the response and
DNSQuestion(const DNSName* name, uint16_t type, uint16_t class_, const ComboAddress* lc, const ComboAddress* rem, struct dnsheader* header, size_t bufferSize, uint16_t queryLen, bool isTcp): qname(name), qtype(type), qclass(class_), local(lc), remote(rem), dh(header), size(bufferSize), len(queryLen), ecsPrefixLength(rem->sin4.sin_family == AF_INET ? g_ECSSourcePrefixV4 : g_ECSSourcePrefixV6), tcp(isTcp), ecsOverride(g_ECSOverride) { }
#ifdef HAVE_PROTOBUF
- boost::uuids::uuid uniqueId;
+ boost::optional<boost::uuids::uuid> uniqueId;
#endif
const DNSName* qname;
const uint16_t qtype;
std::shared_ptr<DnsCryptQuery> dnsCryptQuery{0};
#endif
#ifdef HAVE_PROTOBUF
- boost::uuids::uuid uniqueId;
+ boost::optional<boost::uuids::uuid> uniqueId;
#endif
std::shared_ptr<DNSDistPacketCache> packetCache{nullptr};
const ClientState* cs{nullptr};
DNSAction::Action operator()(DNSQuestion* dq, string* ruleresult) const override
{
#ifdef HAVE_PROTOBUF
+ if (!dq->uniqueId) {
+ dq->uniqueId = t_uuidGenerator();
+ }
+
DNSDistProtoBufMessage message(*dq);
{
if (d_alterFunc) {
DNSResponseAction::Action operator()(DNSResponse* dr, string* ruleresult) const override
{
#ifdef HAVE_PROTOBUF
+ if (!dr->uniqueId) {
+ dr->uniqueId = t_uuidGenerator();
+ }
+
DNSDistProtoBufMessage message(*dr, d_includeCNAME);
{
if (d_alterFunc) {