}
required Type type = 1;
optional bytes messageId = 2; // UUID, shared by the query and the response
- optional bytes serverIdentity = 3; // UUID of the server emitting the protobuf message
+ optional bytes serverIdentity = 3; // ID of the server emitting the protobuf message
optional SocketFamily socketFamily = 4;
optional SocketProtocol socketProtocol = 5;
optional bytes from = 6; // DNS requestor (client)
return;
RecProtoBufMessage message(DNSProtoBufMessage::OutgoingQuery, uuid, nullptr, &ip, domain, type, QClass::IN, qid, doTCP, bytes);
+ message.setServerIdentity(SyncRes::s_serverID);
+
if (initialRequestId) {
message.setInitialRequestID(*initialRequestId);
}
return;
RecProtoBufMessage message(DNSProtoBufMessage::IncomingResponse, uuid, nullptr, &ip, domain, type, QClass::IN, qid, doTCP, bytes);
+ message.setServerIdentity(SyncRes::s_serverID);
if (initialRequestId) {
message.setInitialRequestID(*initialRequestId);
}
Netmask requestorNM(remote, remote.sin4.sin_family == AF_INET ? maskV4 : maskV6);
const ComboAddress& requestor = requestorNM.getMaskedNetwork();
RecProtoBufMessage message(DNSProtoBufMessage::Query, uniqueId, &requestor, &local, qname, qtype, qclass, id, tcp, len);
+ message.setServerIdentity(SyncRes::s_serverID);
message.setEDNSSubnet(ednssubnet, ednssubnet.isIpv4() ? maskV4 : maskV6);
message.setRequestorId(requestorId);
message.setDeviceId(deviceId);
Netmask requestorNM(dc->d_source, dc->d_source.sin4.sin_family == AF_INET ? luaconfsLocal->protobufMaskV4 : luaconfsLocal->protobufMaskV6);
const ComboAddress& requestor = requestorNM.getMaskedNetwork();
pbMessage = RecProtoBufMessage(RecProtoBufMessage::Response);
+ pbMessage->setServerIdentity(SyncRes::s_serverID);
pbMessage->update(dc->d_uuid, &requestor, &dc->d_destination, dc->d_tcp, dc->d_mdp.d_header.id);
pbMessage->setEDNSSubnet(dc->d_ednssubnet.source, dc->d_ednssubnet.source.isIpv4() ? luaconfsLocal->protobufMaskV4 : luaconfsLocal->protobufMaskV6);
pbMessage->setQuestion(dc->d_mdp.d_qname, dc->d_mdp.d_qtype, dc->d_mdp.d_qclass);
#ifdef HAVE_PROTOBUF
if(t_protobufServer) {
pbMessage = RecProtoBufMessage(DNSProtoBufMessage::DNSProtoBufMessageType::Response);
+ pbMessage->setServerIdentity(SyncRes::s_serverID);
if (logQuery && !(luaconfsLocal->protobufExportConfig.taggedOnly && policyTags.empty())) {
protobufLogQuery(t_protobufServer, luaconfsLocal->protobufMaskV4, luaconfsLocal->protobufMaskV6, uniqueId, source, destination, ednssubnet.source, false, dh->id, question.size(), qname, qtype, qclass, policyTags, requestorId, deviceId);
}
#endif /* HAVE_PROTOBUF */
}
+void DNSProtoBufMessage::setServerIdentity(const std::string& serverId)
+{
+#ifdef HAVE_PROTOBUF
+ d_message.set_serveridentity(serverId);
+#endif /* HAVE_PROTOBUF */
+}
+
void DNSProtoBufMessage::setResponder(const std::string& responder)
{
#ifdef HAVE_PROTOBUF
void setResponder(const ComboAddress& responder);
void setRequestorId(const std::string& requestorId);
void setDeviceId(const std::string& deviceId);
+ void setServerIdentity(const std::string& serverId);
std::string toDebugString() const;
void addTag(const std::string& strValue);
void addRR(const DNSName& qame, uint16_t utype, uint16_t uClass, uint32_t uTTl, const std::string& strBlob);
self.assertTrue(msg.HasField('socketProtocol'))
self.assertEquals(msg.socketProtocol, protocol)
self.assertTrue(msg.HasField('messageId'))
+ self.assertTrue(msg.HasField('serverIdentity'))
self.assertTrue(msg.HasField('id'))
self.assertEquals(msg.id, query.id)
self.assertTrue(msg.HasField('inBytes'))
self.assertTrue(msg.HasField('socketProtocol'))
self.assertEquals(msg.socketProtocol, protocol)
self.assertTrue(msg.HasField('messageId'))
+ self.assertTrue(msg.HasField('serverIdentity'))
self.assertTrue(msg.HasField('id'))
self.assertNotEquals(msg.id, query.id)
self.assertTrue(msg.HasField('inBytes'))