Permalink
Browse files

avoid uninitialised res variable; don't cache any-to-tcp TC responses…

…; ignore EDNS bufsize on TCP; also apply udp-truncation-threshold to non-EDNS questions
  • Loading branch information...
1 parent a09a8ce commit 56b4d21be5f21494738dba254b34db854163cd2e @Habbie Habbie committed Nov 7, 2013
Showing with 8 additions and 5 deletions.
  1. +8 −5 pdns/pdns_recursor.cc
View
@@ -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;
@@ -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;
}
@@ -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)) {

0 comments on commit 56b4d21

Please sign in to comment.