From bc9e03a07981cf86935376dd61e9fbea247fc548 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Wed, 23 Apr 2014 21:42:31 +0200 Subject: [PATCH] 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. --- pdns/dnsreplay.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 "<