From f99573f0694558b50ebd3bd9135565b17c8849ef Mon Sep 17 00:00:00 2001 From: david Date: Thu, 8 Jan 2009 23:44:08 +0000 Subject: [PATCH] Fix an embarrassing error: In nmap-perf I had moved the bit of code that increases the scan dealy with an increase in max_successful_tryno. When I reverted a bunch of changes in r11651, I removed the moved code, leaving the scan delay increase nowhere. This puts it back in ultrascan_port_probe_update where it was before. --- scan_engine.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/scan_engine.cc b/scan_engine.cc index a5234b62d..9be9f2a1c 100644 --- a/scan_engine.cc +++ b/scan_engine.cc @@ -2699,9 +2699,25 @@ static void ultrascan_port_probe_update(UltraScanInfo *USI, HostScanStats *hss, adjust_ping = false; } - if (adjust_timing) + if (adjust_timing) { ultrascan_adjust_timing(USI, hss, probe, rcvdtime); + if (rcvdtime != NULL && probe->tryno > hss->max_successful_tryno) { + /* We got a positive response to a higher tryno than we've seen so far. */ + hss->max_successful_tryno = probe->tryno; + if (o.debugging) + log_write(LOG_STDOUT, "Increased max_successful_tryno for %s to %d (packet drop)\n", hss->target->targetipstr(), hss->max_successful_tryno); + if (hss->max_successful_tryno > ((o.timing_level >= 4)? 4 : 3)) { + unsigned int olddelay = hss->sdn.delayms; + hss->boostScanDelay(); + if (o.verbose && hss->sdn.delayms != olddelay) + log_write(LOG_STDOUT, "Increasing send delay for %s from %d to %d due to max_successful_tryno increase to %d\n", + hss->target->targetipstr(), olddelay, hss->sdn.delayms, + hss->max_successful_tryno); + } + } + } + /* If this probe received a positive response, consider making it the new timing ping probe. */ if (rcvdtime != NULL && adjust_ping