reply with cname

This commit is contained in:
Jeff Becker 2019-02-05 09:03:38 -05:00
parent 0bbd1ecbe4
commit 8c77c53675
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
2 changed files with 15 additions and 11 deletions

View File

@ -256,14 +256,17 @@ namespace llarp
if(question.qtype != qTypeAAAA)
{
hdr_fields |= flags_RCODENameError;
answers.emplace_back();
auto& nx = answers.back();
nx.rr_name = question.qname;
nx.rr_type = question.qtype;
nx.rr_class = question.qclass;
nx.ttl = ttl;
nx.rData.resize(1);
nx.rData.data()[0] = 0;
if(question.qtype == qTypeA)
{
answers.emplace_back();
auto& nx = answers.back();
nx.rr_name = question.qname;
nx.rr_type = question.qtype;
nx.rr_class = question.qclass;
nx.ttl = ttl;
nx.rData.resize(1);
nx.rData.data()[0] = 0;
}
}
}
}

View File

@ -199,7 +199,7 @@ namespace llarp
TunEndpoint::HandleHookedDNSMessage(
dns::Message &&msg, std::function< void(dns::Message) > reply)
{
//llarp::LogInfo("Tun.HandleHookedDNSMessage ", msg.questions[0].qname);
// llarp::LogInfo("Tun.HandleHookedDNSMessage ", msg.questions[0].qname);
if(msg.questions.size() != 1)
{
llarp::LogWarn("bad number of dns questions: ", msg.questions.size());
@ -244,6 +244,7 @@ namespace llarp
}
else
msg.AddNXReply();
reply(msg);
}
else if(msg.questions[0].qtype == dns::qTypeA)
{
@ -259,7 +260,7 @@ namespace llarp
msg.AddNXReply();
}
else if(msg.questions[0].qname == "localhost.loki"
|| msg.questions[0].qname == "localhost.loki.")
|| msg.questions[0].qname == "localhost.loki.")
{
size_t counter = 0;
context->ForEachService(
@ -297,7 +298,7 @@ namespace llarp
// TODO: add hook to EnsurePathToSNode
EnsurePathToSNode(addr.as_array());
huint32_t ip = ObtainIPForAddr(addr, true);
if (ip.h)
if(ip.h)
msg.AddINReply(ip);
else
{