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

@ -230,7 +230,7 @@ generic_handle_dnsc_recvfrom(dnsc_answer_request *request,
// castBuf += question->name.length() + 1 + 4; // castBuf += question->name.length() + 1 + 4;
// castBuf += 2; // skip answer label // 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 // FIXME: only handling one atm
std::vector< dns_msg_answer * > answers; std::vector< dns_msg_answer * > answers;
@ -352,9 +352,9 @@ generic_handle_dnsc_recvfrom(dnsc_answer_request *request,
request->resolved(request); request->resolved(request);
return; 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(); answer = answers.front();
} }

Loading…
Cancel
Save