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
Expand Up @@ -496,10 +496,10 @@ void startDoResolve(void *p)
try { try {
loginfo=" (while setting loginfo)"; loginfo=" (while setting loginfo)";
loginfo=" ("+dc->d_mdp.d_qname+"/"+lexical_cast<string>(dc->d_mdp.d_qtype)+" from "+(dc->d_remote.toString())+")"; 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; EDNSOpts edo;
if(getEDNSOpts(dc->d_mdp, &edo)) { if(getEDNSOpts(dc->d_mdp, &edo) && !dc->d_tcp) {
maxanswersize = min(edo.d_packetsize, (uint16_t) (dc->d_tcp ? 65535 : g_udpTruncationThreshold)); maxanswersize = min(edo.d_packetsize, (uint16_t) g_udpTruncationThreshold);
} }


vector<DNSResourceRecord> ret; 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 tracedQuery=false; // we could consider letting Lua know about this too
bool variableAnswer = false; bool variableAnswer = false;


int res;

if(dc->d_mdp.d_qtype==QType::ANY && !dc->d_tcp && g_anyToTcp) { 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; goto sendit;
} }


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


int res;


// if there is a RecursorLua active, and it 'took' the query in preResolve, we don't launch beginResolve // 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)) { 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.