Skip to content

Commit

Permalink
avoid uninitialised res variable; don't cache any-to-tcp TC responses…
Browse files Browse the repository at this point in the history
…; ignore EDNS bufsize on TCP; also apply udp-truncation-threshold to non-EDNS questions
  • Loading branch information
Peter van Dijk committed Nov 7, 2013
1 parent a09a8ce commit 56b4d21
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pdns/pdns_recursor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,10 @@ void startDoResolve(void *p)
try {
loginfo=" (while setting loginfo)";
loginfo=" ("+dc->d_mdp.d_qname+"/"+lexical_cast<string>(dc->d_mdp.d_qtype)+" from "+(dc->d_remote.toString())+")";
uint32_t maxanswersize= dc->d_tcp ? 65535 : 512;
uint32_t maxanswersize= dc->d_tcp ? 65535 : g_udpTruncationThreshold;
EDNSOpts edo;
if(getEDNSOpts(dc->d_mdp, &edo)) {
maxanswersize = min(edo.d_packetsize, (uint16_t) (dc->d_tcp ? 65535 : g_udpTruncationThreshold));
if(getEDNSOpts(dc->d_mdp, &edo) && !dc->d_tcp) {
maxanswersize = min(edo.d_packetsize, (uint16_t) g_udpTruncationThreshold);
}

vector<DNSResourceRecord> ret;
Expand All @@ -520,8 +520,12 @@ void startDoResolve(void *p)
bool tracedQuery=false; // we could consider letting Lua know about this too
bool variableAnswer = false;

int res;

if(dc->d_mdp.d_qtype==QType::ANY && !dc->d_tcp && g_anyToTcp) {
pw.getHeader()->tc=1;
pw.getHeader()->tc = 1;
res = 0;
variableAnswer = true;
goto sendit;
}

Expand All @@ -538,7 +542,6 @@ void startDoResolve(void *p)
if(!dc->d_mdp.d_header.rd)
sr.setCacheOnly();

int res;

// if there is a RecursorLua active, and it 'took' the query in preResolve, we don't launch beginResolve
if(!t_pdl->get() || !(*t_pdl)->preresolve(dc->d_remote, g_listenSocketsAddresses[dc->d_socket], dc->d_mdp.d_qname, QType(dc->d_mdp.d_qtype), ret, res, &variableAnswer)) {
Expand Down

0 comments on commit 56b4d21

Please sign in to comment.