From: bert hubert Date: Wed, 23 Apr 2014 19:42:31 +0000 (+0200) Subject: dnsreplay had odd race conditions in sending/reseinding packets X-Git-Tag: rec-3.6.0-rc1~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc9e03a07981cf86935376dd61e9fbea247fc548;p=thirdparty%2Fpdns.git dnsreplay had odd race conditions in sending/reseinding packets We had logic to pre-read the first packet for better error reporting, and then not read it at the top of the while loop, but process the pre-read packet. However, this logic kept engaging, causing us to retransmit the previous packet a lot, depending on the size of our retransmit window, which in turn depended on the receiver characteristic. Horrible. dnsreplay may previously have overstated the number of duplicate packets because of this. --- diff --git a/pdns/dnsreplay.cc b/pdns/dnsreplay.cc index 4a358a4b78..9e81356170 100644 --- a/pdns/dnsreplay.cc +++ b/pdns/dnsreplay.cc @@ -549,6 +549,7 @@ bool sendPacketFromPR(PcapPacketReader& pr, const ComboAddress& remote) try { // yes, we send out ALWAYS. Even if we don't do anything with it later, if(!dh->qr) { // this is to stress out the reference server with all the pain + s_questions++; qd.d_assignedID = s_idmanager.getID(); uint16_t tmp=dh->id; dh->id=htons(qd.d_assignedID); @@ -560,7 +561,7 @@ bool sendPacketFromPR(PcapPacketReader& pr, const ComboAddress& remote) QuestionIdentifier qi=QuestionIdentifier::create(pr.getSource(), pr.getDest(), mdp); if(!mdp.d_header.qr) { - s_questions++; + if(qids.count(qi)) { if(!g_quiet) cout<<"Saw an exact duplicate question in PCAP "<