diff -urp nmap-3.78/scan_engine.cc nmap-3.78mm/scan_engine.cc --- nmap-3.78/scan_engine.cc 2004-12-21 13:14:26.000000000 +0100 +++ nmap-3.78mm/scan_engine.cc 2004-12-21 13:23:28.000000000 +0100 @@ -1475,8 +1475,6 @@ static void ultrascan_port_update(UltraS probe = *probeI; - if (rcvdtime) ultrascan_adjust_times(USI, hss, probe, rcvdtime); - if (probe->type == UltraProbe::UP_IP) { if (USI->prot_scan) proto = IPPROTO_IP; @@ -1569,21 +1567,28 @@ static void ultrascan_port_update(UltraS } } - /* The rcvdtime check is because this func is called that way when - we give up on a probe because of too many retransmissions. */ - if (oldstate != newstate && probe->tryno > hss->max_successful_tryno - && rcvdtime) { - 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); - } + /* Is rcvdtime interesting? ICMP destination unreachable could be rate-limited (RFC1812) + * and is uninteresting for some scantypes. Also, if we didn't get new information + * from the response, consider the rcvdtime uninteresting too */ + if (rcvdtime && (noresp_open_scan || (newstate != PORT_FILTERED && newstate != oldstate))) { + /* The rcvdtime check is because this func is called that way when + we give up on a probe because of too many retransmissions. */ + + ultrascan_adjust_times(USI, hss, probe, rcvdtime); + + if (probe->tryno > hss->max_successful_tryno) { + 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 (remove_probe) {