1
1
/*
2
2
PowerDNS Versatile Database Driven Nameserver
3
- Copyright (C) 2003 - 2013 PowerDNS.COM BV
3
+ Copyright (C) 2003 - 2014 PowerDNS.COM BV
4
4
5
5
This program is free software; you can redistribute it and/or modify
6
6
it under the terms of the GNU General Public License version 2 as published
@@ -931,7 +931,8 @@ int SyncRes::doResolveAt(set<string, CIStringCompare> nameservers, string auth,
931
931
932
932
resolveret=asyncresolveWrapper (*remoteIP, qname, qtype.getCode (),
933
933
doTCP, sendRDQuery, &d_now, &lwr); // <- we go out on the wire!
934
- if (resolveret != 1 ) {
934
+
935
+ if (resolveret != 1 ) {
935
936
if (resolveret==0 ) {
936
937
LOG (prefix<<qname<<" : timeout resolving " << (doTCP ? " over TCP" : " " )<<endl);
937
938
d_timeouts++;
@@ -945,13 +946,12 @@ int SyncRes::doResolveAt(set<string, CIStringCompare> nameservers, string auth,
945
946
s_unreachables++; d_unreachables++;
946
947
LOG (prefix<<qname<<" : error resolving" << (doTCP ? " over TCP" : " " ) <<" , possible error: " <<strerror (errno)<< endl);
947
948
}
948
-
949
+
949
950
if (resolveret!=-2 ) { // don't account for resource limits, they are our own fault
950
- {
951
-
952
- t_sstorage->nsSpeeds [*tns].submit (*remoteIP, 1000000 , &d_now); // 1 sec
953
- }
954
- if (s_serverdownmaxfails > 0 && t_sstorage->fails .incr (*remoteIP) >= s_serverdownmaxfails) {
951
+ t_sstorage->nsSpeeds [*tns].submit (*remoteIP, 1000000 , &d_now); // 1 sec
952
+
953
+ // code below makes sure we don't filter COM or the root
954
+ if (s_serverdownmaxfails > 0 && (auth.find (' .' )+1 != auth.size ()) && t_sstorage->fails .incr (*remoteIP) >= s_serverdownmaxfails) {
955
955
LOG (prefix<<qname<<" : Max fails reached resolving on " << remoteIP->toString () <<" . Going full throttle for 1 minute" <<endl);
956
956
t_sstorage->throttle .throttle (d_now.tv_sec , make_tuple (*remoteIP, " " , 0 ), s_serverdownthrottletime, 10000 ); // mark server as down
957
957
} else if (resolveret==-1 )
0 commit comments