Changeset 699 for trunk/pdns/pdns/pdns_recursor.cc
- Timestamp:
- 04/14/06 13:26:50 (7 years ago)
- Files:
-
- 1 modified
-
trunk/pdns/pdns/pdns_recursor.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/pdns_recursor.cc
r698 r699 128 128 static map<int,PacketID> d_tcpclientreadsocks, d_tcpclientwritesocks; 129 129 130 MTasker<PacketID,string>* MT; 130 typedef MTasker<PacketID,string> MT_t; 131 MT_t* MT; 131 132 132 133 int asendtcp(const string& data, Socket* sock) … … 183 184 *d_len=packet.size(); 184 185 memcpy(data,packet.c_str(),min(len,*d_len)); 186 if(pident.nearMisses > 100) { 187 L<<Logger::Error<<"Too many ("<<pident.nearMisses<<") bogus answers came in from "<<sockAddrToString((struct sockaddr_in*)toaddr, sizeof(pident.remote))<<", assuming spoof attempt."<<endl; 188 return -1; 189 } 185 190 } 186 191 return ret; … … 1000 1005 L<<Logger::Warning<<"Discarding unexpected packet from "<<sockAddrToString((struct sockaddr_in*) &fromaddr, addrlen)<<endl; 1001 1006 g_stats.unexpectedCount++; 1007 1008 for(MT_t::waiters_t::iterator mthread=MT->d_waiters.begin(); mthread!=MT->d_waiters.end(); ++mthread) { 1009 if(!memcmp(&mthread->key.remote.sin_addr, &pident.remote.sin_addr, sizeof(pident.remote.sin_addr))) { 1010 mthread->key.nearMisses++; 1011 } 1012 } 1002 1013 } 1003 1014 }