Merge remote-tracking branch 'ryan/master'

pull/52/head
Jeff Becker 6 years ago
commit 06721ba7f3
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -212,6 +212,7 @@ extern "C"
}
*/
question->name = m_qName;
question->type = get16bits(moveable);
(*pos) += 2;
// printf("Now1 at [%d]\n", buffer - start);
@ -241,13 +242,12 @@ extern "C"
// llarp::LogDebug("Advancing to pos ", std::to_string(*pos));
moveable += (*pos); // advance to position
//hexDump(moveable, 12);
//hexDumpAt(buffer, *pos, 12);
if(*moveable == '\xc0')
{
// hexDump(moveable, 12);
// hexDumpAt(buffer, *pos, 12);
// hexDump(moveable, 2);
moveable++;
(*pos)++;
uint8_t readAt = *moveable;
@ -330,7 +330,12 @@ extern "C"
// FIXME: move this out of here, this shouldn't be responsible for decode
switch(answer->type)
{
case 5:
case 2: // NS
// don't really need to do anything here
moveable += answer->rdLen;
(*pos) += answer->rdLen; // advance the length
break;
case 5:
moveable += answer->rdLen;
(*pos) += answer->rdLen; // advance the length
break;

@ -224,13 +224,13 @@ generic_handle_dnsc_recvfrom(dnsc_answer_request *request,
for(uint32_t i = 0; i < hdr->qdCount; i++)
{
question = decode_question(castBufc, &pos);
// llarp::LogDebug("Read a question, now at ", std::to_string(pos));
//llarp::LogDebug("Read a question, now at ", std::to_string(pos));
// 1 dot: 1 byte for length + length
// 4 bytes for class/type
// castBuf += question->name.length() + 1 + 4;
// castBuf += 2; // skip answer label
}
llarp::LogInfo("Question ", std::to_string(question->type), " ", question->name);
llarp::LogDebug("Question ", std::to_string(question->type), " ", question->name);
// FIXME: only handling one atm
std::vector< dns_msg_answer * > answers;
@ -243,7 +243,7 @@ generic_handle_dnsc_recvfrom(dnsc_answer_request *request,
/*
llarp::LogDebug("Read an answer ", answer->type, " for ",
request->question.name, ", now at ", std::to_string(pos));
*/
*/
// llarp::LogInfo("Read an answer. Label Len: ", answer->name.length(), "
// rdLen: ", answer->rdLen);
// name + Type (2) + Class (2) + TTL (4) + rdLen (2) + rdData + skip next
@ -296,7 +296,7 @@ generic_handle_dnsc_recvfrom(dnsc_answer_request *request,
// pos = 0; // reset pos
answer = decode_answer(castBufc, &pos);
// answers.push_back(answer);
llarp::LogDebug("Read an authority for ",
llarp::LogDebug("Read an authority for ",
request->question.name, " at ", std::to_string(pos));
// castBuf += answer->name.length() + 4 + 4 + 4 + answer->rdLen;
if(pos > sz)
@ -352,9 +352,9 @@ generic_handle_dnsc_recvfrom(dnsc_answer_request *request,
request->resolved(request);
return;
}
if(answer->type == 5)
if(answer->type == 5 || answer->type == 2)
{
llarp::LogInfo("Last answer is a cname, advancing to first");
llarp::LogDebug("Last answer is a cname/NS, reverting to first");
answer = answers.front();
}

Loading…
Cancel
Save