[Pdns-dev] Patch to add a 'timeout' feature to dnsreplay

Augie Schwer augie.schwer at gmail.com
Tue Aug 21 16:15:52 CEST 2007


Index: dnsreplay.cc
===================================================================
--- dnsreplay.cc        (revision 1088)
+++ dnsreplay.cc        (working copy)
@@ -64,6 +64,7 @@

 StatBag S;
 bool g_quiet=true;
+uint16_t g_timeout=0;

 namespace po = boost::program_options;

@@ -334,7 +335,7 @@
   string packet;
   IPEndpoint remote;

-  int res=waitForData(s_socket->getHandle(), 0, 25000);
+  int res=waitForData(s_socket->getHandle(), g_timeout, 25000);
   if(res < 0 || res==0)
     return;

@@ -563,7 +564,8 @@
     ("packet-limit", po::value<uint32_t>()->default_value(0), "stop
after this many packets")
     ("quiet", po::value<bool>()->default_value(true), "don't be too noisy")
     ("recursive", po::value<bool>()->default_value(true), "look at
recursion desired packets, or not (defaults true)")
-    ("speedup", po::value<uint16_t>()->default_value(1), "replay at
this speedup");
+    ("speedup", po::value<uint16_t>()->default_value(1), "replay at
this speedup")
+    ("timeout", po::value<uint16_t>()->default_value(0), "wait at
least this many seconds for a reply");

   po::options_description alloptions;
   po::options_description hidden("hidden options");
@@ -602,6 +604,7 @@
   g_quiet = g_vm["quiet"].as<bool>();

   uint16_t speedup=g_vm["speedup"].as<uint16_t>();
+  g_timeout=g_vm["timeout"].as<uint16_t>();

   PcapPacketReader pr(g_vm["pcap-source"].as<string>());
   s_socket= new Socket(InterNetwork, Datagram);


-- 
Augie Schwer    -    Augie at Schwer.us    -    http://schwer.us
Key fingerprint = 9815 AE19 AFD1 1FE7 5DEE 2AC3 CB99 2784 27B0 C072


More information about the Pdns-dev mailing list